From lattner at cs.uiuc.edu Mon Aug 28 12:31:09 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 28 Aug 2006 12:31:09 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/WriteBytecodePass.h Message-ID: <200608281731.k7SHV96e024978@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: WriteBytecodePass.h updated: 1.15 -> 1.16 --- Log message: remove extraneous space --- Diffs of the changes: (+1 -1) WriteBytecodePass.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Bytecode/WriteBytecodePass.h diff -u llvm/include/llvm/Bytecode/WriteBytecodePass.h:1.15 llvm/include/llvm/Bytecode/WriteBytecodePass.h:1.16 --- llvm/include/llvm/Bytecode/WriteBytecodePass.h:1.15 Thu Apr 21 15:34:13 2005 +++ llvm/include/llvm/Bytecode/WriteBytecodePass.h Mon Aug 28 12:30:49 2006 @@ -36,7 +36,7 @@ } bool runOnModule(Module &M) { - WriteBytecodeToFile(&M, *Out, CompressFile ); + WriteBytecodeToFile(&M, *Out, CompressFile); return false; } }; From lattner at cs.uiuc.edu Mon Aug 28 12:32:09 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 28 Aug 2006 12:32:09 -0500 Subject: [llvm-commits] CVS: llvm/tools/opt/opt.cpp Message-ID: <200608281732.k7SHW9e4025040@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: opt.cpp updated: 1.117 -> 1.118 --- Log message: Add a --disable-compression option like llvm-link/llvm-as etc have --- Diffs of the changes: (+3 -1) opt.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.117 llvm/tools/opt/opt.cpp:1.118 --- llvm/tools/opt/opt.cpp:1.117 Sun Aug 27 17:40:26 2006 +++ llvm/tools/opt/opt.cpp Mon Aug 28 12:31:55 2006 @@ -38,6 +38,8 @@ static cl::list PassList(cl::desc("Optimizations available:")); +static cl::opt NoCompress("disable-compression", cl::init(false), + cl::desc("Don't compress the generated bytecode")); // Other command line options... // @@ -250,7 +252,7 @@ // Write bytecode out to disk or cout as the last step... if (!NoOutput && !AnalyzeOnly) - Passes.add(new WriteBytecodePass(Out, Out != &std::cout)); + Passes.add(new WriteBytecodePass(Out, Out != &std::cout, !NoCompress)); // Now that we have all of the passes ready, run them. Passes.run(*M.get()); From reid at x10sys.com Mon Aug 28 14:17:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 28 Aug 2006 14:17:13 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200608281917.k7SJHDuG026816@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.220 -> 1.221 --- Log message: Don't try to link with crtend if the llvm-gcc version is 4. This just eliminates gccld warning messages about not being able to find the crtend library if it hasn't been built. --- Diffs of the changes: (+12 -6) Makefile.programs | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.220 llvm-test/Makefile.programs:1.221 --- llvm-test/Makefile.programs:1.220 Tue Jun 27 15:37:01 2006 +++ llvm-test/Makefile.programs Mon Aug 28 14:16:59 2006 @@ -46,6 +46,12 @@ .PRECIOUS: Output/%.cbe Output/%.cbe.c Output/%.llvm.bc .PRECIOUS: Output/%.linked.bc +# If we're using the llvm-gcc3 compiler then we need to also link with the +# llvm c runtime library, othwerwise we don't +ifneq ($(LLVMGCC_MAJVERS),4) +LIBS += -lcrtend +endif + PROGDIR = $(PROJ_SRC_ROOT) # @@ -224,7 +230,7 @@ $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc): \ Output/%.llvm.bc: Output/%.linked.bc $(LGCCLDPROG) - -$(LGCCLD) $(STATS) $< $(EXTRA_LINKTIME_OPT_FLAGS) -lc $(LIBS) -lcrtend -o Output/$*.llvm + -$(LGCCLD) $(STATS) $< $(EXTRA_LINKTIME_OPT_FLAGS) -lc $(LIBS) -o Output/$*.llvm ifneq ($(OPTPASSES),) -$(LOPT) -q $(OPTPASSES) < $@ > $@.tmp $(MV) -f $@.tmp $@ @@ -232,7 +238,7 @@ $(PROGRAMS_TO_TEST:%=Output/%.llvm): \ Output/%.llvm: Output/%.linked.bc $(LGCCLDPROG) - -$(LGCCLD) $(STATS) $< -lc $(LIBS) -lcrtend -o Output/$*.llvm + -$(LGCCLD) $(STATS) $< -lc $(LIBS) -o Output/$*.llvm ifneq ($(OPTPASSES),) -$(LOPT) -q $(OPTPASSES) < $@ > $@.tmp $(MV) -f $@.tmp $@ @@ -240,20 +246,20 @@ $(PROGRAMS_TO_TEST:%=Output/%.noopt-llvm.bc): \ Output/%.noopt-llvm.bc: Output/%.linked.rbc $(LGCCLDPROG) - -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -lcrtend -o Output/$*.noopt-llvm + -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -o Output/$*.noopt-llvm $(PROGRAMS_TO_TEST:%=Output/%.noopt-llvm): \ Output/%.noopt-llvm: Output/%.linked.rbc $(LGCCLDPROG) - -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -lcrtend -o Output/$*.noopt-llvm + -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -o Output/$*.noopt-llvm $(PROGRAMS_TO_TEST:%=Output/%.nogccldopt-llvm.bc): \ Output/%.nogccldopt-llvm.bc: Output/%.linked.bc $(LGCCLDPROG) - -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -lcrtend -o Output/$*.nogccldopt-llvm + -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -o Output/$*.nogccldopt-llvm $(PROGRAMS_TO_TEST:%=Output/%.nogccldopt-llvm): \ Output/%.nogccldopt-llvm: Output/%.linked.rbc $(LGCCLDPROG) - -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -lcrtend -o Output/$*.nogccldopt-llvm + -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -o Output/$*.nogccldopt-llvm endif # ifndef DISABLE_FOR_LLVM_PROGRAMS From evan.cheng at apple.com Mon Aug 28 15:10:31 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 28 Aug 2006 15:10:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200608282010.k7SKAVwW027794@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.98 -> 1.99 --- Log message: Add an optional pass to preprocess the DAG before x86 isel to allow selecting more load/mod/store instructions. --- Diffs of the changes: (+130 -0) X86ISelDAGToDAG.cpp | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 130 insertions(+) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.98 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.99 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.98 Sun Aug 27 07:54:01 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Aug 28 15:10:17 2006 @@ -39,6 +39,10 @@ #include using namespace llvm; +#include "llvm/Support/CommandLine.h" +static cl::opt X86ISelPreproc("enable-x86-isel-preprocessing", cl::Hidden, + cl::desc("Enable isel preprocessing on X86")); + //===----------------------------------------------------------------------===// // Pattern Matcher Implementation //===----------------------------------------------------------------------===// @@ -133,6 +137,7 @@ bool TryFoldLoad(SDOperand P, SDOperand N, SDOperand &Base, SDOperand &Scale, SDOperand &Index, SDOperand &Disp); + void InstructionSelectPreprocess(SelectionDAG &DAG); /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for /// inline asm expressions. @@ -232,12 +237,137 @@ return !isNonImmUse(U, N); } +/// MoveBelowTokenFactor - Replace TokenFactor operand with load's chain operand +/// and move load below the TokenFactor. Replace store's chain operand with +/// load's chain result. +static void MoveBelowTokenFactor(SelectionDAG &DAG, SDOperand Load, + SDOperand Store, SDOperand TF) { + std::vector Ops; + for (unsigned i = 0, e = TF.Val->getNumOperands(); i != e; ++i) + if (Load.Val == TF.Val->getOperand(i).Val) + Ops.push_back(Load.Val->getOperand(0)); + else + Ops.push_back(TF.Val->getOperand(i)); + DAG.UpdateNodeOperands(TF, &Ops[0], Ops.size()); + DAG.UpdateNodeOperands(Load, TF, Load.getOperand(1), Load.getOperand(2)); + DAG.UpdateNodeOperands(Store, Load.getValue(1), Store.getOperand(1), + Store.getOperand(2), Store.getOperand(3)); +} + +/// InstructionSelectPreprocess - Preprocess the DAG to allow the instruction +/// selector to pick more load-modify-store instructions. This is a common +/// case: +/// +/// [Load chain] +/// ^ +/// | +/// [Load] +/// ^ ^ +/// | | +/// / \- +/// / | +/// [TokenFactor] [Op] +/// ^ ^ +/// | | +/// \ / +/// \ / +/// [Store] +/// +/// The fact the store's chain operand != load's chain will prevent the +/// (store (op (load))) instruction from being selected. We can transform it to: +/// +/// [Load chain] +/// ^ +/// | +/// [TokenFactor] +/// ^ +/// | +/// [Load] +/// ^ ^ +/// | | +/// | \- +/// | | +/// | [Op] +/// | ^ +/// | | +/// \ / +/// \ / +/// [Store] +void X86DAGToDAGISel::InstructionSelectPreprocess(SelectionDAG &DAG) { + for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), + E = DAG.allnodes_end(); I != E; ++I) { + if (I->getOpcode() != ISD::STORE) + continue; + SDOperand Chain = I->getOperand(0); + if (Chain.Val->getOpcode() != ISD::TokenFactor) + continue; + + SDOperand N1 = I->getOperand(1); + SDOperand N2 = I->getOperand(2); + if (!N1.hasOneUse()) + continue; + + bool RModW = false; + SDOperand Load; + unsigned Opcode = N1.Val->getOpcode(); + switch (Opcode) { + case ISD::ADD: + case ISD::MUL: + case ISD::FADD: + case ISD::FMUL: + case ISD::AND: + case ISD::OR: + case ISD::XOR: + case ISD::ADDC: + case ISD::ADDE: { + SDOperand N10 = N1.getOperand(0); + SDOperand N11 = N1.getOperand(1); + if (N10.Val->getOpcode() == ISD::LOAD) + RModW = true; + else if (N11.Val->getOpcode() == ISD::LOAD) { + RModW = true; + std::swap(N10, N11); + } + RModW = RModW && N10.Val->isOperand(Chain.Val) && N10.hasOneUse() && + N10.getOperand(1) == N2; + if (RModW) + Load = N10; + break; + } + case ISD::SUB: + case ISD::SHL: + case ISD::SRA: + case ISD::SRL: + case ISD::ROTL: + case ISD::ROTR: + case ISD::SUBC: + case ISD::SUBE: + case X86ISD::SHLD: + case X86ISD::SHRD: { + SDOperand N10 = N1.getOperand(0); + if (N10.Val->getOpcode() == ISD::LOAD) + RModW = N10.Val->isOperand(Chain.Val) && N10.hasOneUse() && + N10.getOperand(1) == N2; + if (RModW) + Load = N10; + break; + } + } + + if (RModW) + MoveBelowTokenFactor(DAG, Load, SDOperand(I, 0), Chain); + } +} + /// InstructionSelectBasicBlock - This callback is invoked by SelectionDAGISel /// when it has created a SelectionDAG for us to codegen. void X86DAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) { DEBUG(BB->dump()); MachineFunction::iterator FirstMBB = BB; + if (X86ISelPreproc) + InstructionSelectPreprocess(DAG); + // Codegen the basic block. #ifndef NDEBUG DEBUG(std::cerr << "===== Instruction selection begins:\n"); From evan.cheng at apple.com Mon Aug 28 15:12:53 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 28 Aug 2006 15:12:53 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200608282012.k7SKCreH027859@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.221 -> 1.222 --- Log message: Set x86 llcbeta to -enable-x86-isel-preprocessing. --- Diffs of the changes: (+1 -1) Makefile.programs | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.221 llvm-test/Makefile.programs:1.222 --- llvm-test/Makefile.programs:1.221 Mon Aug 28 14:16:59 2006 +++ llvm-test/Makefile.programs Mon Aug 28 15:12:39 2006 @@ -203,7 +203,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -enable-x86-fastcc +LLCBETAOPTION := -enable-x86-isel-preprocessing endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts From lattner at cs.uiuc.edu Mon Aug 28 16:52:23 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 28 Aug 2006 16:52:23 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/SmallVector.h Message-ID: <200608282152.k7SLqNfi029406@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: SmallVector.h updated: 1.16 -> 1.17 --- Log message: Add 2nd form of resize --- Diffs of the changes: (+12 -0) SmallVector.h | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/include/llvm/ADT/SmallVector.h diff -u llvm/include/llvm/ADT/SmallVector.h:1.16 llvm/include/llvm/ADT/SmallVector.h:1.17 --- llvm/include/llvm/ADT/SmallVector.h:1.16 Tue Aug 22 12:28:57 2006 +++ llvm/include/llvm/ADT/SmallVector.h Mon Aug 28 16:52:08 2006 @@ -124,6 +124,18 @@ } } + void resize(unsigned N, const T &NV) { + if (N < size()) { + destroy_range(Begin+N, End); + End = Begin+N; + } else if (N > size()) { + if (Begin+N > Capacity) + grow(N); + construct_range(End, Begin+N, NV); + End = Begin+N; + } + } + void swap(SmallVectorImpl &RHS); /// append - Add the specified range to the end of the SmallVector. From evan.cheng at apple.com Mon Aug 28 17:14:31 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 28 Aug 2006 17:14:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Message-ID: <200608282214.k7SMEVoq029802@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.56 -> 1.57 --- Log message: On Mac, print jump table entries after the function to work around a linker issue. --- Diffs of the changes: (+6 -3) X86ATTAsmPrinter.cpp | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.56 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.57 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.56 Wed Jul 26 21:05:13 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Aug 28 17:14:16 2006 @@ -38,9 +38,6 @@ // Print out constants referenced by the function EmitConstantPool(MF.getConstantPool()); - // Print out jump tables referenced by the function - EmitJumpTableInfo(MF.getJumpTableInfo()); - // Print out labels for the function. const Function *F = MF.getFunction(); switch (F->getLinkage()) { @@ -98,6 +95,12 @@ printMachineInstruction(II); } } + + // Print out jump tables referenced by the function + // Mac OS X requires at least one non-local (e.g. L1) labels before local + // lables that are used in jump table expressions (e.g. LBB1_1-LJT1_0). + EmitJumpTableInfo(MF.getJumpTableInfo()); + if (HasDotTypeDotSizeDirective) O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n"; From llvm at cs.uiuc.edu Mon Aug 28 17:32:19 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 28 Aug 2006 17:32:19 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/ Message-ID: <200608282232.k7SMWJ1i030112@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: --- Log message: Directory /var/cvs/llvm/llvm/test/Regression/Transforms/PredicateSimplifier added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From nicholas at mxc.ca Mon Aug 28 17:45:14 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 28 Aug 2006 17:45:14 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200608282245.k7SMjEKJ030343@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.64 -> 1.65 --- Log message: Add PredicateSimplifier pass. Collapses equal variables into one form and simplifies expressions. This implements the optimization described in PR807: http://llvm.org/PR807 . --- Diffs of the changes: (+4 -0) CREDITS.TXT | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.64 llvm/CREDITS.TXT:1.65 --- llvm/CREDITS.TXT:1.64 Wed Aug 16 16:18:56 2006 +++ llvm/CREDITS.TXT Mon Aug 28 17:44:55 2006 @@ -176,3 +176,7 @@ E: isanbard at gmail.com W: http://web.mac.com/bwendling/ D: The `Lower Setjmp/Longjmp' pass, improvements to the -lowerswitch pass. + +N: Nick Lewycky +E: nicholas at mxc.ca +D: PredicateSimplifier pass From nicholas at mxc.ca Mon Aug 28 17:45:17 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 28 Aug 2006 17:45:17 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Scalar.h Message-ID: <200608282245.k7SMjHO7030354@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: Scalar.h updated: 1.66 -> 1.67 --- Log message: Add PredicateSimplifier pass. Collapses equal variables into one form and simplifies expressions. This implements the optimization described in PR807: http://llvm.org/PR807 . --- Diffs of the changes: (+5 -0) Scalar.h | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/include/llvm/Transforms/Scalar.h diff -u llvm/include/llvm/Transforms/Scalar.h:1.66 llvm/include/llvm/Transforms/Scalar.h:1.67 --- llvm/include/llvm/Transforms/Scalar.h:1.66 Thu Jun 8 15:02:53 2006 +++ llvm/include/llvm/Transforms/Scalar.h Mon Aug 28 17:44:55 2006 @@ -308,6 +308,11 @@ FunctionPass *createLCSSAPass(); extern const PassInfo *LCSSAID; +//===----------------------------------------------------------------------===// +// This pass collapses duplicate variables into one canonical form, +// and tries to simplify expressions along the way. +FunctionPass *createPredicateSimplifierPass(); + } // End llvm namespace #endif From nicholas at mxc.ca Mon Aug 28 17:45:17 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 28 Aug 2006 17:45:17 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll predsimplify.reg1.ll predsimplify.reg2.ll predsimplify.reg3.ll Message-ID: <200608282245.k7SMjHSG030365@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: predsimplify.ll added (r1.1) predsimplify.reg1.ll added (r1.1) predsimplify.reg2.ll added (r1.1) predsimplify.reg3.ll added (r1.1) --- Log message: Add PredicateSimplifier pass. Collapses equal variables into one form and simplifies expressions. This implements the optimization described in PR807: http://llvm.org/PR807 . --- Diffs of the changes: (+223 -0) predsimplify.ll | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++ predsimplify.reg1.ll | 23 +++++++++ predsimplify.reg2.ll | 49 +++++++++++++++++++ predsimplify.reg3.ll | 21 ++++++++ 4 files changed, 223 insertions(+) Index: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll:1.1 *** /dev/null Mon Aug 28 17:45:06 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll Mon Aug 28 17:44:55 2006 *************** *** 0 **** --- 1,130 ---- + ; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | not grep fail + + void %test1(int %x) { + entry: + %A = seteq int %x, 0 + br bool %A, label %then.1, label %else.1 + then.1: + %B = seteq int %x, 1 + br bool %B, label %then.2, label %else.1 + then.2: + call void (...)* %fail( ) + ret void + else.1: + ret void + } + + void %test2(int %x) { + entry: + %A = seteq int %x, 0 + %B = seteq int %x, 1 + br bool %A, label %then.1, label %else.1 + then.1: + br bool %B, label %then.2, label %else.1 + then.2: + call void (...)* %fail( ) + ret void + else.1: + ret void + } + + void %test3(int %x) { + entry: + %A = seteq int %x, 0 + %B = seteq int %x, 1 + br bool %A, label %then.1, label %else.1 + then.1: + br bool %B, label %then.2, label %else.1 + then.2: + call void (...)* %fail( ) + ret void + else.1: + ret void + } + + void %test4(int %x, int %y) { + entry: + %A = seteq int %x, 0 + %B = seteq int %y, 0 + %C = and bool %A, %B + br bool %C, label %then.1, label %else.1 + then.1: + %D = seteq int %x, 0 + br bool %D, label %then.2, label %else.2 + then.2: + %E = seteq int %y, 0 + br bool %E, label %else.1, label %else.2 + else.1: + ret void + else.2: + call void (...)* %fail( ) + ret void + } + + void %test5(int %x) { + entry: + %A = seteq int %x, 0 + br bool %A, label %then.1, label %else.1 + then.1: + ret void + then.2: + call void (...)* %fail( ) + ret void + else.1: + %B = seteq int %x, 0 + br bool %B, label %then.2, label %then.1 + } + + void %test6(int %x, int %y) { + entry: + %A = seteq int %x, 0 + %B = seteq int %y, 0 + %C = or bool %A, %B + br bool %C, label %then.1, label %else.1 + then.1: + ret void + then.2: + call void (...)* %fail( ) + ret void + else.1: + %D = seteq int %x, 0 + br bool %D, label %then.2, label %else.2 + else.2: + %E = setne int %y, 0 + br bool %E, label %then.1, label %then.2 + } + + void %test7(int %x) { + entry: + %A = setne int %x, 0 + %B = xor bool %A, true + br bool %B, label %then.1, label %else.1 + then.1: + %C = seteq int %x, 1 + br bool %C, label %then.2, label %else.1 + then.2: + call void (...)* %fail( ) + ret void + else.1: + ret void + } + + void %test8(int %x) { + entry: + %A = add int %x, 1 + %B = seteq int %x, 0 + br bool %B, label %then.1, label %then.2 + then.1: + %C = seteq int %A, 1 + br bool %C, label %then.2, label %else.2 + then.2: + ret void + else.2: + call void (...)* %fail( ) + ret void + } + + + declare void %fail(...) + + declare void %pass(...) Index: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg1.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg1.ll:1.1 *** /dev/null Mon Aug 28 17:45:17 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg1.ll Mon Aug 28 17:44:55 2006 *************** *** 0 **** --- 1,23 ---- + ; RUN: llvm-as < %s | opt -predsimplify -verify + + void %dgefa() { + entry: + br label %cond_true96 + + cond_true: ; preds = %cond_true96 + %tmp19 = seteq int %tmp10, %k.0 ; [#uses=1] + br bool %tmp19, label %cond_next, label %cond_true20 + + cond_true20: ; preds = %cond_true + br label %cond_next + + cond_next: ; preds = %cond_true20, %cond_true + %tmp84 = setgt int %tmp3, 1999 ; [#uses=0] + ret void + + cond_true96: ; preds = %cond_true96, %entry + %k.0 = phi int [ 0, %entry ], [ 0, %cond_true96 ] ; [#uses=3] + %tmp3 = add int %k.0, 1 ; [#uses=1] + %tmp10 = add int 0, %k.0 ; [#uses=1] + br bool false, label %cond_true96, label %cond_true + } Index: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg2.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg2.ll:1.1 *** /dev/null Mon Aug 28 17:45:17 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg2.ll Mon Aug 28 17:44:55 2006 *************** *** 0 **** --- 1,49 ---- + ; RUN: llvm-as < %s | opt -predsimplify -verify + + ; ModuleID = 'bugpoint-reduced-simplified.bc' + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + deplibs = [ "c", "crtend" ] + %struct.anon = type { %struct.set_family*, %struct.set_family*, %struct.set_family*, sbyte*, int, uint*, %struct.pair_struct*, sbyte**, %struct.symbolic_t*, %struct.symbolic_t* } + %struct.pair_struct = type { int, int*, int* } + %struct.set_family = type { int, int, int, int, int, uint*, %struct.set_family* } + %struct.symbolic_label_t = type { sbyte*, %struct.symbolic_label_t* } + %struct.symbolic_list_t = type { int, int, %struct.symbolic_list_t* } + %struct.symbolic_t = type { %struct.symbolic_list_t*, int, %struct.symbolic_label_t*, int, %struct.symbolic_t* } + + implementation ; Functions: + + void %find_pairing_cost(int %strategy) { + entry: + br bool false, label %cond_true299, label %bb314 + + bb94: ; preds = %cond_true299 + switch int %strategy, label %bb246 [ + int 0, label %bb196 + int 1, label %bb159 + ] + + cond_next113: ; preds = %cond_true299 + switch int %strategy, label %bb246 [ + int 0, label %bb196 + int 1, label %bb159 + ] + + bb159: ; preds = %cond_next113, %bb94 + ret void + + bb196: ; preds = %cond_next113, %bb94 + %Rsave.0.3 = phi %struct.set_family* [ null, %bb94 ], [ null, %cond_next113 ] ; <%struct.set_family*> [#uses=0] + ret void + + bb246: ; preds = %cond_next113, %bb94 + br label %bb314 + + cond_true299: ; preds = %entry + %tmp55 = setgt int %strategy, 0 ; [#uses=1] + br bool %tmp55, label %bb94, label %cond_next113 + + bb314: ; preds = %bb246, %entry + ret void + } Index: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg3.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg3.ll:1.1 *** /dev/null Mon Aug 28 17:45:17 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg3.ll Mon Aug 28 17:44:55 2006 *************** *** 0 **** --- 1,21 ---- + ; RUN: llvm-as < %s | opt -predsimplify -simplifycfg | llvm-dis | grep pass + + void %regtest(int %x) { + entry: + %A = seteq int %x, 0 + br bool %A, label %middle, label %after + middle: + br label %after + after: + %B = seteq int %x, 0 + br bool %B, label %then, label %else + then: + br label %end + else: + call void (...)* %pass( ) + br label %end + end: + ret void + } + + declare void %pass(...) From nicholas at mxc.ca Mon Aug 28 17:45:15 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 28 Aug 2006 17:45:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200608282245.k7SMjFxD030348@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp added (r1.1) --- Log message: Add PredicateSimplifier pass. Collapses equal variables into one form and simplifies expressions. This implements the optimization described in PR807: http://llvm.org/PR807 . --- Diffs of the changes: (+744 -0) PredicateSimplifier.cpp | 744 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 744 insertions(+) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -c /dev/null llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.1 *** /dev/null Mon Aug 28 17:45:05 2006 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Mon Aug 28 17:44:55 2006 *************** *** 0 **** --- 1,744 ---- + //===-- PredicateSimplifier.cpp - Path Sensitive Simplifier -----------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Nick Lewycky and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===------------------------------------------------------------------===// + // + // Path-sensitive optimizer. In a branch where x == y, replace uses of + // x with y. Permits further optimization, such as the elimination of + // the unreachable call: + // + // void test(int *p, int *q) + // { + // if (p != q) + // return; + // + // if (*p != *q) + // foo(); // unreachable + // } + // + //===------------------------------------------------------------------===// + // + // This optimization works by substituting %q for %p when protected by a + // conditional that assures us of that fact. Equivalent variables are + // called SynSets; sets of synonyms. We maintain a mapping from Value * + // to the SynSet, and the SynSet maintains the best canonical form of the + // Value. + // + // Properties are stored as relationships between two SynSets. + // + //===------------------------------------------------------------------===// + + // TODO: + // * Handle SelectInst + // * Switch to EquivalenceClasses ADT + // * Check handling of NAN in floating point types + // * Don't descend into false side of branches with ConstantBool condition. + + #define DEBUG_TYPE "predsimplify" + #include "llvm/Transforms/Scalar.h" + #include "llvm/Constants.h" + #include "llvm/Instructions.h" + #include "llvm/Pass.h" + #include "llvm/ADT/Statistic.h" + #include "llvm/ADT/STLExtras.h" + #include "llvm/Analysis/Dominators.h" + #include "llvm/Support/CFG.h" + #include "llvm/Support/Debug.h" + #include + using namespace llvm; + + namespace { + Statistic<> + NumVarsReplaced("predsimplify", "Number of argument substitutions"); + Statistic<> + NumResolved("predsimplify", "Number of instruction substitutions"); + Statistic<> + NumSwitchCases("predsimplify", "Number of switch cases removed"); + + /// Used for choosing the canonical Value in a synonym set. + /// Leaves the better one in V1. Returns whether a swap took place. + static void order(Value *&V1, Value *&V2) { + if (isa(V2)) { + if (!isa(V1)) { + std::swap(V1, V2); + return; + } + } else if (isa(V2)) { + if (!isa(V1) && !isa(V1)) { + std::swap(V1, V2); + return; + } + } + if (User *U1 = dyn_cast(V1)) { + for (User::const_op_iterator I = U1->op_begin(), E = U1->op_end(); + I != E; ++I) { + if (*I == V2) { + std::swap(V1, V2); + return; + } + } + } + return; + } + + /// Represents the set of equivalent Value*s and provides insertion + /// and fast lookup. Also stores the set of inequality relationships. + class PropertySet { + struct Property; + public: + typedef unsigned SynSet; + typedef std::map::iterator SynonymIterator; + typedef std::map::const_iterator ConstSynonymIterator; + typedef std::vector::iterator PropertyIterator; + typedef std::vector::const_iterator ConstPropertyIterator; + + enum Ops { + EQ, + NE + }; + + Value *canonicalize(Value *V) const { + Value *C = lookup(V); + return C ? C : V; + } + + Value *lookup(Value *V) const { + ConstSynonymIterator SI = SynonymMap.find(V); + if (SI == SynonymMap.end()) return NULL; + + return Synonyms[SI->second]; + } + + Value *lookup(SynSet SS) const { + assert(SS < Synonyms.size()); + return Synonyms[SS]; + } + + // Find a SynSet for a given Value. + // + // Given the Value *V sets SS to a valid SynSet. Returns true if it + // found it. + bool findSynSet(Value *V, SynSet &SS) const { + ConstSynonymIterator SI = SynonymMap.find(V); + if (SI != SynonymMap.end()) { + SS = SI->second; + return true; + } + + std::vector::const_iterator I = + std::find(Synonyms.begin(), Synonyms.end(), V); + if (I != Synonyms.end()) { + SS = I-Synonyms.begin(); + return true; + } + + return false; + } + + bool empty() const { + return Synonyms.empty(); + } + + void addEqual(Value *V1, Value *V2) { + order(V1, V2); + if (isa(V2)) return; // refuse to set false == true. + + V1 = canonicalize(V1); + V2 = canonicalize(V2); + + if (V1 == V2) return; // already equivalent. + + SynSet I1, I2; + bool F1 = findSynSet(V1, I1), + F2 = findSynSet(V2, I2); + + DEBUG(std::cerr << "V1: " << *V1 << " I1: " << I1 + << " F1: " << F1 << "\n"); + DEBUG(std::cerr << "V2: " << *V2 << " I2: " << I2 + << " F2: " << F2 << "\n"); + + if (!F1 && !F2) { + SynSet SS = addSynSet(V1); + SynonymMap[V1] = SS; + SynonymMap[V2] = SS; + } + + else if (!F1 && F2) { + SynonymMap[V1] = I2; + } + + else if (F1 && !F2) { + SynonymMap[V2] = I1; + } + + else { + // This is the case where we have two sets, [%a1, %a2, %a3] and + // [%p1, %p2, %p3] and someone says that %a2 == %p3. We need to + // combine the two synsets. + + // Collapse synonyms of V2 into V1. + for (SynonymIterator I = SynonymMap.begin(), E = SynonymMap.end(); + I != E; ++I) { + if (I->second == I2) I->second = I1; + else if (I->second > I2) --I->second; + } + + // Move Properties + for (PropertyIterator I = Properties.begin(), E = Properties.end(); + I != E; ++I) { + if (I->S1 == I2) I->S1 = I1; + else if (I->S1 > I2) --I->S1; + if (I->S2 == I2) I->S2 = I1; + else if (I->S2 > I2) --I->S2; + } + + // Remove the synonym + Synonyms.erase(Synonyms.begin() + I2); + } + + addImpliedProperties(EQ, V1, V2); + } + + void addNotEqual(Value *V1, Value *V2) { + DEBUG(std::cerr << "not equal: " << *V1 << " and " << *V2 << "\n"); + bool skip_search = false; + V1 = canonicalize(V1); + V2 = canonicalize(V2); + + SynSet S1, S2; + if (!findSynSet(V1, S1)) { + skip_search = true; + S1 = addSynSet(V1); + } + if (!findSynSet(V2, S2)) { + skip_search = true; + S2 = addSynSet(V2); + } + + if (!skip_search) { + // Does the property already exist? + for (PropertyIterator I = Properties.begin(), E = Properties.end(); + I != E; ++I) { + if (I->Opcode != NE) continue; + + if ((I->S1 == S1 && I->S2 == S2) || + (I->S1 == S2 && I->S2 == S1)) { + return; // Found. + } + } + } + + // Add the property. + Properties.push_back(Property(NE, S1, S2)); + addImpliedProperties(NE, V1, V2); + } + + PropertyIterator findProperty(Ops Opcode, Value *V1, Value *V2) { + assert(Opcode != EQ && "Can't findProperty on EQ." + "Use the lookup method instead."); + + SynSet S1, S2; + if (!findSynSet(V1, S1)) return Properties.end(); + if (!findSynSet(V2, S2)) return Properties.end(); + + // Does the property already exist? + for (PropertyIterator I = Properties.begin(), E = Properties.end(); + I != E; ++I) { + if (I->Opcode != Opcode) continue; + + if ((I->S1 == S1 && I->S2 == S2) || + (I->S1 == S2 && I->S2 == S1)) { + return I; // Found. + } + } + return Properties.end(); + } + + ConstPropertyIterator + findProperty(Ops Opcode, Value *V1, Value *V2) const { + assert(Opcode != EQ && "Can't findProperty on EQ." + "Use the lookup method instead."); + + SynSet S1, S2; + if (!findSynSet(V1, S1)) return Properties.end(); + if (!findSynSet(V2, S2)) return Properties.end(); + + // Does the property already exist? + for (ConstPropertyIterator I = Properties.begin(), + E = Properties.end(); I != E; ++I) { + if (I->Opcode != Opcode) continue; + + if ((I->S1 == S1 && I->S2 == S2) || + (I->S1 == S2 && I->S2 == S1)) { + return I; // Found. + } + } + return Properties.end(); + } + + private: + // Represents Head OP [Tail1, Tail2, ...] + // For example: %x != %a, %x != %b. + struct Property { + Property(Ops opcode, SynSet s1, SynSet s2) + : Opcode(opcode), S1(s1), S2(s2) + { assert(opcode != EQ && "Equality belongs in the synonym set," + "not a property."); } + + bool operator<(const Property &rhs) const { + if (Opcode != rhs.Opcode) return Opcode < rhs.Opcode; + if (S1 != rhs.S1) return S1 < rhs.S1; + return S2 < rhs.S2; + } + + Ops Opcode; + SynSet S1, S2; + }; + + SynSet addSynSet(Value *V) { + Synonyms.push_back(V); + return Synonyms.size()-1; + } + + void add(Ops Opcode, Value *V1, Value *V2, bool invert) { + switch (Opcode) { + case EQ: + if (invert) addNotEqual(V1, V2); + else addEqual(V1, V2); + break; + case NE: + if (invert) addEqual(V1, V2); + else addNotEqual(V1, V2); + break; + default: + assert(0 && "Unknown property opcode."); + } + } + + // Finds the properties implied by a synonym and adds them too. + // Example: ("seteq %a, %b", true, EQ) --> (%a, %b, EQ) + // ("seteq %a, %b", false, EQ) --> (%a, %b, NE) + void addImpliedProperties(Ops Opcode, Value *V1, Value *V2) { + order(V1, V2); + + if (BinaryOperator *BO = dyn_cast(V2)) { + switch (BO->getOpcode()) { + case Instruction::SetEQ: + if (V1 == ConstantBool::True) + add(Opcode, BO->getOperand(0), BO->getOperand(1), false); + if (V1 == ConstantBool::False) + add(Opcode, BO->getOperand(0), BO->getOperand(1), true); + break; + case Instruction::SetNE: + if (V1 == ConstantBool::True) + add(Opcode, BO->getOperand(0), BO->getOperand(1), true); + if (V1 == ConstantBool::False) + add(Opcode, BO->getOperand(0), BO->getOperand(1), false); + break; + case Instruction::SetLT: + case Instruction::SetGT: + if (V1 == ConstantBool::True) + add(Opcode, BO->getOperand(0), BO->getOperand(1), true); + break; + case Instruction::SetLE: + case Instruction::SetGE: + if (V1 == ConstantBool::False) + add(Opcode, BO->getOperand(0), BO->getOperand(1), true); + break; + case Instruction::And: + if (V1 == ConstantBool::True) { + add(Opcode, ConstantBool::True, BO->getOperand(0), false); + add(Opcode, ConstantBool::True, BO->getOperand(1), false); + } + break; + case Instruction::Or: + if (V1 == ConstantBool::False) { + add(Opcode, ConstantBool::False, BO->getOperand(0), false); + add(Opcode, ConstantBool::False, BO->getOperand(1), false); + } + break; + case Instruction::Xor: + if (V1 == ConstantBool::True) { + if (BO->getOperand(0) == ConstantBool::True) + add(Opcode, ConstantBool::False, BO->getOperand(1), false); + if (BO->getOperand(1) == ConstantBool::True) + add(Opcode, ConstantBool::False, BO->getOperand(0), false); + } + if (V1 == ConstantBool::False) { + if (BO->getOperand(0) == ConstantBool::True) + add(Opcode, ConstantBool::True, BO->getOperand(1), false); + if (BO->getOperand(1) == ConstantBool::True) + add(Opcode, ConstantBool::True, BO->getOperand(0), false); + } + break; + default: + break; + } + } + } + + std::map SynonymMap; + std::vector Synonyms; + + public: + void debug(std::ostream &os) const { + os << Synonyms.size() << " synsets:\n"; + for (unsigned I = 0, E = Synonyms.size(); I != E; ++I) { + os << I << ". " << *Synonyms[I] << "\n"; + } + for (ConstSynonymIterator I = SynonymMap.begin(),E = SynonymMap.end(); + I != E; ++I) { + os << *I->first << "-> #" << I->second << "\n"; + } + os << Properties.size() << " properties:\n"; + for (unsigned I = 0, E = Properties.size(); I != E; ++I) { + os << I << ". (" << Properties[I].Opcode << "," + << Properties[I].S1 << "," << Properties[I].S2 << ")\n"; + } + } + + std::vector Properties; + }; + + /// PredicateSimplifier - This class is a simplifier that replaces + /// one equivalent variable with another. It also tracks what + /// can't be equal and will solve setcc instructions when possible. + class PredicateSimplifier : public FunctionPass { + public: + bool runOnFunction(Function &F); + virtual void getAnalysisUsage(AnalysisUsage &AU) const; + + private: + // Try to replace the Use of the instruction with something simpler. + Value *resolve(SetCondInst *SCI, const PropertySet &); + Value *resolve(BinaryOperator *BO, const PropertySet &); + Value *resolve(Value *V, const PropertySet &); + + // Used by terminator instructions to proceed from the current basic + // block to the next. Verifies that "current" dominates "next", + // then calls visitBasicBlock. + void proceedToSuccessor(PropertySet &CurrentPS, PropertySet &NextPS, + DominatorTree::Node *Current, DominatorTree::Node *Next); + void proceedToSuccessor(PropertySet &CurrentPS, + DominatorTree::Node *Current, DominatorTree::Node *Next); + + // Visits each instruction in the basic block. + void visitBasicBlock(DominatorTree::Node *DTNode, + PropertySet &KnownProperties); + + // For each instruction, add the properties to KnownProperties. + void visit(Instruction *I, DominatorTree::Node *, PropertySet &); + void visit(TerminatorInst *TI, DominatorTree::Node *, PropertySet &); + void visit(BranchInst *BI, DominatorTree::Node *, PropertySet &); + void visit(SwitchInst *SI, DominatorTree::Node *, PropertySet); + void visit(LoadInst *LI, DominatorTree::Node *, PropertySet &); + void visit(StoreInst *SI, DominatorTree::Node *, PropertySet &); + void visit(BinaryOperator *BO, DominatorTree::Node *, PropertySet &); + + DominatorTree *DT; + bool modified; + }; + + RegisterPass X("predsimplify", + "Predicate Simplifier"); + } + + FunctionPass *llvm::createPredicateSimplifierPass() { + return new PredicateSimplifier(); + } + + bool PredicateSimplifier::runOnFunction(Function &F) { + DT = &getAnalysis(); + + modified = false; + PropertySet KnownProperties; + visitBasicBlock(DT->getRootNode(), KnownProperties); + return modified; + } + + void PredicateSimplifier::getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + } + + // resolve catches cases addProperty won't because it wasn't used as a + // condition in the branch, and that visit won't, because the instruction + // was defined outside of the range that the properties apply to. + Value *PredicateSimplifier::resolve(SetCondInst *SCI, + const PropertySet &KP) { + // Attempt to resolve the SetCondInst to a boolean. + + Value *SCI0 = SCI->getOperand(0), + *SCI1 = SCI->getOperand(1); + PropertySet::ConstPropertyIterator NE = + KP.findProperty(PropertySet::NE, SCI0, SCI1); + + if (NE != KP.Properties.end()) { + switch (SCI->getOpcode()) { + case Instruction::SetEQ: + return ConstantBool::False; + case Instruction::SetNE: + return ConstantBool::True; + case Instruction::SetLE: + case Instruction::SetGE: + case Instruction::SetLT: + case Instruction::SetGT: + break; + default: + assert(0 && "Unknown opcode in SetCondInst."); + break; + } + } + + SCI0 = KP.canonicalize(SCI0); + SCI1 = KP.canonicalize(SCI1); + + ConstantIntegral *CI1 = dyn_cast(SCI0), + *CI2 = dyn_cast(SCI1); + + if (!CI1 || !CI2) return SCI; + + switch(SCI->getOpcode()) { + case Instruction::SetLE: + case Instruction::SetGE: + case Instruction::SetEQ: + if (CI1->getRawValue() == CI2->getRawValue()) + return ConstantBool::True; + else + return ConstantBool::False; + case Instruction::SetLT: + case Instruction::SetGT: + case Instruction::SetNE: + if (CI1->getRawValue() == CI2->getRawValue()) + return ConstantBool::False; + else + return ConstantBool::True; + default: + assert(0 && "Unknown opcode in SetContInst."); + break; + } + } + + Value *PredicateSimplifier::resolve(BinaryOperator *BO, + const PropertySet &KP) { + if (SetCondInst *SCI = dyn_cast(BO)) + return resolve(SCI, KP); + + DEBUG(std::cerr << "BO->getOperand(1) = " << *BO->getOperand(1) << "\n"); + + Value *lhs = resolve(BO->getOperand(0), KP), + *rhs = resolve(BO->getOperand(1), KP); + ConstantIntegral *CI1 = dyn_cast(lhs); + ConstantIntegral *CI2 = dyn_cast(rhs); + + DEBUG(std::cerr << "resolveBO: lhs = " << *lhs + << ", rhs = " << *rhs << "\n"); + if (CI1) DEBUG(std::cerr << "CI1 = " << *CI1); + if (CI2) DEBUG(std::cerr << "CI2 = " << *CI2); + + if (!CI1 || !CI2) return BO; + + Value *V = ConstantExpr::get(BO->getOpcode(), CI1, CI2); + if (V) return V; + return BO; + } + + Value *PredicateSimplifier::resolve(Value *V, const PropertySet &KP) { + if (isa(V) || isa(V) || KP.empty()) return V; + + V = KP.canonicalize(V); + + if (BinaryOperator *BO = dyn_cast(V)) + return resolve(BO, KP); + + return V; + } + + void PredicateSimplifier::visitBasicBlock(DominatorTree::Node *DTNode, + PropertySet &KnownProperties) { + BasicBlock *BB = DTNode->getBlock(); + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + visit(I, DTNode, KnownProperties); + } + } + + void PredicateSimplifier::visit(Instruction *I, DominatorTree::Node *DTNode, + PropertySet &KnownProperties) { + DEBUG(std::cerr << "Considering instruction " << *I << "\n"); + DEBUG(KnownProperties.debug(std::cerr)); + + // Substitute values known to be equal. + for (unsigned i = 0, E = I->getNumOperands(); i != E; ++i) { + Value *Oper = I->getOperand(i); + Value *V = resolve(Oper, KnownProperties); + assert(V && "resolve not supposed to return NULL."); + if (V != Oper) { + modified = true; + ++NumVarsReplaced; + DEBUG(std::cerr << "resolving " << *I); + I->setOperand(i, V); + DEBUG(std::cerr << "into " << *I); + } + } + + Value *V = resolve(I, KnownProperties); + assert(V && "resolve not supposed to return NULL."); + if (V != I) { + modified = true; + ++NumResolved; + I->replaceAllUsesWith(V); + I->eraseFromParent(); + } + + if (TerminatorInst *TI = dyn_cast(I)) + visit(TI, DTNode, KnownProperties); + else if (LoadInst *LI = dyn_cast(I)) + visit(LI, DTNode, KnownProperties); + else if (StoreInst *SI = dyn_cast(I)) + visit(SI, DTNode, KnownProperties); + else if (BinaryOperator *BO = dyn_cast(I)) + visit(BO, DTNode, KnownProperties); + } + + void PredicateSimplifier::proceedToSuccessor(PropertySet &CurrentPS, + PropertySet &NextPS, DominatorTree::Node *Current, + DominatorTree::Node *Next) { + if (Next->getBlock()->getSinglePredecessor() == Current->getBlock()) + proceedToSuccessor(NextPS, Current, Next); + else + proceedToSuccessor(CurrentPS, Current, Next); + } + + void PredicateSimplifier::proceedToSuccessor(PropertySet &KP, + DominatorTree::Node *Current, DominatorTree::Node *Next) { + if (Current->properlyDominates(Next)) + visitBasicBlock(Next, KP); + } + + void PredicateSimplifier::visit(TerminatorInst *TI, + DominatorTree::Node *Node, PropertySet &KP){ + if (BranchInst *BI = dyn_cast(TI)) { + visit(BI, Node, KP); + return; + } + if (SwitchInst *SI = dyn_cast(TI)) { + visit(SI, Node, KP); + return; + } + + for (unsigned i = 0, E = TI->getNumSuccessors(); i != E; ++i) { + BasicBlock *BB = TI->getSuccessor(i); + PropertySet KPcopy(KP); + proceedToSuccessor(KPcopy, Node, DT->getNode(TI->getSuccessor(i))); + } + } + + void PredicateSimplifier::visit(BranchInst *BI, + DominatorTree::Node *Node, PropertySet &KP){ + if (BI->isUnconditional()) { + proceedToSuccessor(KP, Node, DT->getNode(BI->getSuccessor(0))); + return; + } + + Value *Condition = BI->getCondition(); + + PropertySet TrueProperties(KP), FalseProperties(KP); + DEBUG(std::cerr << "true set:\n"); + TrueProperties.addEqual(ConstantBool::True, Condition); + DEBUG(std::cerr << "false set:\n"); + FalseProperties.addEqual(ConstantBool::False, Condition); + + BasicBlock *TrueDest = BI->getSuccessor(0), + *FalseDest = BI->getSuccessor(1); + + PropertySet KPcopy(KP); + proceedToSuccessor(KP, TrueProperties, Node, DT->getNode(TrueDest)); + proceedToSuccessor(KPcopy, FalseProperties, Node, DT->getNode(FalseDest)); + } + + void PredicateSimplifier::visit(SwitchInst *SI, + DominatorTree::Node *DTNode, PropertySet KP) { + Value *Condition = SI->getCondition(); + + // If there's an NEProperty covering this SwitchInst, we may be able to + // eliminate one of the cases. + PropertySet::SynSet S; + + if (KP.findSynSet(Condition, S)) { + for (PropertySet::ConstPropertyIterator I = KP.Properties.begin(), + E = KP.Properties.end(); I != E; ++I) { + if (I->Opcode != PropertySet::NE) continue; + if (I->S1 != S && I->S2 != S) continue; + + // Is one side a number? + ConstantInt *CI = dyn_cast(KP.lookup(I->S1)); + if (!CI) CI = dyn_cast(KP.lookup(I->S2)); + + if (CI) { + unsigned i = SI->findCaseValue(CI); + if (i != 0) { + SI->getSuccessor(i)->removePredecessor(SI->getParent()); + SI->removeCase(i); + modified = true; + ++NumSwitchCases; + } + } + } + } + + // Set the EQProperty in each of the cases BBs, + // and the NEProperties in the default BB. + PropertySet DefaultProperties(KP); + + DominatorTree::Node *Node = DT->getNode(SI->getParent()), + *DefaultNode = DT->getNode(SI->getSuccessor(0)); + if (!Node->dominates(DefaultNode)) DefaultNode = NULL; + + for (unsigned I = 1, E = SI->getNumCases(); I < E; ++I) { + ConstantInt *CI = SI->getCaseValue(I); + + BasicBlock *SuccBB = SI->getSuccessor(I); + PropertySet copy(KP); + if (SuccBB->getSinglePredecessor()) { + PropertySet NewProperties(KP); + NewProperties.addEqual(Condition, CI); + proceedToSuccessor(copy, NewProperties, DTNode, DT->getNode(SuccBB)); + } else + proceedToSuccessor(copy, DTNode, DT->getNode(SuccBB)); + + if (DefaultNode) + DefaultProperties.addNotEqual(Condition, CI); + } + + if (DefaultNode) + proceedToSuccessor(DefaultProperties, DTNode, DefaultNode); + } + + void PredicateSimplifier::visit(LoadInst *LI, + DominatorTree::Node *, PropertySet &KP) { + Value *Ptr = LI->getPointerOperand(); + KP.addNotEqual(Constant::getNullValue(Ptr->getType()), Ptr); + } + + void PredicateSimplifier::visit(StoreInst *SI, + DominatorTree::Node *, PropertySet &KP) { + Value *Ptr = SI->getPointerOperand(); + KP.addNotEqual(Constant::getNullValue(Ptr->getType()), Ptr); + } + + void PredicateSimplifier::visit(BinaryOperator *BO, + DominatorTree::Node *, PropertySet &KP) { + Instruction::BinaryOps ops = BO->getOpcode(); + if (ops != Instruction::Div && ops != Instruction::Rem) return; + + Value *Divisor = BO->getOperand(1); + const Type *Ty = cast(Divisor->getType()); + KP.addNotEqual(Constant::getNullValue(Ty), Divisor); + + // Some other things we could do: + // In f=x*y, if x != 1 && y != 1 then f != x && f != y. + // In f=x+y, if x != 0 then f != y and if y != 0 then f != x. + } From nicholas at mxc.ca Mon Aug 28 17:45:11 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 28 Aug 2006 17:45:11 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkAllPasses.h Message-ID: <200608282245.k7SMjBLZ030337@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkAllPasses.h updated: 1.2 -> 1.3 --- Log message: Add PredicateSimplifier pass. Collapses equal variables into one form and simplifies expressions. This implements the optimization described in PR807: http://llvm.org/PR807 . --- Diffs of the changes: (+1 -0) LinkAllPasses.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/LinkAllPasses.h diff -u llvm/include/llvm/LinkAllPasses.h:1.2 llvm/include/llvm/LinkAllPasses.h:1.3 --- llvm/include/llvm/LinkAllPasses.h:1.2 Mon Aug 21 00:37:03 2006 +++ llvm/include/llvm/LinkAllPasses.h Mon Aug 28 17:44:55 2006 @@ -120,6 +120,7 @@ (void) llvm::createDataStructureStatsPass(); (void) llvm::createDataStructureGraphCheckerPass(); (void) llvm::createInstCountPass(); + (void) llvm::createPredicateSimplifierPass(); (void)new llvm::LocalDataStructures(); (void)new llvm::BUDataStructures(); From nicholas at mxc.ca Mon Aug 28 20:43:02 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 28 Aug 2006 20:43:02 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200608290143.k7T1h2AU001147@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.65 -> 1.66 --- Log message: The list is sorted by name. --- Diffs of the changes: (+4 -4) CREDITS.TXT | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.65 llvm/CREDITS.TXT:1.66 --- llvm/CREDITS.TXT:1.65 Mon Aug 28 17:44:55 2006 +++ llvm/CREDITS.TXT Mon Aug 28 20:42:47 2006 @@ -130,6 +130,10 @@ D: Alpha backend D: Sampling based profiling +N: Nick Lewycky +E: nicholas at mxc.ca +D: PredicateSimplifier pass + N: Duraid Madina E: duraid at octopus.com.au W: http://kinoko.c.u-tokyo.ac.jp/~duraid/ @@ -176,7 +180,3 @@ E: isanbard at gmail.com W: http://web.mac.com/bwendling/ D: The `Lower Setjmp/Longjmp' pass, improvements to the -lowerswitch pass. - -N: Nick Lewycky -E: nicholas at mxc.ca -D: PredicateSimplifier pass From natebegeman at mac.com Mon Aug 28 21:31:13 2006 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 28 Aug 2006 21:31:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCJITInfo.cpp PPCJITInfo.h PPCTargetMachine.cpp Message-ID: <200608290231.k7T2VD4c001899@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCJITInfo.cpp updated: 1.27 -> 1.28 PPCJITInfo.h updated: 1.12 -> 1.13 PPCTargetMachine.cpp updated: 1.100 -> 1.101 --- Log message: Make ppc64 jit kinda work right. About 2/3 of Olden passes with this, there are clearly some encoding bugs lurking in there somewhere. --- Diffs of the changes: (+359 -257) PPCJITInfo.cpp | 608 +++++++++++++++++++++++++++++---------------------- PPCJITInfo.h | 6 PPCTargetMachine.cpp | 2 3 files changed, 359 insertions(+), 257 deletions(-) Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.27 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.28 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.27 Thu Jul 27 13:20:32 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Mon Aug 28 21:30:59 2006 @@ -1,255 +1,353 @@ -//===-- PPCJITInfo.cpp - Implement the JIT interfaces for the PowerPC -----===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the JIT interfaces for the 32-bit PowerPC target. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "jit" -#include "PPCJITInfo.h" -#include "PPCRelocations.h" -#include "llvm/CodeGen/MachineCodeEmitter.h" -#include "llvm/Config/alloca.h" -#include "llvm/Support/Debug.h" -#include -#include -using namespace llvm; - -static TargetJITInfo::JITCompilerFn JITCompilerFunction; - -#define BUILD_ADDIS(RD,RS,IMM16) \ - ((15 << 26) | ((RD) << 21) | ((RS) << 16) | ((IMM16) & 65535)) -#define BUILD_ORI(RD,RS,UIMM16) \ - ((24 << 26) | ((RS) << 21) | ((RD) << 16) | ((UIMM16) & 65535)) -#define BUILD_MTSPR(RS,SPR) \ - ((31 << 26) | ((RS) << 21) | ((SPR) << 16) | (467 << 1)) -#define BUILD_BCCTRx(BO,BI,LINK) \ - ((19 << 26) | ((BO) << 21) | ((BI) << 16) | (528 << 1) | ((LINK) & 1)) - -// Pseudo-ops -#define BUILD_LIS(RD,IMM16) BUILD_ADDIS(RD,0,IMM16) -#define BUILD_MTCTR(RS) BUILD_MTSPR(RS,9) -#define BUILD_BCTR(LINK) BUILD_BCCTRx(20,0,LINK) - - -static void EmitBranchToAt(void *At, void *To, bool isCall) { - intptr_t Addr = (intptr_t)To; - - // FIXME: should special case the short branch case. - unsigned *AtI = (unsigned*)At; - - AtI[0] = BUILD_LIS(12, Addr >> 16); // lis r12, hi16(address) - AtI[1] = BUILD_ORI(12, 12, Addr); // ori r12, r12, low16(address) - AtI[2] = BUILD_MTCTR(12); // mtctr r12 - AtI[3] = BUILD_BCTR(isCall); // bctr/bctrl -} - -extern "C" void PPC32CompilationCallback(); - -#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) -// CompilationCallback stub - We can't use a C function with inline assembly in -// it, because we the prolog/epilog inserted by GCC won't work for us. Instead, -// write our own wrapper, which does things our way, so we have complete control -// over register saving and restoring. -asm( - ".text\n" - ".align 2\n" - ".globl _PPC32CompilationCallback\n" -"_PPC32CompilationCallback:\n" - // Make space for 8 ints r[3-10] and 13 doubles f[1-13] and the - // FIXME: need to save v[0-19] for altivec? - // Set up a proper stack frame - "stwu r1, -208(r1)\n" - "mflr r0\n" - "stw r0, 216(r1)\n" - // Save all int arg registers - "stw r10, 204(r1)\n" "stw r9, 200(r1)\n" - "stw r8, 196(r1)\n" "stw r7, 192(r1)\n" - "stw r6, 188(r1)\n" "stw r5, 184(r1)\n" - "stw r4, 180(r1)\n" "stw r3, 176(r1)\n" - // Save all call-clobbered FP regs. - "stfd f13, 168(r1)\n" "stfd f12, 160(r1)\n" - "stfd f11, 152(r1)\n" "stfd f10, 144(r1)\n" - "stfd f9, 136(r1)\n" "stfd f8, 128(r1)\n" - "stfd f7, 120(r1)\n" "stfd f6, 112(r1)\n" - "stfd f5, 104(r1)\n" "stfd f4, 96(r1)\n" - "stfd f3, 88(r1)\n" "stfd f2, 80(r1)\n" - "stfd f1, 72(r1)\n" - // Arguments to Compilation Callback: - // r3 - our lr (address of the call instruction in stub plus 4) - // r4 - stub's lr (address of instruction that called the stub plus 4) - "mr r3, r0\n" - "lwz r2, 208(r1)\n" // stub's frame - "lwz r4, 8(r2)\n" // stub's lr - "bl _PPC32CompilationCallbackC\n" - "mtctr r3\n" - // Restore all int arg registers - "lwz r10, 204(r1)\n" "lwz r9, 200(r1)\n" - "lwz r8, 196(r1)\n" "lwz r7, 192(r1)\n" - "lwz r6, 188(r1)\n" "lwz r5, 184(r1)\n" - "lwz r4, 180(r1)\n" "lwz r3, 176(r1)\n" - // Restore all FP arg registers - "lfd f13, 168(r1)\n" "lfd f12, 160(r1)\n" - "lfd f11, 152(r1)\n" "lfd f10, 144(r1)\n" - "lfd f9, 136(r1)\n" "lfd f8, 128(r1)\n" - "lfd f7, 120(r1)\n" "lfd f6, 112(r1)\n" - "lfd f5, 104(r1)\n" "lfd f4, 96(r1)\n" - "lfd f3, 88(r1)\n" "lfd f2, 80(r1)\n" - "lfd f1, 72(r1)\n" - // Pop 3 frames off the stack and branch to target - "lwz r1, 208(r1)\n" - "lwz r2, 8(r1)\n" - "mtlr r2\n" - "bctr\n" - ); -#else -void PPC32CompilationCallback() { - assert(0 && "This is not a power pc, you can't execute this!"); - abort(); -} -#endif - -extern "C" unsigned *PPC32CompilationCallbackC(unsigned *StubCallAddrPlus4, - unsigned *OrigCallAddrPlus4) { - // Adjust the pointer to the address of the call instruction in the stub - // emitted by emitFunctionStub, rather than the instruction after it. - unsigned *StubCallAddr = StubCallAddrPlus4 - 1; - unsigned *OrigCallAddr = OrigCallAddrPlus4 - 1; - - void *Target = JITCompilerFunction(StubCallAddr); - - // Check to see if *OrigCallAddr is a 'bl' instruction, and if we can rewrite - // it to branch directly to the destination. If so, rewrite it so it does not - // need to go through the stub anymore. - unsigned OrigCallInst = *OrigCallAddr; - if ((OrigCallInst >> 26) == 18) { // Direct call. - intptr_t Offset = ((intptr_t)Target - (intptr_t)OrigCallAddr) >> 2; - - if (Offset >= -(1 << 23) && Offset < (1 << 23)) { // In range? - // Clear the original target out. - OrigCallInst &= (63 << 26) | 3; - // Fill in the new target. - OrigCallInst |= (Offset & ((1 << 24)-1)) << 2; - // Replace the call. - *OrigCallAddr = OrigCallInst; - } - } - - // Assert that we are coming from a stub that was created with our - // emitFunctionStub. - assert((*StubCallAddr >> 26) == 19 && "Call in stub is not indirect!"); - StubCallAddr -= 6; - - // Rewrite the stub with an unconditional branch to the target, for any users - // who took the address of the stub. - EmitBranchToAt(StubCallAddr, Target, false); - - // Put the address of the target function to call and the address to return to - // after calling the target function in a place that is easy to get on the - // stack after we restore all regs. - return (unsigned *)Target; -} - - - -TargetJITInfo::LazyResolverFn -PPCJITInfo::getLazyResolverFunction(JITCompilerFn Fn) { - JITCompilerFunction = Fn; - return PPC32CompilationCallback; -} - -void *PPCJITInfo::emitFunctionStub(void *Fn, MachineCodeEmitter &MCE) { - // If this is just a call to an external function, emit a branch instead of a - // call. The code is the same except for one bit of the last instruction. - if (Fn != (void*)(intptr_t)PPC32CompilationCallback) { - MCE.startFunctionStub(4*4); - void *Addr = (void*)(intptr_t)MCE.getCurrentPCValue(); - MCE.emitWordBE(0); - MCE.emitWordBE(0); - MCE.emitWordBE(0); - MCE.emitWordBE(0); - EmitBranchToAt(Addr, Fn, false); - return MCE.finishFunctionStub(0); - } - - MCE.startFunctionStub(4*7); - MCE.emitWordBE(0x9421ffe0); // stwu r1,-32(r1) - MCE.emitWordBE(0x7d6802a6); // mflr r11 - MCE.emitWordBE(0x91610028); // stw r11, 40(r1) - void *Addr = (void*)(intptr_t)MCE.getCurrentPCValue(); - MCE.emitWordBE(0); - MCE.emitWordBE(0); - MCE.emitWordBE(0); - MCE.emitWordBE(0); - EmitBranchToAt(Addr, Fn, true/*is call*/); - return MCE.finishFunctionStub(0); -} - - -void PPCJITInfo::relocate(void *Function, MachineRelocation *MR, - unsigned NumRelocs, unsigned char* GOTBase) { - for (unsigned i = 0; i != NumRelocs; ++i, ++MR) { - unsigned *RelocPos = (unsigned*)Function + MR->getMachineCodeOffset()/4; - intptr_t ResultPtr = (intptr_t)MR->getResultPointer(); - switch ((PPC::RelocationType)MR->getRelocationType()) { - default: assert(0 && "Unknown relocation type!"); - case PPC::reloc_pcrel_bx: - // PC-relative relocation for b and bl instructions. - ResultPtr = (ResultPtr-(intptr_t)RelocPos) >> 2; - assert(ResultPtr >= -(1 << 23) && ResultPtr < (1 << 23) && - "Relocation out of range!"); - *RelocPos |= (ResultPtr & ((1 << 24)-1)) << 2; - break; - case PPC::reloc_pcrel_bcx: - // PC-relative relocation for BLT,BLE,BEQ,BGE,BGT,BNE, or other - // bcx instructions. - ResultPtr = (ResultPtr-(intptr_t)RelocPos) >> 2; - assert(ResultPtr >= -(1 << 13) && ResultPtr < (1 << 13) && - "Relocation out of range!"); - *RelocPos |= (ResultPtr & ((1 << 14)-1)) << 2; - break; - case PPC::reloc_absolute_ptr_high: // Pointer relocations. - case PPC::reloc_absolute_ptr_low: - case PPC::reloc_absolute_high: // high bits of ref -> low 16 of instr - case PPC::reloc_absolute_low: { // low bits of ref -> low 16 of instr - ResultPtr += MR->getConstantVal(); - - // If this is a high-part access, get the high-part. - if (MR->getRelocationType() == PPC::reloc_absolute_high || - MR->getRelocationType() == PPC::reloc_absolute_ptr_high) { - // If the low part will have a carry (really a borrow) from the low - // 16-bits into the high 16, add a bit to borrow from. - if (((int)ResultPtr << 16) < 0) - ResultPtr += 1 << 16; - ResultPtr >>= 16; - } - - // Do the addition then mask, so the addition does not overflow the 16-bit - // immediate section of the instruction. - unsigned LowBits = (*RelocPos + ResultPtr) & 65535; - unsigned HighBits = *RelocPos & ~65535; - *RelocPos = LowBits | HighBits; // Slam into low 16-bits - break; - } - case PPC::reloc_absolute_low_ix: { // low bits of ref -> low 14 of instr - ResultPtr += MR->getConstantVal(); - // Do the addition then mask, so the addition does not overflow the 16-bit - // immediate section of the instruction. - unsigned LowBits = (*RelocPos + ResultPtr) & 0xFFFC; - unsigned HighBits = *RelocPos & 0xFFFF0003; - *RelocPos = LowBits | HighBits; // Slam into low 14-bits. - break; - } - } - } -} - -void PPCJITInfo::replaceMachineCodeForFunction(void *Old, void *New) { - EmitBranchToAt(Old, New, false); -} +//===-- PPCJITInfo.cpp - Implement the JIT interfaces for the PowerPC -----===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the JIT interfaces for the 32-bit PowerPC target. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "jit" +#include "PPCJITInfo.h" +#include "PPCRelocations.h" +#include "llvm/CodeGen/MachineCodeEmitter.h" +#include "llvm/Config/alloca.h" +#include "llvm/Support/Debug.h" +#include +#include +using namespace llvm; + +static TargetJITInfo::JITCompilerFn JITCompilerFunction; + +#define BUILD_ADDIS(RD,RS,IMM16) \ + ((15 << 26) | ((RD) << 21) | ((RS) << 16) | ((IMM16) & 65535)) +#define BUILD_ORI(RD,RS,UIMM16) \ + ((24 << 26) | ((RS) << 21) | ((RD) << 16) | ((UIMM16) & 65535)) +#define BUILD_ORIS(RD,RS,UIMM16) \ + ((25 << 26) | ((RS) << 21) | ((RD) << 16) | ((UIMM16) & 65535)) +#define BUILD_RLDICR(RD,RS,SH,ME) \ + ((30 << 26) | ((RS) << 21) | ((RD) << 16) | (((SH) & 31) << 11) | \ + (((ME) & 63) << 6) | (1 << 3) | (((SH) >> 5) & 1)) +#define BUILD_MTSPR(RS,SPR) \ + ((31 << 26) | ((RS) << 21) | ((SPR) << 16) | (467 << 1)) +#define BUILD_BCCTRx(BO,BI,LINK) \ + ((19 << 26) | ((BO) << 21) | ((BI) << 16) | (528 << 1) | ((LINK) & 1)) +#define BUILD_B(TARGET, LINK) \ + ((18 << 26) | (((TARGET) & 0x00FFFFFF) << 2) | ((LINK) & 1)) + +// Pseudo-ops +#define BUILD_LIS(RD,IMM16) BUILD_ADDIS(RD,0,IMM16) +#define BUILD_SLDI(RD,RS,IMM6) BUILD_RLDICR(RD,RS,IMM6,63-IMM6) +#define BUILD_MTCTR(RS) BUILD_MTSPR(RS,9) +#define BUILD_BCTR(LINK) BUILD_BCCTRx(20,0,LINK) + +static void EmitBranchToAt(uint64_t At, uint64_t To, bool isCall, bool is64Bit){ + intptr_t Offset = ((intptr_t)To - (intptr_t)At) >> 2; + unsigned *AtI = (unsigned*)(intptr_t)At; + + if (Offset >= -(1 << 23) && Offset < (1 << 23)) { // In range? + AtI[0] = BUILD_B(Offset, isCall); // b/bl target + } else if (!is64Bit) { + AtI[0] = BUILD_LIS(12, To >> 16); // lis r12, hi16(address) + AtI[1] = BUILD_ORI(12, 12, To); // ori r12, r12, lo16(address) + AtI[2] = BUILD_MTCTR(12); // mtctr r12 + AtI[3] = BUILD_BCTR(isCall); // bctr/bctrl + } else { + AtI[0] = BUILD_LIS(12, To >> 48); // lis r12, hi16(address) + AtI[1] = BUILD_ORI(12, 12, To >> 32); // ori r12, r12, lo16(address) + AtI[2] = BUILD_SLDI(12, 12, 32); // sldi r12, r12, 32 + AtI[3] = BUILD_ORIS(12, 12, To >> 16); // oris r12, r12, hi16(address) + AtI[4] = BUILD_ORI(12, 12, To); // ori r12, r12, lo16(address) + AtI[5] = BUILD_MTCTR(12); // mtctr r12 + AtI[6] = BUILD_BCTR(isCall); // bctr/bctrl + } +} + +extern "C" void PPC32CompilationCallback(); +extern "C" void PPC64CompilationCallback(); + +#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && !defined(__ppc64__) +// CompilationCallback stub - We can't use a C function with inline assembly in +// it, because we the prolog/epilog inserted by GCC won't work for us. Instead, +// write our own wrapper, which does things our way, so we have complete control +// over register saving and restoring. +asm( + ".text\n" + ".align 2\n" + ".globl _PPC32CompilationCallback\n" +"_PPC32CompilationCallback:\n" + // Make space for 8 ints r[3-10] and 13 doubles f[1-13] and the + // FIXME: need to save v[0-19] for altivec? + // FIXME: could shrink frame + // Set up a proper stack frame + "stwu r1, -208(r1)\n" + "mflr r0\n" + "stw r0, 216(r1)\n" + // Save all int arg registers + "stw r10, 204(r1)\n" "stw r9, 200(r1)\n" + "stw r8, 196(r1)\n" "stw r7, 192(r1)\n" + "stw r6, 188(r1)\n" "stw r5, 184(r1)\n" + "stw r4, 180(r1)\n" "stw r3, 176(r1)\n" + // Save all call-clobbered FP regs. + "stfd f13, 168(r1)\n" "stfd f12, 160(r1)\n" + "stfd f11, 152(r1)\n" "stfd f10, 144(r1)\n" + "stfd f9, 136(r1)\n" "stfd f8, 128(r1)\n" + "stfd f7, 120(r1)\n" "stfd f6, 112(r1)\n" + "stfd f5, 104(r1)\n" "stfd f4, 96(r1)\n" + "stfd f3, 88(r1)\n" "stfd f2, 80(r1)\n" + "stfd f1, 72(r1)\n" + // Arguments to Compilation Callback: + // r3 - our lr (address of the call instruction in stub plus 4) + // r4 - stub's lr (address of instruction that called the stub plus 4) + "mr r3, r0\n" + "lwz r2, 208(r1)\n" // stub's frame + "lwz r4, 8(r2)\n" // stub's lr + "li r5, 0\n" // 0 == 32 bit + "bl _PPCCompilationCallbackC\n" + "mtctr r3\n" + // Restore all int arg registers + "lwz r10, 204(r1)\n" "lwz r9, 200(r1)\n" + "lwz r8, 196(r1)\n" "lwz r7, 192(r1)\n" + "lwz r6, 188(r1)\n" "lwz r5, 184(r1)\n" + "lwz r4, 180(r1)\n" "lwz r3, 176(r1)\n" + // Restore all FP arg registers + "lfd f13, 168(r1)\n" "lfd f12, 160(r1)\n" + "lfd f11, 152(r1)\n" "lfd f10, 144(r1)\n" + "lfd f9, 136(r1)\n" "lfd f8, 128(r1)\n" + "lfd f7, 120(r1)\n" "lfd f6, 112(r1)\n" + "lfd f5, 104(r1)\n" "lfd f4, 96(r1)\n" + "lfd f3, 88(r1)\n" "lfd f2, 80(r1)\n" + "lfd f1, 72(r1)\n" + // Pop 3 frames off the stack and branch to target + "lwz r1, 208(r1)\n" + "lwz r2, 8(r1)\n" + "mtlr r2\n" + "bctr\n" + ); +#else +void PPC32CompilationCallback() { + assert(0 && "This is not a power pc, you can't execute this!"); + abort(); +} +#endif + +#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && defined(__ppc64__) +asm( + ".text\n" + ".align 2\n" + ".globl _PPC64CompilationCallback\n" +"_PPC64CompilationCallback:\n" + // Make space for 8 ints r[3-10] and 13 doubles f[1-13] and the + // FIXME: need to save v[0-19] for altivec? + // Set up a proper stack frame + "stdu r1, -208(r1)\n" + "mflr r0\n" + "std r0, 224(r1)\n" + // Save all int arg registers + "std r10, 200(r1)\n" "std r9, 192(r1)\n" + "std r8, 184(r1)\n" "std r7, 176(r1)\n" + "std r6, 168(r1)\n" "std r5, 160(r1)\n" + "std r4, 152(r1)\n" "std r3, 144(r1)\n" + // Save all call-clobbered FP regs. + "stfd f13, 136(r1)\n" "stfd f12, 128(r1)\n" + "stfd f11, 120(r1)\n" "stfd f10, 112(r1)\n" + "stfd f9, 104(r1)\n" "stfd f8, 96(r1)\n" + "stfd f7, 88(r1)\n" "stfd f6, 80(r1)\n" + "stfd f5, 72(r1)\n" "stfd f4, 64(r1)\n" + "stfd f3, 56(r1)\n" "stfd f2, 48(r1)\n" + "stfd f1, 40(r1)\n" + // Arguments to Compilation Callback: + // r3 - our lr (address of the call instruction in stub plus 4) + // r4 - stub's lr (address of instruction that called the stub plus 4) + "mr r3, r0\n" + "ld r2, 208(r1)\n" // stub's frame + "ld r4, 16(r2)\n" // stub's lr + "li r5, 1\n" // 1 == 64 bit + "bl _PPCCompilationCallbackC\n" + "mtctr r3\n" + // Restore all int arg registers + "ld r10, 200(r1)\n" "ld r9, 192(r1)\n" + "ld r8, 184(r1)\n" "ld r7, 176(r1)\n" + "ld r6, 168(r1)\n" "ld r5, 160(r1)\n" + "ld r4, 152(r1)\n" "ld r3, 144(r1)\n" + // Restore all FP arg registers + "lfd f13, 136(r1)\n" "lfd f12, 128(r1)\n" + "lfd f11, 120(r1)\n" "lfd f10, 112(r1)\n" + "lfd f9, 104(r1)\n" "lfd f8, 96(r1)\n" + "lfd f7, 88(r1)\n" "lfd f6, 80(r1)\n" + "lfd f5, 72(r1)\n" "lfd f4, 64(r1)\n" + "lfd f3, 56(r1)\n" "lfd f2, 48(r1)\n" + "lfd f1, 40(r1)\n" + // Pop 3 frames off the stack and branch to target + "ld r1, 208(r1)\n" + "ld r2, 16(r1)\n" + "mtlr r2\n" + "bctr\n" + ); +#else +void PPC64CompilationCallback() { + assert(0 && "This is not a power pc, you can't execute this!"); + abort(); +} +#endif + +extern "C" void *PPCCompilationCallbackC(unsigned *StubCallAddrPlus4, + unsigned *OrigCallAddrPlus4, + bool is64Bit) { + // Adjust the pointer to the address of the call instruction in the stub + // emitted by emitFunctionStub, rather than the instruction after it. + unsigned *StubCallAddr = StubCallAddrPlus4 - 1; + unsigned *OrigCallAddr = OrigCallAddrPlus4 - 1; + + void *Target = JITCompilerFunction(StubCallAddr); + + // Check to see if *OrigCallAddr is a 'bl' instruction, and if we can rewrite + // it to branch directly to the destination. If so, rewrite it so it does not + // need to go through the stub anymore. + unsigned OrigCallInst = *OrigCallAddr; + if ((OrigCallInst >> 26) == 18) { // Direct call. + intptr_t Offset = ((intptr_t)Target - (intptr_t)OrigCallAddr) >> 2; + + if (Offset >= -(1 << 23) && Offset < (1 << 23)) { // In range? + // Clear the original target out. + OrigCallInst &= (63 << 26) | 3; + // Fill in the new target. + OrigCallInst |= (Offset & ((1 << 24)-1)) << 2; + // Replace the call. + *OrigCallAddr = OrigCallInst; + } + } + + // Assert that we are coming from a stub that was created with our + // emitFunctionStub. + if ((*StubCallAddr >> 26) == 18) + StubCallAddr -= 3; + else { + assert((*StubCallAddr >> 26) == 19 && "Call in stub is not indirect!"); + StubCallAddr -= is64Bit ? 9 : 6; + } + + // Rewrite the stub with an unconditional branch to the target, for any users + // who took the address of the stub. + EmitBranchToAt((intptr_t)StubCallAddr, (intptr_t)Target, false, is64Bit); + + // Put the address of the target function to call and the address to return to + // after calling the target function in a place that is easy to get on the + // stack after we restore all regs. + return Target; +} + + + +TargetJITInfo::LazyResolverFn +PPCJITInfo::getLazyResolverFunction(JITCompilerFn Fn) { + JITCompilerFunction = Fn; + return is64Bit ? PPC64CompilationCallback : PPC32CompilationCallback; +} + +void *PPCJITInfo::emitFunctionStub(void *Fn, MachineCodeEmitter &MCE) { + // If this is just a call to an external function, emit a branch instead of a + // call. The code is the same except for one bit of the last instruction. + if (Fn != (void*)(intptr_t)PPC32CompilationCallback && + Fn != (void*)(intptr_t)PPC64CompilationCallback) { + MCE.startFunctionStub(7*4); + intptr_t Addr = (intptr_t)MCE.getCurrentPCValue(); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + EmitBranchToAt(Addr, (intptr_t)Fn, false, is64Bit); + return MCE.finishFunctionStub(0); + } + + MCE.startFunctionStub(10*4); + if (is64Bit) { + MCE.emitWordBE(0xf821ffb1); // stdu r1,-80(r1) + MCE.emitWordBE(0x7d6802a6); // mflr r11 + MCE.emitWordBE(0xf9610060); // std r11, 96(r1) + } else { + MCE.emitWordBE(0x9421ffe0); // stwu r1,-32(r1) + MCE.emitWordBE(0x7d6802a6); // mflr r11 + MCE.emitWordBE(0x91610028); // stw r11, 40(r1) + } + intptr_t Addr = (intptr_t)MCE.getCurrentPCValue(); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + MCE.emitWordBE(0); + EmitBranchToAt(Addr, (intptr_t)Fn, true, is64Bit); + return MCE.finishFunctionStub(0); +} + + +void PPCJITInfo::relocate(void *Function, MachineRelocation *MR, + unsigned NumRelocs, unsigned char* GOTBase) { + for (unsigned i = 0; i != NumRelocs; ++i, ++MR) { + unsigned *RelocPos = (unsigned*)Function + MR->getMachineCodeOffset()/4; + intptr_t ResultPtr = (intptr_t)MR->getResultPointer(); + switch ((PPC::RelocationType)MR->getRelocationType()) { + default: assert(0 && "Unknown relocation type!"); + case PPC::reloc_pcrel_bx: + // PC-relative relocation for b and bl instructions. + ResultPtr = (ResultPtr-(intptr_t)RelocPos) >> 2; + assert(ResultPtr >= -(1 << 23) && ResultPtr < (1 << 23) && + "Relocation out of range!"); + *RelocPos |= (ResultPtr & ((1 << 24)-1)) << 2; + break; + case PPC::reloc_pcrel_bcx: + // PC-relative relocation for BLT,BLE,BEQ,BGE,BGT,BNE, or other + // bcx instructions. + ResultPtr = (ResultPtr-(intptr_t)RelocPos) >> 2; + assert(ResultPtr >= -(1 << 13) && ResultPtr < (1 << 13) && + "Relocation out of range!"); + *RelocPos |= (ResultPtr & ((1 << 14)-1)) << 2; + break; + case PPC::reloc_absolute_ptr_high: // Pointer relocations. + case PPC::reloc_absolute_ptr_low: + case PPC::reloc_absolute_high: // high bits of ref -> low 16 of instr + case PPC::reloc_absolute_low: { // low bits of ref -> low 16 of instr + ResultPtr += MR->getConstantVal(); + + // If this is a high-part access, get the high-part. + if (MR->getRelocationType() == PPC::reloc_absolute_high || + MR->getRelocationType() == PPC::reloc_absolute_ptr_high) { + // If the low part will have a carry (really a borrow) from the low + // 16-bits into the high 16, add a bit to borrow from. + if (((int)ResultPtr << 16) < 0) + ResultPtr += 1 << 16; + ResultPtr >>= 16; + } + + // Do the addition then mask, so the addition does not overflow the 16-bit + // immediate section of the instruction. + unsigned LowBits = (*RelocPos + ResultPtr) & 65535; + unsigned HighBits = *RelocPos & ~65535; + *RelocPos = LowBits | HighBits; // Slam into low 16-bits + break; + } + case PPC::reloc_absolute_low_ix: { // low bits of ref -> low 14 of instr + ResultPtr += MR->getConstantVal(); + // Do the addition then mask, so the addition does not overflow the 16-bit + // immediate section of the instruction. + unsigned LowBits = (*RelocPos + ResultPtr) & 0xFFFC; + unsigned HighBits = *RelocPos & 0xFFFF0003; + *RelocPos = LowBits | HighBits; // Slam into low 14-bits. + break; + } + } + } +} + +void PPCJITInfo::replaceMachineCodeForFunction(void *Old, void *New) { + EmitBranchToAt((intptr_t)Old, (intptr_t)New, false, is64Bit); +} Index: llvm/lib/Target/PowerPC/PPCJITInfo.h diff -u llvm/lib/Target/PowerPC/PPCJITInfo.h:1.12 llvm/lib/Target/PowerPC/PPCJITInfo.h:1.13 --- llvm/lib/Target/PowerPC/PPCJITInfo.h:1.12 Thu Jul 27 13:20:32 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.h Mon Aug 28 21:30:59 2006 @@ -22,8 +22,12 @@ class PPCJITInfo : public TargetJITInfo { protected: PPCTargetMachine &TM; + bool is64Bit; public: - PPCJITInfo(PPCTargetMachine &tm) : TM(tm) {useGOT = 0;} + PPCJITInfo(PPCTargetMachine &tm, bool tmIs64Bit) : TM(tm) { + useGOT = 0; + is64Bit = tmIs64Bit; + } /// addPassesToJITCompile - Add passes to the specified pass manager to /// implement a fast dynamic compiler for this target. Return true if this Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.100 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.101 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.100 Wed Aug 23 16:08:52 2006 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Mon Aug 28 21:30:59 2006 @@ -87,7 +87,7 @@ bool is64Bit) : TargetMachine("PowerPC"), Subtarget(M, FS, is64Bit), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), - FrameInfo(*this, false), JITInfo(*this), TLInfo(*this), + FrameInfo(*this, false), JITInfo(*this, is64Bit), TLInfo(*this), InstrItins(Subtarget.getInstrItineraryData()) { if (getRelocationModel() == Reloc::Default) From resistor at mac.com Tue Aug 29 01:11:10 2006 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 Aug 2006 01:11:10 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnroll.cpp Message-ID: <200608290611.k7T6BASA005323@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnroll.cpp updated: 1.27 -> 1.28 --- Log message: Clean up a bit. --- Diffs of the changes: (+32 -51) LoopUnroll.cpp | 83 +++++++++++++++++++++------------------------------------ 1 files changed, 32 insertions(+), 51 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.27 llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.28 --- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.27 Sun Aug 27 21:09:46 2006 +++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp Tue Aug 29 01:10:56 2006 @@ -128,66 +128,47 @@ // pred, and if there is only one distinct successor of the predecessor, and // if there are no PHI nodes. // - pred_iterator PI(pred_begin(BB)), PE(pred_end(BB)); - BasicBlock *OnlyPred = *PI++; - for (; PI != PE; ++PI) // Search all predecessors, see if they are all same - if (*PI != OnlyPred) { - OnlyPred = 0; // There are multiple different predecessors... - break; - } + BasicBlock *OnlyPred = BB->getSinglePredecessor(); + if (!OnlyPred) return 0; - BasicBlock *OnlySucc = 0; - if (OnlyPred && OnlyPred != BB && // Don't break self loops - OnlyPred->getTerminator()->getOpcode() != Instruction::Invoke) { - // Check to see if there is only one distinct successor... - succ_iterator SI(succ_begin(OnlyPred)), SE(succ_end(OnlyPred)); - OnlySucc = BB; - for (; SI != SE; ++SI) - if (*SI != OnlySucc) { - OnlySucc = 0; // There are multiple distinct successors! - break; - } - } + if (OnlyPred->getTerminator()->getNumSuccessors() != 1) + return 0; - if (OnlySucc) { - DEBUG(std::cerr << "Merging: " << *BB << "into: " << *OnlyPred); - TerminatorInst *Term = OnlyPred->getTerminator(); - - // Resolve any PHI nodes at the start of the block. They are all - // guaranteed to have exactly one entry if they exist, unless there are - // multiple duplicate (but guaranteed to be equal) entries for the - // incoming edges. This occurs when there are multiple edges from - // OnlyPred to OnlySucc. - // - while (PHINode *PN = dyn_cast(&BB->front())) { - PN->replaceAllUsesWith(PN->getIncomingValue(0)); - BB->getInstList().pop_front(); // Delete the phi node... - } + DEBUG(std::cerr << "Merging: " << *BB << "into: " << *OnlyPred); + TerminatorInst *Term = OnlyPred->getTerminator(); - // Delete the unconditional branch from the predecessor... - OnlyPred->getInstList().pop_back(); + // Resolve any PHI nodes at the start of the block. They are all + // guaranteed to have exactly one entry if they exist, unless there are + // multiple duplicate (but guaranteed to be equal) entries for the + // incoming edges. This occurs when there are multiple edges from + // OnlyPred to OnlySucc. + // + while (PHINode *PN = dyn_cast(&BB->front())) { + PN->replaceAllUsesWith(PN->getIncomingValue(0)); + BB->getInstList().pop_front(); // Delete the phi node... + } - // Move all definitions in the successor to the predecessor... - OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList()); + // Delete the unconditional branch from the predecessor... + OnlyPred->getInstList().pop_back(); - // Make all PHI nodes that referred to BB now refer to Pred as their - // source... - BB->replaceAllUsesWith(OnlyPred); + // Move all definitions in the successor to the predecessor... + OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList()); - std::string OldName = BB->getName(); + // Make all PHI nodes that referred to BB now refer to Pred as their + // source... + BB->replaceAllUsesWith(OnlyPred); - // Erase basic block from the function... - LI->removeBlock(BB); - BB->eraseFromParent(); + std::string OldName = BB->getName(); - // Inherit predecessors name if it exists... - if (!OldName.empty() && !OnlyPred->hasName()) - OnlyPred->setName(OldName); + // Erase basic block from the function... + LI->removeBlock(BB); + BB->eraseFromParent(); - return OnlyPred; - } - - return 0; + // Inherit predecessors name if it exists... + if (!OldName.empty() && !OnlyPred->hasName()) + OnlyPred->setName(OldName); + + return OnlyPred; } bool LoopUnroll::visitLoop(Loop *L) { From evan.cheng at apple.com Tue Aug 29 01:42:24 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 01:42:24 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200608290642.k7T6gOAj005837@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.127 -> 1.128 --- Log message: Move isCommutativeBinOp from SelectionDAG.cpp and DAGCombiner.cpp out. Make it a static method of SelectionDAG. --- Diffs of the changes: (+19 -0) SelectionDAG.h | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.127 llvm/include/llvm/CodeGen/SelectionDAG.h:1.128 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.127 Sun Aug 27 03:07:55 2006 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Tue Aug 29 01:42:10 2006 @@ -388,6 +388,25 @@ /// of the SDNodes* in assigned order by reference. unsigned AssignTopologicalOrder(std::vector &TopOrder); + /// isCommutativeBinOp - Returns true if the opcode is a commutative binary + /// operation. + static bool isCommutativeBinOp(unsigned Opcode) { + switch (Opcode) { + case ISD::ADD: + case ISD::MUL: + case ISD::MULHU: + case ISD::MULHS: + case ISD::FADD: + case ISD::FMUL: + case ISD::AND: + case ISD::OR: + case ISD::XOR: + case ISD::ADDC: + case ISD::ADDE: return true; + default: return false; + } + } + void dump() const; private: From evan.cheng at apple.com Tue Aug 29 01:42:49 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 01:42:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp SelectionDAG.cpp Message-ID: <200608290642.k7T6gnaB005863@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.183 -> 1.184 SelectionDAG.cpp updated: 1.335 -> 1.336 --- Log message: Move isCommutativeBinOp from SelectionDAG.cpp and DAGCombiner.cpp out. Make it a static method of SelectionDAG. --- Diffs of the changes: (+3 -31) DAGCombiner.cpp | 19 +++---------------- SelectionDAG.cpp | 15 --------------- 2 files changed, 3 insertions(+), 31 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.183 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.184 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.183 Sun Aug 27 07:54:01 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Aug 29 01:42:35 2006 @@ -306,19 +306,6 @@ return false; } -// FIXME: This should probably go in the ISD class rather than being duplicated -// in several files. -static bool isCommutativeBinOp(unsigned Opcode) { - switch (Opcode) { - case ISD::ADD: - case ISD::MUL: - case ISD::AND: - case ISD::OR: - case ISD::XOR: return true; - default: return false; // FIXME: Need commutative info for user ops! - } -} - SDOperand DAGCombiner::ReassociateOps(unsigned Opc, SDOperand N0, SDOperand N1){ MVT::ValueType VT = N0.getValueType(); // reassoc. (op (op x, c1), y) -> (op (op x, y), c1) iff x+c1 has one use @@ -3456,7 +3443,7 @@ return DAG.getSetCC(VT, N0.getOperand(1), N1.getOperand(1), Cond); if (N0.getOperand(1) == N1.getOperand(1)) return DAG.getSetCC(VT, N0.getOperand(0), N1.getOperand(0), Cond); - if (isCommutativeBinOp(N0.getOpcode())) { + if (DAG.isCommutativeBinOp(N0.getOpcode())) { // If X op Y == Y op X, try other combinations. if (N0.getOperand(0) == N1.getOperand(1)) return DAG.getSetCC(VT, N0.getOperand(1), N1.getOperand(0), Cond); @@ -3499,7 +3486,7 @@ return DAG.getSetCC(VT, N0.getOperand(1), DAG.getConstant(0, N0.getValueType()), Cond); if (N0.getOperand(1) == N1) { - if (isCommutativeBinOp(N0.getOpcode())) + if (DAG.isCommutativeBinOp(N0.getOpcode())) return DAG.getSetCC(VT, N0.getOperand(0), DAG.getConstant(0, N0.getValueType()), Cond); else { @@ -3521,7 +3508,7 @@ return DAG.getSetCC(VT, N1.getOperand(1), DAG.getConstant(0, N1.getValueType()), Cond); } else if (N1.getOperand(1) == N0) { - if (isCommutativeBinOp(N1.getOpcode())) { + if (DAG.isCommutativeBinOp(N1.getOpcode())) { return DAG.getSetCC(VT, N1.getOperand(0), DAG.getConstant(0, N1.getValueType()), Cond); } else { Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.335 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.336 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.335 Sun Aug 27 03:08:54 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Aug 29 01:42:35 2006 @@ -38,21 +38,6 @@ return Res; } -static bool isCommutativeBinOp(unsigned Opcode) { - switch (Opcode) { - case ISD::ADD: - case ISD::MUL: - case ISD::MULHU: - case ISD::MULHS: - case ISD::FADD: - case ISD::FMUL: - case ISD::AND: - case ISD::OR: - case ISD::XOR: return true; - default: return false; // FIXME: Need commutative info for user ops! - } -} - // isInvertibleForFree - Return true if there is no cost to emitting the logical // inverse of this node. static bool isInvertibleForFree(SDOperand N) { From evan.cheng at apple.com Tue Aug 29 01:44:31 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 01:44:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200608290644.k7T6iVM7005896@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.99 -> 1.100 --- Log message: Avoid making unneeded load/mod/store transformation which can hurt performance. --- Diffs of the changes: (+10 -5) X86ISelDAGToDAG.cpp | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.99 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.100 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.99 Mon Aug 28 15:10:17 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Aug 29 01:44:17 2006 @@ -80,6 +80,9 @@ Statistic<> NumFPKill("x86-codegen", "Number of FP_REG_KILL instructions added"); + Statistic<> + NumLoadMoved("x86-codegen", "Number of loads moved below TokenFactor"); + //===--------------------------------------------------------------------===// /// ISel - X86 specific code to select X86 machine instructions for /// SelectionDAG operations. @@ -313,8 +316,6 @@ switch (Opcode) { case ISD::ADD: case ISD::MUL: - case ISD::FADD: - case ISD::FMUL: case ISD::AND: case ISD::OR: case ISD::XOR: @@ -329,7 +330,8 @@ std::swap(N10, N11); } RModW = RModW && N10.Val->isOperand(Chain.Val) && N10.hasOneUse() && - N10.getOperand(1) == N2; + (N10.getOperand(1) == N2) && + (N10.Val->getValueType(0) == N1.getValueType()); if (RModW) Load = N10; break; @@ -347,15 +349,18 @@ SDOperand N10 = N1.getOperand(0); if (N10.Val->getOpcode() == ISD::LOAD) RModW = N10.Val->isOperand(Chain.Val) && N10.hasOneUse() && - N10.getOperand(1) == N2; + (N10.getOperand(1) == N2) && + (N10.Val->getValueType(0) == N1.getValueType()); if (RModW) Load = N10; break; } } - if (RModW) + if (RModW) { MoveBelowTokenFactor(DAG, Load, SDOperand(I, 0), Chain); + ++NumLoadMoved; + } } } From jlaskey at apple.com Tue Aug 29 10:13:30 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 29 Aug 2006 10:13:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp Message-ID: <200608291513.k7TFDUKH030089@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetMachine.cpp updated: 1.50 -> 1.51 --- Log message: Tidy up options. --- Diffs of the changes: (+9 -9) TargetMachine.cpp | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.50 llvm/lib/Target/TargetMachine.cpp:1.51 --- llvm/lib/Target/TargetMachine.cpp:1.50 Wed Jul 26 16:12:04 2006 +++ llvm/lib/Target/TargetMachine.cpp Tue Aug 29 10:13:10 2006 @@ -63,13 +63,13 @@ cl::init(Reloc::Default), cl::values( clEnumValN(Reloc::Default, "default", - "Target default relocation model"), + " Target default relocation model"), clEnumValN(Reloc::Static, "static", - "Non-relocatable code"), + " Non-relocatable code"), clEnumValN(Reloc::PIC_, "pic", - "Fully relocatable, position independent code"), + " Fully relocatable, position independent code"), clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic", - "Relocatable external references, non-relocatable code"), + " Relocatable external references, non-relocatable code"), clEnumValEnd)); cl::opt DefCodeModel( @@ -79,15 +79,15 @@ cl::init(CodeModel::Default), cl::values( clEnumValN(CodeModel::Default, "default", - "Target default code model"), + " Target default code model"), clEnumValN(CodeModel::Small, "small", - "Small code model"), + " Small code model"), clEnumValN(CodeModel::Kernel, "kernel", - "Kernel code model"), + " Kernel code model"), clEnumValN(CodeModel::Medium, "medium", - "Medium code model"), + " Medium code model"), clEnumValN(CodeModel::Large, "large", - "Large code model"), + " Large code model"), clEnumValEnd)); } From jlaskey at apple.com Tue Aug 29 11:24:41 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 29 Aug 2006 11:24:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200608291624.k7TGOfce031362@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.71 -> 1.72 --- Log message: Handle callee saved registers in dwarf frame info (lead up to exception handling.) --- Diffs of the changes: (+35 -9) DwarfWriter.cpp | 44 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 35 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.71 llvm/lib/CodeGen/DwarfWriter.cpp:1.72 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.71 Fri Aug 25 14:39:52 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Tue Aug 29 11:24:26 2006 @@ -35,7 +35,7 @@ static cl::opt DwarfVerbose("dwarf-verbose", cl::Hidden, - cl::desc("Add comments to Dwarf directives.")); + cl::desc("Add comments to Dwarf directives.")); namespace llvm { @@ -1946,7 +1946,7 @@ // Advance row if new location. if (BaseLabel && LabelID && BaseLabelID != LabelID) { - EmitULEB128Bytes(DW_CFA_advance_loc4); + EmitInt8(DW_CFA_advance_loc4); EOL("DW_CFA_advance_loc4"); EmitDifference("loc", LabelID, BaseLabel, BaseLabelID); EOL(""); @@ -1955,30 +1955,56 @@ BaseLabel = "loc"; } + int stackGrowth = + Asm->TM.getFrameInfo()->getStackGrowthDirection() == + TargetFrameInfo::StackGrowsUp ? + AddressSize : -AddressSize; + // If advancing cfa. if (Dst.isRegister() && Dst.getRegister() == MachineLocation::VirtualFP) { if (!Src.isRegister()) { if (Src.getRegister() == MachineLocation::VirtualFP) { - EmitULEB128Bytes(DW_CFA_def_cfa_offset); + EmitInt8(DW_CFA_def_cfa_offset); EOL("DW_CFA_def_cfa_offset"); } else { - EmitULEB128Bytes(DW_CFA_def_cfa); + EmitInt8(DW_CFA_def_cfa); EOL("DW_CFA_def_cfa"); EmitULEB128Bytes(RI->getDwarfRegNum(Src.getRegister())); EOL("Register"); } - int stackGrowth = - Asm->TM.getFrameInfo()->getStackGrowthDirection() == - TargetFrameInfo::StackGrowsUp ? - AddressSize : -AddressSize; + int Offset = Src.getOffset() / stackGrowth; - EmitULEB128Bytes(Src.getOffset() / stackGrowth); + EmitULEB128Bytes(Offset); EOL("Offset"); } else { + assert(0 && "Machine move no supported yet."); } } else { + unsigned Reg = RI->getDwarfRegNum(Src.getRegister()); + int Offset = Dst.getOffset() / stackGrowth; + + if (Offset < 0) { + EmitInt8(DW_CFA_offset_extended_sf); + EOL("DW_CFA_offset_extended_sf"); + EmitULEB128Bytes(Reg); + EOL("Reg"); + EmitSLEB128Bytes(Offset); + EOL("Offset"); + } else if (Reg < 64) { + EmitInt8(DW_CFA_offset + Reg); + EOL("DW_CFA_offset + Reg"); + EmitULEB128Bytes(Offset); + EOL("Offset"); + } else { + EmitInt8(DW_CFA_offset_extended); + EOL("DW_CFA_offset_extended"); + EmitULEB128Bytes(Reg); + EOL("Reg"); + EmitULEB128Bytes(Offset); + EOL("Offset"); + } } } } From jlaskey at apple.com Tue Aug 29 11:24:40 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 29 Aug 2006 11:24:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Message-ID: <200608291624.k7TGOe7k031357@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCRegisterInfo.cpp updated: 1.74 -> 1.75 --- Log message: Handle callee saved registers in dwarf frame info (lead up to exception handling.) --- Diffs of the changes: (+13 -6) PPCRegisterInfo.cpp | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.74 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.75 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.74 Fri Aug 25 14:40:59 2006 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Tue Aug 29 11:24:26 2006 @@ -668,15 +668,22 @@ std::vector &Moves = DebugInfo->getFrameMoves(); unsigned LabelID = DebugInfo->NextLabelID(); - // Show update of SP. - MachineLocation Dst(MachineLocation::VirtualFP); - MachineLocation Src(MachineLocation::VirtualFP, NegNumbytes); - Moves.push_back(new MachineMove(LabelID, Dst, Src)); - // Mark effective beginning of when frame pointer becomes valid. BuildMI(MBB, MBBI, PPC::DWARF_LABEL, 1).addImm(LabelID); - + // Show update of SP. + MachineLocation SPDst(MachineLocation::VirtualFP); + MachineLocation SPSrc(MachineLocation::VirtualFP, NegNumbytes); + Moves.push_back(new MachineMove(LabelID, SPDst, SPSrc)); + + // Add callee saved registers to move list. + const std::vector &CSI = MFI->getCalleeSavedInfo(); + for (unsigned I = 0, E = CSI.size(); I != E; ++I) { + MachineLocation CSDst(MachineLocation::VirtualFP, + MFI->getObjectOffset(CSI[I].getFrameIdx())); + MachineLocation CSSrc(CSI[I].getReg()); + Moves.push_back(new MachineMove(LabelID, CSDst, CSSrc)); + } } // If there is a frame pointer, copy R1 (SP) into R31 (FP) From evan.cheng at apple.com Tue Aug 29 13:01:32 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 13:01:32 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl NightlyTest.pl Message-ID: <200608291801.k7TI1Wfv000663@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.57 -> 1.58 NightlyTest.pl updated: 1.112 -> 1.113 --- Log message: Issue cvs co with -P option to prune empty directories. Remove the unnecessary update stage. --- Diffs of the changes: (+2 -11) NewNightlyTest.pl | 6 +----- NightlyTest.pl | 7 +------ 2 files changed, 2 insertions(+), 11 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.57 llvm/utils/NewNightlyTest.pl:1.58 --- llvm/utils/NewNightlyTest.pl:1.57 Tue Aug 22 13:11:19 2006 +++ llvm/utils/NewNightlyTest.pl Tue Aug 29 13:01:18 2006 @@ -488,7 +488,7 @@ # Use compression if going over ssh. $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; -my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT"; +my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT"; if (!$NOCHECKOUT) { if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; @@ -500,10 +500,6 @@ 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" ; -} ############################################################## # Index: llvm/utils/NightlyTest.pl diff -u llvm/utils/NightlyTest.pl:1.112 llvm/utils/NightlyTest.pl:1.113 --- llvm/utils/NightlyTest.pl:1.112 Wed Jun 28 19:54:37 2006 +++ llvm/utils/NightlyTest.pl Tue Aug 29 13:01:18 2006 @@ -409,7 +409,7 @@ my $CVSOPT = ""; # Use compression if going over ssh. $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; -my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT"; +my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT"; if (!$NOCHECKOUT) { if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; } system "( time -p $CVSCMD llvm; cd llvm/projects ; " . @@ -419,11 +419,6 @@ ChangeDir( "llvm" , "llvm source directory") ; -if (!$NOCHECKOUT) { - if ( $VERBOSE ) { print "UPDATE STAGE\n"; } - system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ; -} - if ( $Template eq "" ) { $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html"; } From evan.cheng at apple.com Tue Aug 29 13:28:47 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 13:28:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86.h X86ISelDAGToDAG.cpp X86TargetMachine.cpp Message-ID: <200608291828.k7TISlDj001136@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86.h updated: 1.46 -> 1.47 X86ISelDAGToDAG.cpp updated: 1.100 -> 1.101 X86TargetMachine.cpp updated: 1.121 -> 1.122 --- Log message: - Enable x86 isel preprocessing by default unless -fast is specified. - Also disable isel load folding if -fast. --- Diffs of the changes: (+13 -8) X86.h | 2 +- X86ISelDAGToDAG.cpp | 15 ++++++++++----- X86TargetMachine.cpp | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) Index: llvm/lib/Target/X86/X86.h diff -u llvm/lib/Target/X86/X86.h:1.46 llvm/lib/Target/X86/X86.h:1.47 --- llvm/lib/Target/X86/X86.h:1.46 Tue Jul 25 15:40:54 2006 +++ llvm/lib/Target/X86/X86.h Tue Aug 29 13:28:33 2006 @@ -28,7 +28,7 @@ /// createX86ISelDag - This pass converts a legalized DAG into a /// X86-specific DAG, ready for instruction scheduling. /// -FunctionPass *createX86ISelDag(X86TargetMachine &TM); +FunctionPass *createX86ISelDag(X86TargetMachine &TM, bool Fast); /// createX86FloatingPointStackifierPass - This function returns a pass which /// converts floating point register references and pseudo instructions into Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.100 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.101 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.100 Tue Aug 29 01:44:17 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Aug 29 13:28:33 2006 @@ -92,6 +92,10 @@ /// register should set this to true. bool ContainsFPCode; + /// FastISel - Enable fast(er) instruction selection. + /// + bool FastISel; + /// X86Lowering - This object fully describes how to lower LLVM code to an /// X86-specific SelectionDAG. X86TargetLowering X86Lowering; @@ -103,8 +107,9 @@ unsigned GlobalBaseReg; public: - X86DAGToDAGISel(X86TargetMachine &TM) + X86DAGToDAGISel(X86TargetMachine &TM, bool fast) : SelectionDAGISel(X86Lowering), + ContainsFPCode(false), FastISel(fast), X86Lowering(*TM.getTargetLowering()), Subtarget(&TM.getSubtarget()) {} @@ -237,7 +242,7 @@ // / [X] // | ^ // [U]--------| - return !isNonImmUse(U, N); + return !FastISel && !isNonImmUse(U, N); } /// MoveBelowTokenFactor - Replace TokenFactor operand with load's chain operand @@ -370,7 +375,7 @@ DEBUG(BB->dump()); MachineFunction::iterator FirstMBB = BB; - if (X86ISelPreproc) + if (!FastISel) InstructionSelectPreprocess(DAG); // Codegen the basic block. @@ -1071,6 +1076,6 @@ /// createX86ISelDag - This pass converts a legalized DAG into a /// X86-specific DAG, ready for instruction scheduling. /// -FunctionPass *llvm::createX86ISelDag(X86TargetMachine &TM) { - return new X86DAGToDAGISel(TM); +FunctionPass *llvm::createX86ISelDag(X86TargetMachine &TM, bool Fast) { + return new X86DAGToDAGISel(TM, Fast); } Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.121 llvm/lib/Target/X86/X86TargetMachine.cpp:1.122 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.121 Wed Aug 23 16:08:52 2006 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Tue Aug 29 13:28:33 2006 @@ -103,7 +103,7 @@ PM.add(createUnreachableBlockEliminationPass()); // Install an instruction selector. - PM.add(createX86ISelDag(*this)); + PM.add(createX86ISelDag(*this, Fast)); // Print the instruction selected machine code... if (PrintMachineCode) @@ -168,7 +168,7 @@ PM.add(createUnreachableBlockEliminationPass()); // Install an instruction selector. - PM.add(createX86ISelDag(TM)); + PM.add(createX86ISelDag(TM, false)); // Print the instruction selected machine code... if (PrintMachineCode) From evan.cheng at apple.com Tue Aug 29 13:37:51 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 13:37:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200608291837.k7TIbpSg001265@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.101 -> 1.102 --- Log message: Don't performance load/op/store transformation if op produces a floating point or vector result. X86 does not have load/mod/store variants of those instructions. --- Diffs of the changes: (+3 -1) X86ISelDAGToDAG.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.101 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.102 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.101 Tue Aug 29 13:28:33 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Aug 29 13:37:37 2006 @@ -312,7 +312,9 @@ SDOperand N1 = I->getOperand(1); SDOperand N2 = I->getOperand(2); - if (!N1.hasOneUse()) + if (MVT::isFloatingPoint(N1.getValueType()) && + MVT::isVector(N1.getValueType()) && + !N1.hasOneUse()) continue; bool RModW = false; From evan.cheng at apple.com Tue Aug 29 13:49:55 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 13:49:55 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll Message-ID: <200608291849.k7TIntLu001467@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: store_op_load_fold2.ll updated: 1.2 -> 1.3 --- Log message: Undo xfail. --- Diffs of the changes: (+1 -5) store_op_load_fold2.ll | 6 +----- 1 files changed, 1 insertion(+), 5 deletions(-) Index: llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll diff -u llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.2 llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.3 --- llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.2 Mon Jul 24 02:37:33 2006 +++ llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll Tue Aug 29 13:49:41 2006 @@ -1,8 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | grep 'and DWORD PTR' | wc -l | grep 1 -; -; FIXME: The number of (store (and (load ..) ..) ..) really should be 2. But the current hack -; only allow one of the folding to happen. -; XFAIL: * +; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | grep 'and DWORD PTR' | wc -l | grep 2 %struct.Macroblock = type { int, int, int, int, int, [8 x int], %struct.Macroblock*, %struct.Macroblock*, int, [2 x [4 x [4 x [2 x int]]]], [16 x sbyte], [16 x sbyte], int, long, [4 x int], [4 x int], long, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, short, double, int, int, int, int, int, int, int, int, int } From lattner at cs.uiuc.edu Tue Aug 29 15:48:21 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 Aug 2006 15:48:21 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTester.php Message-ID: <200608292048.k7TKmL8a003460@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTester.php updated: 1.18 -> 1.19 --- Log message: Fix typo --- Diffs of the changes: (+1 -1) NightlyTester.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/NightlyTester.php diff -u nightlytest-serverside/NightlyTester.php:1.18 nightlytest-serverside/NightlyTester.php:1.19 --- nightlytest-serverside/NightlyTester.php:1.18 Mon Aug 21 15:21:55 2006 +++ nightlytest-serverside/NightlyTester.php Tue Aug 29 15:48:07 2006 @@ -10,7 +10,7 @@ 'dejagnutime_cpu' => 'Dejagnu CPU Time', 'teststats_exppass' => 'Expected Test Passes', 'teststats_unexpfail' => 'Unexpected Test Failures', - 'teststats_expfail' => 'Expected Test Failurs'); + 'teststats_expfail' => 'Expected Test Failures'); /***************************************************** * From reid at x10sys.com Tue Aug 29 15:52:58 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 29 Aug 2006 15:52:58 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/ll Message-ID: <200608292052.k7TKqwoB003572@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: ll updated: 1.7 -> 1.8 --- Log message: Delete a no-longer-supported configuration item. --- Diffs of the changes: (+0 -1) ll | 1 - 1 files changed, 1 deletion(-) Index: llvm/tools/llvmc/ll diff -u llvm/tools/llvmc/ll:1.7 llvm/tools/llvmc/ll:1.8 --- llvm/tools/llvmc/ll:1.7 Wed May 18 19:52:29 2005 +++ llvm/tools/llvmc/ll Tue Aug 29 15:52:44 2006 @@ -4,7 +4,6 @@ preprocessor.command= preprocessor.required=false translator.command=%bindir%/llvm-as %in% -o %out% - translator.optimizes=no translator.preprocesses=true translator.required=TRUE optimizer.command=%bindir%/opt %in% -o %out% %opt% %args% From evan.cheng at apple.com Tue Aug 29 15:55:23 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 15:55:23 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200608292055.k7TKtNFv003630@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.222 -> 1.223 --- Log message: Check x86 llcbeta back to -enable-x86-fastcc --- Diffs of the changes: (+1 -1) Makefile.programs | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.222 llvm-test/Makefile.programs:1.223 --- llvm-test/Makefile.programs:1.222 Mon Aug 28 15:12:39 2006 +++ llvm-test/Makefile.programs Tue Aug 29 15:55:09 2006 @@ -203,7 +203,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -enable-x86-isel-preprocessing +LLCBETAOPTION := -enable-x86-fastcc endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts From evan.cheng at apple.com Tue Aug 29 16:43:12 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 16:43:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200608292143.k7TLhCqB004418@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.102 -> 1.103 --- Log message: Remove dead code. --- Diffs of the changes: (+0 -4) X86ISelDAGToDAG.cpp | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.102 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.103 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.102 Tue Aug 29 13:37:37 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Aug 29 16:42:58 2006 @@ -39,10 +39,6 @@ #include using namespace llvm; -#include "llvm/Support/CommandLine.h" -static cl::opt X86ISelPreproc("enable-x86-isel-preprocessing", cl::Hidden, - cl::desc("Enable isel preprocessing on X86")); - //===----------------------------------------------------------------------===// // Pattern Matcher Implementation //===----------------------------------------------------------------------===// From evan.cheng at apple.com Tue Aug 29 16:50:12 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 16:50:12 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll Message-ID: <200608292150.k7TLoCjv004539@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: store_op_load_fold2.ll updated: 1.3 -> 1.4 --- Log message: Fix test case so it passes on x86-64. --- Diffs of the changes: (+3 -0) store_op_load_fold2.ll | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll diff -u llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.3 llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.4 --- llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.3 Tue Aug 29 13:49:41 2006 +++ llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll Tue Aug 29 16:49:58 2006 @@ -1,5 +1,8 @@ ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | grep 'and DWORD PTR' | wc -l | grep 2 +target endian = little +target pointersize = 32 + %struct.Macroblock = type { int, int, int, int, int, [8 x int], %struct.Macroblock*, %struct.Macroblock*, int, [2 x [4 x [4 x [2 x int]]]], [16 x sbyte], [16 x sbyte], int, long, [4 x int], [4 x int], long, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, short, double, int, int, int, int, int, int, int, int, int } implementation ; Functions: From evan.cheng at apple.com Tue Aug 29 17:01:53 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 17:01:53 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/fabs.ll Message-ID: <200608292201.k7TM1rQG004747@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: fabs.ll updated: 1.8 -> 1.9 --- Log message: This is also a 32-bit only test. x86-64 would pass fp parameters through XMM registers. --- Diffs of the changes: (+3 -0) fabs.ll | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/test/Regression/CodeGen/X86/fabs.ll diff -u llvm/test/Regression/CodeGen/X86/fabs.ll:1.8 llvm/test/Regression/CodeGen/X86/fabs.ll:1.9 --- llvm/test/Regression/CodeGen/X86/fabs.ll:1.8 Tue May 23 19:49:32 2006 +++ llvm/test/Regression/CodeGen/X86/fabs.ll Tue Aug 29 17:01:39 2006 @@ -2,6 +2,9 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse2,-sse3 | grep 'fabs$' | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse2,-sse3 -enable-unsafe-fp-math | grep 'fabs$' | wc -l | grep 2 +target endian = little +target pointersize = 32 + declare float %fabsf(float) float %fabsftest(float %X) { From evan.cheng at apple.com Tue Aug 29 17:13:24 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 17:13:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Message-ID: <200608292213.k7TMDOb4004925@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.57 -> 1.58 --- Log message: Minor asm fix. --- Diffs of the changes: (+3 -1) X86ATTAsmPrinter.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.57 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.58 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.57 Mon Aug 28 17:14:16 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Tue Aug 29 17:13:10 2006 @@ -252,7 +252,9 @@ return; } - if (DispSpec.isGlobalAddress() || DispSpec.isConstantPoolIndex()) { + if (DispSpec.isGlobalAddress() || + DispSpec.isConstantPoolIndex() || + DispSpec.isJumpTableIndex()) { printOperand(MI, Op+3, "mem"); } else { int DispVal = DispSpec.getImmedValue(); From evan.cheng at apple.com Tue Aug 29 17:15:02 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 Aug 2006 17:15:02 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.h Message-ID: <200608292215.k7TMF2wP004960@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.h updated: 1.26 -> 1.27 --- Log message: Minor asm fix. --- Diffs of the changes: (+2 -1) X86AsmPrinter.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86AsmPrinter.h diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.26 llvm/lib/Target/X86/X86AsmPrinter.h:1.27 --- llvm/lib/Target/X86/X86AsmPrinter.h:1.26 Thu Aug 3 12:27:09 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.h Tue Aug 29 17:14:48 2006 @@ -90,7 +90,8 @@ MI->getOperand(Op+2).isRegister() && (MI->getOperand(Op+3).isImmediate() || MI->getOperand(Op+3).isGlobalAddress() || - MI->getOperand(Op+3).isConstantPoolIndex()); + MI->getOperand(Op+3).isConstantPoolIndex() || + MI->getOperand(Op+3).isJumpTableIndex()); } }; From dpatel at apple.com Tue Aug 29 17:29:32 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 29 Aug 2006 17:29:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200608292229.k7TMTWUl005197@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.46 -> 1.47 --- Log message: Do not rely on std::sort and std::erase to get list of unique exit blocks. The output is dependent on addresses of basic block. Add and use Loop::getUniqueExitBlocks. --- Diffs of the changes: (+4 -10) LoopUnswitch.cpp | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.46 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.47 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.46 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Aug 29 17:29:16 2006 @@ -570,11 +570,8 @@ LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end()); std::vector ExitBlocks; - L->getExitBlocks(ExitBlocks); - std::sort(ExitBlocks.begin(), ExitBlocks.end()); - ExitBlocks.erase(std::unique(ExitBlocks.begin(), ExitBlocks.end()), - ExitBlocks.end()); - + L->getUniqueExitBlocks(ExitBlocks); + // Split all of the edges from inside the loop to their exit blocks. Update // the appropriate Phi nodes as we do so. unsigned NumBlocks = L->getBlocks().size(); @@ -626,11 +623,8 @@ // The exit blocks may have been changed due to edge splitting, recompute. ExitBlocks.clear(); - L->getExitBlocks(ExitBlocks); - std::sort(ExitBlocks.begin(), ExitBlocks.end()); - ExitBlocks.erase(std::unique(ExitBlocks.begin(), ExitBlocks.end()), - ExitBlocks.end()); - + L->getUniqueExitBlocks(ExitBlocks); + // Add exit blocks to the loop blocks. LoopBlocks.insert(LoopBlocks.end(), ExitBlocks.begin(), ExitBlocks.end()); From dpatel at apple.com Tue Aug 29 17:29:33 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 29 Aug 2006 17:29:33 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/LoopInfo.h Message-ID: <200608292229.k7TMTXZG005202@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: LoopInfo.h updated: 1.57 -> 1.58 --- Log message: Do not rely on std::sort and std::erase to get list of unique exit blocks. The output is dependent on addresses of basic block. Add and use Loop::getUniqueExitBlocks. --- Diffs of the changes: (+6 -0) LoopInfo.h | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/Analysis/LoopInfo.h diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.57 llvm/include/llvm/Analysis/LoopInfo.h:1.58 --- llvm/include/llvm/Analysis/LoopInfo.h:1.57 Sun Jun 11 14:22:28 2006 +++ llvm/include/llvm/Analysis/LoopInfo.h Tue Aug 29 17:29:16 2006 @@ -112,6 +112,12 @@ /// void getExitBlocks(std::vector &Blocks) const; + /// getUniqueExitBlocks - Return all unique successor blocks of this loop. + /// These are the blocks _outside of the current loop_ which are branched to. + /// This assumes that loop is in canonical form. + /// + void getUniqueExitBlocks(std::vector &ExitBlocks) const; + /// getLoopPreheader - If there is a preheader for this loop, return it. A /// loop has a preheader if there is only one edge to the header of the loop /// from outside of the loop. If this is the case, the block branching to the From dpatel at apple.com Tue Aug 29 17:29:33 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 29 Aug 2006 17:29:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp Message-ID: <200608292229.k7TMTXwr005207@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: LoopInfo.cpp updated: 1.77 -> 1.78 --- Log message: Do not rely on std::sort and std::erase to get list of unique exit blocks. The output is dependent on addresses of basic block. Add and use Loop::getUniqueExitBlocks. --- Diffs of the changes: (+53 -0) LoopInfo.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+) Index: llvm/lib/Analysis/LoopInfo.cpp diff -u llvm/lib/Analysis/LoopInfo.cpp:1.77 llvm/lib/Analysis/LoopInfo.cpp:1.78 --- llvm/lib/Analysis/LoopInfo.cpp:1.77 Sun Aug 27 17:30:17 2006 +++ llvm/lib/Analysis/LoopInfo.cpp Tue Aug 29 17:29:16 2006 @@ -349,6 +349,59 @@ ExitBlocks.push_back(*I); } +/// getUniqueExitBlocks - Return all unique successor blocks of this loop. These +/// are the blocks _outside of the current loop_ which are branched to. This +/// assumes that loop is in canonical form. +// +void Loop::getUniqueExitBlocks(std::vector &ExitBlocks) const { + // Sort the blocks vector so that we can use binary search to do quick + // lookups. + std::vector LoopBBs(block_begin(), block_end()); + std::sort(LoopBBs.begin(), LoopBBs.end()); + + std::vector switchExitBlocks; + + for (std::vector::const_iterator BI = Blocks.begin(), + BE = Blocks.end(); BI != BE; ++BI) { + + BasicBlock *current = *BI; + switchExitBlocks.clear(); + + for (succ_iterator I = succ_begin(*BI), E = succ_end(*BI); I != E; ++I) { + if (std::binary_search(LoopBBs.begin(), LoopBBs.end(), *I)) + // If block is inside the loop then it is not a exit block. + continue; + + pred_iterator PI = pred_begin(*I); + BasicBlock *firstPred = *PI; + + // If current basic block is this exit block's first predecessor + // then only insert exit block in to the output ExitBlocks vector. + // This ensures that same exit block is not inserted twice into + // ExitBlocks vector. + if (current != firstPred) + continue; + + // If a terminator has more then two successors, for example SwitchInst, + // then it is possible that there are multiple edges from current block + // to one exit block. + if (current->getTerminator()->getNumSuccessors() <= 2) { + ExitBlocks.push_back(*I); + continue; + } + + // In case of multiple edges from current block to exit block, collect + // only one edge in ExitBlocks. Use switchExitBlocks to keep track of + // duplicate edges. + if (std::find(switchExitBlocks.begin(), switchExitBlocks.end(), *I) + == switchExitBlocks.end()) { + switchExitBlocks.push_back(*I); + ExitBlocks.push_back(*I); + } + } + } +} + /// getLoopPreheader - If there is a preheader for this loop, return it. A /// loop has a preheader if there is only one edge to the header of the loop From lattner at cs.uiuc.edu Tue Aug 29 18:10:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 Aug 2006 18:10:13 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/shift-coalesce.ll Message-ID: <200608292310.k7TNADgK005984@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: shift-coalesce.ll added (r1.1) --- Log message: new testcase for pr687: http://llvm.org/PR687 --- Diffs of the changes: (+11 -0) shift-coalesce.ll | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm/test/Regression/CodeGen/X86/shift-coalesce.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/shift-coalesce.ll:1.1 *** /dev/null Tue Aug 29 18:10:09 2006 --- llvm/test/Regression/CodeGen/X86/shift-coalesce.ll Tue Aug 29 18:09:59 2006 *************** *** 0 **** --- 1,11 ---- + ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | grep 'shld.*CL' && + ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | not grep 'mov CL, BL' + + ; PR687 + + ulong %foo(ulong %x, long* %X) { + %tmp.1 = load long* %X ; [#uses=1] + %tmp.3 = cast long %tmp.1 to ubyte ; [#uses=1] + %tmp.4 = shl ulong %x, ubyte %tmp.3 ; [#uses=1] + ret ulong %tmp.4 + } From lattner at cs.uiuc.edu Tue Aug 29 18:18:30 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 Aug 2006 18:18:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp LiveIntervalAnalysis.cpp Message-ID: <200608292318.k7TNIUaK006213@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.32 -> 1.33 LiveIntervalAnalysis.cpp updated: 1.171 -> 1.172 --- Log message: Teach the coallescer to coallesce live intervals joined by an arbitrary number of copies, potentially defining live ranges that appear to have differing value numbers that become identical when coallsced. Among other things, this fixes CodeGen/X86/shift-coalesce.ll and PR687: http://llvm.org/PR687 . --- Diffs of the changes: (+249 -155) LiveInterval.cpp | 189 ++++++++++++----------------------------- LiveIntervalAnalysis.cpp | 215 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 249 insertions(+), 155 deletions(-) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.32 llvm/lib/CodeGen/LiveInterval.cpp:1.33 --- llvm/lib/CodeGen/LiveInterval.cpp:1.32 Fri Aug 25 20:28:16 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Tue Aug 29 18:18:15 2006 @@ -101,101 +101,6 @@ return false; } -/// NontrivialOverlap - Check to see if the two live ranges specified by i and j -/// overlap. If so, check to see if they have value numbers that are not -/// iIdx/jIdx respectively. If both conditions are true, return true. -static inline bool NontrivialOverlap(const LiveRange &I, const LiveRange &J, - unsigned iIdx, unsigned jIdx) { - if (I.start == J.start) { - // If this is not the allowed value merge, we cannot join. - if (I.ValId != iIdx || J.ValId != jIdx) - return true; - } else if (I.start < J.start) { - if (I.end > J.start && (I.ValId != iIdx || J.ValId != jIdx)) { - return true; - } - } else { - if (J.end > I.start && (I.ValId != iIdx || J.ValId != jIdx)) - return true; - } - - return false; -} - -/// joinable - Two intervals are joinable if the either don't overlap at all -/// or if the destination of the copy is a single assignment value, and it -/// only overlaps with one value in the source interval. -bool LiveInterval::joinable(const LiveInterval &other, unsigned CopyIdx) const { - const LiveRange *SourceLR = other.getLiveRangeContaining(CopyIdx-1); - const LiveRange *DestLR = getLiveRangeContaining(CopyIdx); - assert(SourceLR && DestLR && "Not joining due to a copy?"); - unsigned OtherValIdx = SourceLR->ValId; - unsigned ThisValIdx = DestLR->ValId; - - Ranges::const_iterator i = ranges.begin(); - Ranges::const_iterator ie = ranges.end(); - Ranges::const_iterator j = other.ranges.begin(); - Ranges::const_iterator je = other.ranges.end(); - - if (i->start < j->start) { - i = std::upper_bound(i, ie, j->start); - if (i != ranges.begin()) --i; - } else if (j->start < i->start) { - j = std::upper_bound(j, je, i->start); - if (j != other.ranges.begin()) --j; - } - - while (i != ie && j != je) { - if (NontrivialOverlap(*i, *j, ThisValIdx, OtherValIdx)) - return false; - - if (i->end < j->end) - ++i; - else - ++j; - } - - return true; -} - -/// getOverlapingRanges - Given another live interval which is defined as a -/// copy from this one, return a list of all of the live ranges where the -/// two overlap and have different value numbers. -void LiveInterval::getOverlapingRanges(const LiveInterval &other, - unsigned CopyIdx, - std::vector &Ranges) { - const LiveRange *SourceLR = getLiveRangeContaining(CopyIdx-1); - const LiveRange *DestLR = other.getLiveRangeContaining(CopyIdx); - assert(SourceLR && DestLR && "Not joining due to a copy?"); - unsigned OtherValIdx = SourceLR->ValId; - unsigned ThisValIdx = DestLR->ValId; - - Ranges::iterator i = ranges.begin(); - Ranges::iterator ie = ranges.end(); - Ranges::const_iterator j = other.ranges.begin(); - Ranges::const_iterator je = other.ranges.end(); - - if (i->start < j->start) { - i = std::upper_bound(i, ie, j->start); - if (i != ranges.begin()) --i; - } else if (j->start < i->start) { - j = std::upper_bound(j, je, i->start); - if (j != other.ranges.begin()) --j; - } - - while (i != ie && j != je) { - if (NontrivialOverlap(*i, *j, ThisValIdx, OtherValIdx)) - Ranges.push_back(&*i); - - if (i->end < j->end) - ++i; - else - ++j; - } -} - - - /// extendIntervalEndTo - This method is used when we want to extend the range /// specified by I to end at the specified endpoint. To do this, we should /// merge and eliminate all ranges that this will overlap with. The iterator is @@ -361,7 +266,7 @@ LiveInterval::iterator LiveInterval::FindLiveRangeContaining(unsigned Idx) { iterator It = std::upper_bound(begin(), end(), Idx); - if (It != ranges.begin()) { + if (It != begin()) { --It; if (It->contains(Idx)) return It; @@ -370,10 +275,13 @@ return end(); } -/// join - Join two live intervals (this, and other) together. This operation -/// is the result of a copy instruction in the source program, that occurs at -/// index 'CopyIdx' that copies from 'Other' to 'this'. -void LiveInterval::join(LiveInterval &Other, unsigned CopyIdx) { +/// join - Join two live intervals (this, and other) together. This applies +/// mappings to the value numbers in the LHS/RHS intervals as specified. If +/// the intervals are not joinable, this aborts. +void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments, + int *RHSValNoAssignments, + SmallVector &NewInstDefiningValue) { + // Try to do the least amount of work possible. In particular, if there are // more liverange chunks in the other set than there are in the 'this' set, // swap sets to merge the fewest chunks in possible. @@ -385,39 +293,61 @@ MRegisterInfo::isVirtualRegister(reg)) || MRegisterInfo::isPhysicalRegister(Other.reg)) { swap(Other); - std::swap(ThisOffs, OtherOffs); + std::swap(LHSValNoAssignments, RHSValNoAssignments); } - - const LiveRange *SourceLR = Other.getLiveRangeContaining(CopyIdx-OtherOffs); - const LiveRange *DestLR = getLiveRangeContaining(CopyIdx-ThisOffs); - assert(SourceLR && DestLR && "Not joining due to a copy?"); - unsigned MergedSrcValIdx = SourceLR->ValId; - unsigned MergedDstValIdx = DestLR->ValId; - // Join the ranges of other into the ranges of this interval. - std::map Dst2SrcIdxMap; - iterator InsertPos = begin(); - for (iterator I = Other.begin(), E = Other.end(); I != E; ++I) { - // Map the ValId in the other live range to the current live range. - if (I->ValId == MergedSrcValIdx) - I->ValId = MergedDstValIdx; - else { - unsigned &NV = Dst2SrcIdxMap[I->ValId]; - if (NV == 0) NV = getNextValue(Other.getInstForValNum(I->ValId)); - I->ValId = NV; + // Determine if any of our live range values are mapped. This is uncommon, so + // we want to avoid the interval scan if not. + bool MustMapCurValNos = false; + for (unsigned i = 0, e = getNumValNums(); i != e; ++i) { + if (InstDefiningValue[i] == ~2U) continue; // tombstone value # + if (i != (unsigned)LHSValNoAssignments[i]) { + MustMapCurValNos = true; + break; } - - InsertPos = addRangeFrom(*I, InsertPos); } - // Update the value number information for the value number defined by the - // copy. The copy is about to be removed, so ensure that the value is defined - // by whatever the other value is defined by. - if (InstDefiningValue[MergedDstValIdx] == CopyIdx) { - InstDefiningValue[MergedDstValIdx] = - Other.InstDefiningValue[MergedSrcValIdx]; + // If we have to apply a mapping to our base interval assignment, rewrite it + // now. + if (MustMapCurValNos) { + // Map the first live range. + iterator OutIt = begin(); + OutIt->ValId = LHSValNoAssignments[OutIt->ValId]; + ++OutIt; + for (iterator I = OutIt, E = end(); I != E; ++I) { + OutIt->ValId = LHSValNoAssignments[I->ValId]; + + // If this live range has the same value # as its immediate predecessor, + // and if they are neighbors, remove one LiveRange. This happens when we + // have [0,3:0)[4,7:1) and map 0/1 onto the same value #. + if (OutIt->ValId == (OutIt-1)->ValId && (OutIt-1)->end == OutIt->start) { + (OutIt-1)->end = OutIt->end; + } else { + if (I != OutIt) { + OutIt->start = I->start; + OutIt->end = I->end; + } + + // Didn't merge, on to the next one. + ++OutIt; + } + } + + // If we merge some live ranges, chop off the end. + ranges.erase(OutIt, end()); } + // Okay, now insert the RHS live ranges into the LHS. + iterator InsertPos = begin(); + for (iterator I = Other.begin(), E = Other.end(); I != E; ++I) { + // Map the ValId in the other live range to the current live range. + I->ValId = RHSValNoAssignments[I->ValId]; + InsertPos = addRangeFrom(*I, InsertPos); + } + + InstDefiningValue.clear(); + InstDefiningValue.append(NewInstDefiningValue.begin(), + NewInstDefiningValue.end()); weight += Other.weight; } @@ -511,10 +441,9 @@ // Now that V1 is dead, remove it. If it is the largest value number, just // nuke it (and any other deleted values neighboring it), otherwise mark it as // ~1U so it can be nuked later. - if (V1 == NumValues-1) { + if (V1 == getNumValNums()-1) { do { InstDefiningValue.pop_back(); - --NumValues; } while (InstDefiningValue.back() == ~1U); } else { InstDefiningValue[V1] = ~1U; @@ -548,9 +477,9 @@ } // Print value number info. - if (NumValues) { + if (getNumValNums()) { OS << " "; - for (unsigned i = 0; i != NumValues; ++i) { + for (unsigned i = 0; i != getNumValNums(); ++i) { if (i) OS << " "; OS << i << "@"; if (InstDefiningValue[i] == ~0U) { Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.171 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.172 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.171 Sun Aug 27 17:30:17 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Aug 29 18:18:15 2006 @@ -629,8 +629,9 @@ /// This returns true if an interval was modified. /// bool LiveIntervals::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB, - MachineInstr *CopyMI, - unsigned CopyIdx) { + MachineInstr *CopyMI) { + unsigned CopyIdx = getDefIndex(getInstructionIndex(CopyMI)); + // BValNo is a value number in B that is defined by a copy from A. 'B3' in // the example above. LiveInterval::iterator BLR = IntB.FindLiveRangeContaining(CopyIdx); @@ -768,34 +769,22 @@ std::cerr << " and "; DestInt.print(std::cerr, mri_); std::cerr << ": "); - // If two intervals contain a single value and are joined by a copy, it - // does not matter if the intervals overlap, they can always be joined. + // Okay, attempt to join these two intervals. On failure, this returns false. + // Otherwise, if one of the intervals being joined is a physreg, this method + // always canonicalizes DestInt to be it. The output "SrcInt" will not have + // been modified, so we can use this information below to update aliases. + if (!JoinIntervals(DestInt, SrcInt)) { + // Coallescing failed. + + // If we can eliminate the copy without merging the live ranges, do so now. + if (AdjustCopiesBackFrom(SrcInt, DestInt, CopyMI)) + return true; - bool Joinable = SrcInt.containsOneValue() && DestInt.containsOneValue(); - - unsigned MIDefIdx = getDefIndex(getInstructionIndex(CopyMI)); - - // If the intervals think that this is joinable, do so now. - if (!Joinable && DestInt.joinable(SrcInt, MIDefIdx)) - Joinable = true; - - // If DestInt is actually a copy from SrcInt (which we know) that is used - // to define another value of SrcInt, we can change the other range of - // SrcInt to be the value of the range that defines DestInt, simplying the - // interval an promoting coallescing. - if (!Joinable && AdjustCopiesBackFrom(SrcInt, DestInt, CopyMI, MIDefIdx)) - return true; - - if (!Joinable) { + // Otherwise, we are unable to join the intervals. DEBUG(std::cerr << "Interference!\n"); return false; } - // Okay, we can join these two intervals. If one of the intervals being - // joined is a physreg, this method always canonicalizes DestInt to be it. - // The output "SrcInt" will not have been modified. - DestInt.join(SrcInt, MIDefIdx); - bool Swapped = SrcReg == DestInt.reg; if (Swapped) std::swap(SrcReg, DstReg); @@ -823,6 +812,182 @@ return true; } +/// ComputeUltimateVN - Assuming we are going to join two live intervals, +/// compute what the resultant value numbers for each value in the input two +/// ranges will be. This is complicated by copies between the two which can +/// and will commonly cause multiple value numbers to be merged into one. +/// +/// VN is the value number that we're trying to resolve. InstDefiningValue +/// keeps track of the new InstDefiningValue assignment for the result +/// LiveInterval. ThisFromOther/OtherFromThis are sets that keep track of +/// whether a value in this or other is a copy from the opposite set. +/// ThisValNoAssignments/OtherValNoAssignments keep track of value #'s that have +/// already been assigned. +/// +/// ThisFromOther[x] - If x is defined as a copy from the other interval, this +/// contains the value number the copy is from. +/// +static unsigned ComputeUltimateVN(unsigned VN, + SmallVector &InstDefiningValue, + SmallVector &ThisFromOther, + SmallVector &OtherFromThis, + SmallVector &ThisValNoAssignments, + SmallVector &OtherValNoAssignments, + LiveInterval &ThisLI, LiveInterval &OtherLI) { + // If the VN has already been computed, just return it. + if (ThisValNoAssignments[VN] >= 0) + return ThisValNoAssignments[VN]; + assert(ThisValNoAssignments[VN] != -2 && "FIXME: Cyclic case, handle it!"); + + // If this val is not a copy from the other val, then it must be a new value + // number in the destination. + int OtherValNo = ThisFromOther[VN]; + if (OtherValNo == -1) { + InstDefiningValue.push_back(ThisLI.getInstForValNum(VN)); + return ThisValNoAssignments[VN] = InstDefiningValue.size()-1; + } + + // Otherwise, this *is* a copy from the RHS. Mark this value number as + // currently being computed, then ask what the ultimate value # of the other + // value is. + ThisValNoAssignments[VN] = -2; + unsigned UltimateVN = + ComputeUltimateVN(OtherValNo, InstDefiningValue, + OtherFromThis, ThisFromOther, + OtherValNoAssignments, ThisValNoAssignments, + OtherLI, ThisLI); + return ThisValNoAssignments[VN] = UltimateVN; +} + + +/// JoinIntervals - Attempt to join these two intervals. On failure, this +/// returns false. Otherwise, if one of the intervals being joined is a +/// physreg, this method always canonicalizes LHS to be it. The output +/// "RHS" will not have been modified, so we can use this information +/// below to update aliases. +bool LiveIntervals::JoinIntervals(LiveInterval &LHS, LiveInterval &RHS) { + // Loop over the value numbers of the LHS, seeing if any are defined from the + // RHS. + SmallVector LHSValsDefinedFromRHS; + LHSValsDefinedFromRHS.resize(LHS.getNumValNums(), -1); + for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { + unsigned ValInst = LHS.getInstForValNum(VN); + if (ValInst == ~0U || ValInst == ~1U) + continue; + + // If the instruction defining the LHS's value is a copy. + MachineInstr *ValInstMI = getInstructionFromIndex(ValInst); + + // If the value number is not defined by a copy instruction, ignore it. + unsigned SrcReg, DstReg; + if (!tii_->isMoveInstr(*ValInstMI, SrcReg, DstReg)) + continue; + + // DstReg is known to be a register in the LHS interval. If the src is from + // the RHS interval, we can use its value #. + if (rep(SrcReg) != RHS.reg) + continue; + + // Figure out the value # from the RHS. + LHSValsDefinedFromRHS[VN] = RHS.getLiveRangeContaining(ValInst-1)->ValId; + } + + // Loop over the value numbers of the RHS, seeing if any are defined from the + // LHS. + SmallVector RHSValsDefinedFromLHS; + RHSValsDefinedFromLHS.resize(RHS.getNumValNums(), -1); + for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { + unsigned ValInst = RHS.getInstForValNum(VN); + if (ValInst == ~0U || ValInst == ~1U) + continue; + + // If the instruction defining the RHS's value is a copy. + MachineInstr *ValInstMI = getInstructionFromIndex(ValInst); + + // If the value number is not defined by a copy instruction, ignore it. + unsigned SrcReg, DstReg; + if (!tii_->isMoveInstr(*ValInstMI, SrcReg, DstReg)) + continue; + + // DstReg is known to be a register in the RHS interval. If the src is from + // the LHS interval, we can use its value #. + if (rep(SrcReg) != LHS.reg) + continue; + + // Figure out the value # from the LHS. + RHSValsDefinedFromLHS[VN] = LHS.getLiveRangeContaining(ValInst-1)->ValId; + } + + // Now that we know the value mapping, compute the final value assignment, + // assuming that the live ranges can be coallesced. + SmallVector LHSValNoAssignments; + SmallVector RHSValNoAssignments; + SmallVector InstDefiningValue; + LHSValNoAssignments.resize(LHS.getNumValNums(), -1); + RHSValNoAssignments.resize(RHS.getNumValNums(), -1); + + // Compute ultimate value numbers for the LHS and RHS values. + for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { + if (LHS.getInstForValNum(VN) == ~2U) continue; + ComputeUltimateVN(VN, InstDefiningValue, + LHSValsDefinedFromRHS, RHSValsDefinedFromLHS, + LHSValNoAssignments, RHSValNoAssignments, LHS, RHS); + } + for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { + if (RHS.getInstForValNum(VN) == ~2U) continue; + ComputeUltimateVN(VN, InstDefiningValue, + RHSValsDefinedFromLHS, LHSValsDefinedFromRHS, + RHSValNoAssignments, LHSValNoAssignments, RHS, LHS); + } + + // Armed with the mappings of LHS/RHS values to ultimate values, walk the + // interval lists to see if these intervals are coallescable. + LiveInterval::const_iterator I = LHS.begin(); + LiveInterval::const_iterator IE = LHS.end(); + LiveInterval::const_iterator J = RHS.begin(); + LiveInterval::const_iterator JE = RHS.end(); + + // Skip ahead until the first place of potential sharing. + if (I->start < J->start) { + I = std::upper_bound(I, IE, J->start); + if (I != LHS.begin()) --I; + } else if (J->start < I->start) { + J = std::upper_bound(J, JE, I->start); + if (J != RHS.begin()) --J; + } + + while (1) { + // Determine if these two live ranges overlap. + bool Overlaps; + if (I->start < J->start) { + Overlaps = I->end > J->start; + } else { + Overlaps = J->end > I->start; + } + + // If so, check value # info to determine if they are really different. + if (Overlaps) { + // If the live range overlap will map to the same value number in the + // result liverange, we can still coallesce them. If not, we can't. + if (LHSValNoAssignments[I->ValId] != RHSValNoAssignments[J->ValId]) + return false; + } + + if (I->end < J->end) { + ++I; + if (I == IE) break; + } else { + ++J; + if (J == JE) break; + } + } + + // If we get here, we know that we can coallesce the live ranges. Ask the + // intervals to coallesce themselves now. + LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0], + InstDefiningValue); + return true; +} namespace { From lattner at cs.uiuc.edu Tue Aug 29 18:18:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 Aug 2006 18:18:13 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveInterval.h LiveIntervalAnalysis.h Message-ID: <200608292318.k7TNIDRl006184@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveInterval.h updated: 1.21 -> 1.22 LiveIntervalAnalysis.h updated: 1.54 -> 1.55 --- Log message: Teach the coallescer to coallesce live intervals joined by an arbitrary number of copies, potentially defining live ranges that appear to have differing value numbers that become identical when coallsced. Among other things, this fixes CodeGen/X86/shift-coalesce.ll and PR687: http://llvm.org/PR687 . --- Diffs of the changes: (+19 -18) LiveInterval.h | 28 +++++++++++----------------- LiveIntervalAnalysis.h | 9 ++++++++- 2 files changed, 19 insertions(+), 18 deletions(-) Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.21 llvm/include/llvm/CodeGen/LiveInterval.h:1.22 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.21 Fri Aug 25 18:41:24 2006 +++ llvm/include/llvm/CodeGen/LiveInterval.h Tue Aug 29 18:17:59 2006 @@ -78,8 +78,6 @@ float weight; // weight of this interval Ranges ranges; // the ranges in which this register is live private: - unsigned NumValues; // the number of distinct values in this interval. - /// InstDefiningValue - This tracks the def index of the instruction that /// defines a particular value number in the interval. This may be ~0, /// which is treated as unknown, or ~1, which is a deleted value number. @@ -87,7 +85,7 @@ public: LiveInterval(unsigned Reg, float Weight) - : reg(Reg), weight(Weight), NumValues(0) { + : reg(Reg), weight(Weight) { } typedef Ranges::iterator iterator; @@ -115,24 +113,24 @@ std::swap(reg, other.reg); std::swap(weight, other.weight); std::swap(ranges, other.ranges); - std::swap(NumValues, other.NumValues); std::swap(InstDefiningValue, other.InstDefiningValue); } - bool containsOneValue() const { return NumValues == 1; } + bool containsOneValue() const { return InstDefiningValue.size() == 1; } - unsigned getNumValNums() const { return NumValues; } + unsigned getNumValNums() const { return InstDefiningValue.size(); } /// getNextValue - Create a new value number and return it. MIIdx specifies /// the instruction that defines the value number. unsigned getNextValue(unsigned MIIdx) { InstDefiningValue.push_back(MIIdx); - return NumValues++; + return InstDefiningValue.size()-1; } /// getInstForValNum - Return the machine instruction index that defines the /// specified value number. unsigned getInstForValNum(unsigned ValNo) const { + assert(ValNo < InstDefiningValue.size()); return InstDefiningValue[ValNo]; } @@ -189,11 +187,6 @@ /// contains the specified index, or end() if there is none. iterator FindLiveRangeContaining(unsigned Idx); - /// joinable - Two intervals are joinable if the either don't overlap at all - /// or if the destination of the copy is a single assignment value, and it - /// only overlaps with one value in the source interval. - bool joinable(const LiveInterval& other, unsigned CopyIdx) const; - /// getOverlapingRanges - Given another live interval which is defined as a /// copy from this one, return a list of all of the live ranges where the /// two overlap and have different value numbers. @@ -218,11 +211,12 @@ addRangeFrom(LR, ranges.begin()); } - /// join - Join two live intervals (this, and other) together. This - /// operation is the result of a copy instruction in the source program, - /// that occurs at index 'CopyIdx' that copies from 'other' to 'this'. This - /// destroys 'other'. - void join(LiveInterval& other, unsigned CopyIdx); + /// join - Join two live intervals (this, and other) together. This applies + /// mappings to the value numbers in the LHS/RHS intervals as specified. If + /// the intervals are not joinable, this aborts. + void join(LiveInterval &Other, int *ValNoAssignments, + int *RHSValNoAssignments, + SmallVector &NewInstDefiningValue); /// removeRange - Remove the specified range from this interval. Note that Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.54 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.55 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.54 Thu Aug 24 17:43:55 2006 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Tue Aug 29 18:17:59 2006 @@ -174,6 +174,13 @@ /// it may be possible if other things get coallesced. bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg); + /// JoinIntervals - Attempt to join these two intervals. On failure, this + /// returns false. Otherwise, if one of the intervals being joined is a + /// physreg, this method always canonicalizes DestInt to be it. The output + /// "SrcInt" will not have been modified, so we can use this information + /// below to update aliases. + bool JoinIntervals(LiveInterval &LHS, LiveInterval &RHS); + /// handleRegisterDef - update intervals for a register def /// (calls handlePhysicalRegisterDef and /// handleVirtualRegisterDef) @@ -200,7 +207,7 @@ bool AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB, - MachineInstr *CopyMI, unsigned CopyIdx); + MachineInstr *CopyMI); bool overlapsAliases(const LiveInterval *lhs, const LiveInterval *rhs) const; From lattner at cs.uiuc.edu Tue Aug 29 18:38:34 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 Aug 2006 18:38:34 -0500 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ExtractFunction.cpp Message-ID: <200608292338.k7TNcY35006655@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ExtractFunction.cpp updated: 1.51 -> 1.52 --- Log message: Code cleanups, no functionality change. --- Diffs of the changes: (+30 -36) ExtractFunction.cpp | 66 +++++++++++++++++++++++----------------------------- 1 files changed, 30 insertions(+), 36 deletions(-) Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.51 llvm/tools/bugpoint/ExtractFunction.cpp:1.52 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.51 Sun Aug 27 17:42:52 2006 +++ llvm/tools/bugpoint/ExtractFunction.cpp Tue Aug 29 18:38:20 2006 @@ -248,11 +248,11 @@ } } -//// RewriteUsesInNewModule - takes a Module and a reference to a globalvalue -//// (OrigVal) in that module and changes the reference to a different -//// globalvalue (NewVal) in a seperate module. +/// RewriteUsesInNewModule - Given a constant 'OrigVal' and a module 'OrigMod', +/// find all uses of the constant. If they are not in the specified module, +/// replace them with uses of another constant 'NewVal'. static void RewriteUsesInNewModule(Constant *OrigVal, Constant *NewVal, - Module *TargetMod) { + Module *OrigMod) { assert(OrigVal->getType() == NewVal->getType() && "Can't replace something with a different type"); for (Value::use_iterator UI = OrigVal->use_begin(), E = OrigVal->use_end(); @@ -260,20 +260,17 @@ Value::use_iterator TmpUI = UI++; User *U = *TmpUI; if (Instruction *Inst = dyn_cast(U)) { - Module *InstM = Inst->getParent()->getParent()->getParent(); - if (InstM != TargetMod) { - TmpUI.getUse() = NewVal; - } + if (Inst->getParent()->getParent()->getParent() != OrigMod) + TmpUI.getUse() = NewVal; } else if (GlobalVariable *GV = dyn_cast(U)) { - if (GV->getParent() != TargetMod) { + if (GV->getParent() != OrigMod) TmpUI.getUse() = NewVal; - } } else if (ConstantExpr *CE = dyn_cast(U)) { // If nothing uses this, don't bother making a copy. if (CE->use_empty()) continue; Constant *NewCE = CE->getWithOperandReplaced(TmpUI.getOperandNo(), NewVal); - RewriteUsesInNewModule(CE, NewCE, TargetMod); + RewriteUsesInNewModule(CE, NewCE, OrigMod); } else if (ConstantStruct *CS = dyn_cast(U)) { // If nothing uses this, don't bother making a copy. if (CS->use_empty()) continue; @@ -282,7 +279,7 @@ for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) Ops.push_back(i == OpNo ? NewVal : CS->getOperand(i)); Constant *NewStruct = ConstantStruct::get(Ops); - RewriteUsesInNewModule(CS, NewStruct, TargetMod); + RewriteUsesInNewModule(CS, NewStruct, OrigMod); } else if (ConstantPacked *CP = dyn_cast(U)) { // If nothing uses this, don't bother making a copy. if (CP->use_empty()) continue; @@ -291,7 +288,7 @@ for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) Ops.push_back(i == OpNo ? NewVal : CP->getOperand(i)); Constant *NewPacked = ConstantPacked::get(Ops); - RewriteUsesInNewModule(CP, NewPacked, TargetMod); + RewriteUsesInNewModule(CP, NewPacked, OrigMod); } else if (ConstantArray *CA = dyn_cast(U)) { // If nothing uses this, don't bother making a copy. if (CA->use_empty()) continue; @@ -301,7 +298,7 @@ Ops.push_back(i == OpNo ? NewVal : CA->getOperand(i)); } Constant *NewArray = ConstantArray::get(CA->getType(), Ops); - RewriteUsesInNewModule(CA, NewArray, TargetMod); + RewriteUsesInNewModule(CA, NewArray, OrigMod); } else { assert(0 && "Unexpected user"); } @@ -345,42 +342,38 @@ // Adding specified functions to new module... for (Module::iterator I = M->begin(), E = M->end(); I != E;) { OrigGlobals.push_back(I); - if(TestFunctions.count(std::make_pair(I->getName(), I->getType()))) { + if (TestFunctions.count(std::make_pair(I->getName(), I->getType()))) { Module::iterator tempI = I; I++; - Function * func = new Function(tempI->getFunctionType(), + Function *Func = new Function(tempI->getFunctionType(), GlobalValue::ExternalLinkage); - M->getFunctionList().insert(tempI, func); + M->getFunctionList().insert(tempI, Func); New->getFunctionList().splice(New->end(), M->getFunctionList(), tempI); - func->setName(tempI->getName()); - func->setCallingConv(tempI->getCallingConv()); - GlobalToPrototypeMap[tempI] = func; - // NEW TO OLD + Func->setName(tempI->getName()); + Func->setCallingConv(tempI->getCallingConv()); + GlobalToPrototypeMap[tempI] = Func; } else { - Function * func = new Function(I->getFunctionType(), + Function *Func = new Function(I->getFunctionType(), GlobalValue::ExternalLinkage, I->getName(), New); - func->setCallingConv(I->getCallingConv()); - GlobalToPrototypeMap[I] = func; - // NEW TO OLD + Func->setCallingConv(I->getCallingConv()); + GlobalToPrototypeMap[I] = Func; I++; } } - //copy over global list - for (Module::global_iterator I = M->global_begin(), - E = M->global_end(); I != E; ++I) { + // Copy over global variable list. + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); + I != E; ++I) { OrigGlobals.push_back(I); - GlobalVariable *glob = new GlobalVariable (I->getType()->getElementType(), - I->isConstant(), - GlobalValue::ExternalLinkage, - 0, - I->getName(), - New); - GlobalToPrototypeMap[I] = glob; + GlobalVariable *G = new GlobalVariable(I->getType()->getElementType(), + I->isConstant(), + GlobalValue::ExternalLinkage, + 0, I->getName(), New); + GlobalToPrototypeMap[I] = G; } // Copy all of the type symbol table entries over. @@ -394,7 +387,8 @@ // the prototype. for (unsigned i = 0, e = OrigGlobals.size(); i != e; ++i) { assert(OrigGlobals[i]->getName() == - GlobalToPrototypeMap[OrigGlobals[i]]->getName()); + GlobalToPrototypeMap[OrigGlobals[i]]->getName() && + "Something got renamed?"); RewriteUsesInNewModule(OrigGlobals[i], GlobalToPrototypeMap[OrigGlobals[i]], OrigGlobals[i]->getParent()); } From nicholas at mxc.ca Tue Aug 29 21:47:02 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 29 Aug 2006 21:47:02 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200608300247.k7U2l2T5009997@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.1 -> 1.2 --- Log message: Move to using the EquivalenceClass ADT. Removes SynSets. If a branch's condition has become a ConstantBool, simplify it immediately. Removing the edge saves work and exposes up more optimization opportunities in the pass. Add support for SelectInst. --- Diffs of the changes: (+92 -165) PredicateSimplifier.cpp | 257 +++++++++++++++++------------------------------- 1 files changed, 92 insertions(+), 165 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.1 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.2 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.1 Mon Aug 28 17:44:55 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Tue Aug 29 21:46:48 2006 @@ -23,26 +23,20 @@ //===------------------------------------------------------------------===// // // This optimization works by substituting %q for %p when protected by a -// conditional that assures us of that fact. Equivalent variables are -// called SynSets; sets of synonyms. We maintain a mapping from Value * -// to the SynSet, and the SynSet maintains the best canonical form of the -// Value. -// -// Properties are stored as relationships between two SynSets. +// conditional that assures us of that fact. Properties are stored as +// relationships between two values. // //===------------------------------------------------------------------===// // TODO: -// * Handle SelectInst -// * Switch to EquivalenceClasses ADT // * Check handling of NAN in floating point types -// * Don't descend into false side of branches with ConstantBool condition. #define DEBUG_TYPE "predsimplify" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Pass.h" +#include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Analysis/Dominators.h" @@ -55,9 +49,11 @@ Statistic<> NumVarsReplaced("predsimplify", "Number of argument substitutions"); Statistic<> - NumResolved("predsimplify", "Number of instruction substitutions"); + NumInstruction("predsimplify", "Number of instructions removed"); Statistic<> NumSwitchCases("predsimplify", "Number of switch cases removed"); + Statistic<> + NumBranches("predsimplify", "Number of branches made unconditional"); /// Used for choosing the canonical Value in a synonym set. /// Leaves the better one in V1. Returns whether a swap took place. @@ -89,10 +85,8 @@ /// and fast lookup. Also stores the set of inequality relationships. class PropertySet { struct Property; + class EquivalenceClasses union_find; public: - typedef unsigned SynSet; - typedef std::map::iterator SynonymIterator; - typedef std::map::const_iterator ConstSynonymIterator; typedef std::vector::iterator PropertyIterator; typedef std::vector::const_iterator ConstPropertyIterator; @@ -107,133 +101,44 @@ } Value *lookup(Value *V) const { - ConstSynonymIterator SI = SynonymMap.find(V); - if (SI == SynonymMap.end()) return NULL; - - return Synonyms[SI->second]; - } - - Value *lookup(SynSet SS) const { - assert(SS < Synonyms.size()); - return Synonyms[SS]; - } - - // Find a SynSet for a given Value. - // - // Given the Value *V sets SS to a valid SynSet. Returns true if it - // found it. - bool findSynSet(Value *V, SynSet &SS) const { - ConstSynonymIterator SI = SynonymMap.find(V); - if (SI != SynonymMap.end()) { - SS = SI->second; - return true; - } - - std::vector::const_iterator I = - std::find(Synonyms.begin(), Synonyms.end(), V); - if (I != Synonyms.end()) { - SS = I-Synonyms.begin(); - return true; - } - - return false; + EquivalenceClasses::member_iterator SI = + union_find.findLeader(V); + if (SI == union_find.member_end()) return NULL; + return *SI; } bool empty() const { - return Synonyms.empty(); + return union_find.empty(); } void addEqual(Value *V1, Value *V2) { order(V1, V2); if (isa(V2)) return; // refuse to set false == true. - V1 = canonicalize(V1); - V2 = canonicalize(V2); - - if (V1 == V2) return; // already equivalent. - - SynSet I1, I2; - bool F1 = findSynSet(V1, I1), - F2 = findSynSet(V2, I2); - - DEBUG(std::cerr << "V1: " << *V1 << " I1: " << I1 - << " F1: " << F1 << "\n"); - DEBUG(std::cerr << "V2: " << *V2 << " I2: " << I2 - << " F2: " << F2 << "\n"); - - if (!F1 && !F2) { - SynSet SS = addSynSet(V1); - SynonymMap[V1] = SS; - SynonymMap[V2] = SS; - } - - else if (!F1 && F2) { - SynonymMap[V1] = I2; - } - - else if (F1 && !F2) { - SynonymMap[V2] = I1; - } - - else { - // This is the case where we have two sets, [%a1, %a2, %a3] and - // [%p1, %p2, %p3] and someone says that %a2 == %p3. We need to - // combine the two synsets. - - // Collapse synonyms of V2 into V1. - for (SynonymIterator I = SynonymMap.begin(), E = SynonymMap.end(); - I != E; ++I) { - if (I->second == I2) I->second = I1; - else if (I->second > I2) --I->second; - } - - // Move Properties - for (PropertyIterator I = Properties.begin(), E = Properties.end(); - I != E; ++I) { - if (I->S1 == I2) I->S1 = I1; - else if (I->S1 > I2) --I->S1; - if (I->S2 == I2) I->S2 = I1; - else if (I->S2 > I2) --I->S2; - } - - // Remove the synonym - Synonyms.erase(Synonyms.begin() + I2); - } - + union_find.unionSets(V1, V2); addImpliedProperties(EQ, V1, V2); } void addNotEqual(Value *V1, Value *V2) { DEBUG(std::cerr << "not equal: " << *V1 << " and " << *V2 << "\n"); - bool skip_search = false; V1 = canonicalize(V1); V2 = canonicalize(V2); - SynSet S1, S2; - if (!findSynSet(V1, S1)) { - skip_search = true; - S1 = addSynSet(V1); - } - if (!findSynSet(V2, S2)) { - skip_search = true; - S2 = addSynSet(V2); - } + // Does the property already exist? + for (PropertyIterator I = Properties.begin(), E = Properties.end(); + I != E; ++I) { + if (I->Opcode != NE) continue; - if (!skip_search) { - // Does the property already exist? - for (PropertyIterator I = Properties.begin(), E = Properties.end(); - I != E; ++I) { - if (I->Opcode != NE) continue; - - if ((I->S1 == S1 && I->S2 == S2) || - (I->S1 == S2 && I->S2 == S1)) { - return; // Found. - } + I->V1 = canonicalize(I->V1); + I->V2 = canonicalize(I->V2); + if ((I->V1 == V1 && I->V2 == V2) || + (I->V1 == V2 && I->V2 == V1)) { + return; // Found. } } // Add the property. - Properties.push_back(Property(NE, S1, S2)); + Properties.push_back(Property(NE, V1, V2)); addImpliedProperties(NE, V1, V2); } @@ -241,17 +146,19 @@ assert(Opcode != EQ && "Can't findProperty on EQ." "Use the lookup method instead."); - SynSet S1, S2; - if (!findSynSet(V1, S1)) return Properties.end(); - if (!findSynSet(V2, S2)) return Properties.end(); + V1 = lookup(V1); + V2 = lookup(V2); + if (!V1 || !V2) return Properties.end(); // Does the property already exist? for (PropertyIterator I = Properties.begin(), E = Properties.end(); I != E; ++I) { if (I->Opcode != Opcode) continue; - if ((I->S1 == S1 && I->S2 == S2) || - (I->S1 == S2 && I->S2 == S1)) { + I->V1 = canonicalize(I->V1); + I->V2 = canonicalize(I->V2); + if ((I->V1 == V1 && I->V2 == V2) || + (I->V1 == V2 && I->V2 == V1)) { return I; // Found. } } @@ -263,17 +170,20 @@ assert(Opcode != EQ && "Can't findProperty on EQ." "Use the lookup method instead."); - SynSet S1, S2; - if (!findSynSet(V1, S1)) return Properties.end(); - if (!findSynSet(V2, S2)) return Properties.end(); + V1 = lookup(V1); + V2 = lookup(V2); + if (!V1 || !V2) return Properties.end(); // Does the property already exist? for (ConstPropertyIterator I = Properties.begin(), E = Properties.end(); I != E; ++I) { if (I->Opcode != Opcode) continue; - if ((I->S1 == S1 && I->S2 == S2) || - (I->S1 == S2 && I->S2 == S1)) { + Value *v1 = lookup(I->V1), + *v2 = lookup(I->V2); + if (!v1 || !v2) continue; + if ((v1 == V1 && v2 == V2) || + (v1 == V2 && v2 == V1)) { return I; // Found. } } @@ -284,26 +194,21 @@ // Represents Head OP [Tail1, Tail2, ...] // For example: %x != %a, %x != %b. struct Property { - Property(Ops opcode, SynSet s1, SynSet s2) - : Opcode(opcode), S1(s1), S2(s2) + Property(Ops opcode, Value *v1, Value *v2) + : Opcode(opcode), V1(v1), V2(v2) { assert(opcode != EQ && "Equality belongs in the synonym set," "not a property."); } bool operator<(const Property &rhs) const { if (Opcode != rhs.Opcode) return Opcode < rhs.Opcode; - if (S1 != rhs.S1) return S1 < rhs.S1; - return S2 < rhs.S2; + if (V1 != rhs.V1) return V1 < rhs.V1; + return V2 < rhs.V2; } Ops Opcode; - SynSet S1, S2; + Value *V1, *V2; }; - SynSet addSynSet(Value *V) { - Synonyms.push_back(V); - return Synonyms.size()-1; - } - void add(Ops Opcode, Value *V1, Value *V2, bool invert) { switch (Opcode) { case EQ: @@ -386,19 +291,6 @@ public: void debug(std::ostream &os) const { - os << Synonyms.size() << " synsets:\n"; - for (unsigned I = 0, E = Synonyms.size(); I != E; ++I) { - os << I << ". " << *Synonyms[I] << "\n"; - } - for (ConstSynonymIterator I = SynonymMap.begin(),E = SynonymMap.end(); - I != E; ++I) { - os << *I->first << "-> #" << I->second << "\n"; - } - os << Properties.size() << " properties:\n"; - for (unsigned I = 0, E = Properties.size(); I != E; ++I) { - os << I << ". (" << Properties[I].Opcode << "," - << Properties[I].S1 << "," << Properties[I].S2 << ")\n"; - } } std::vector Properties; @@ -416,6 +308,7 @@ // Try to replace the Use of the instruction with something simpler. Value *resolve(SetCondInst *SCI, const PropertySet &); Value *resolve(BinaryOperator *BO, const PropertySet &); + Value *resolve(SelectInst *SI, const PropertySet &); Value *resolve(Value *V, const PropertySet &); // Used by terminator instructions to proceed from the current basic @@ -546,6 +439,15 @@ return BO; } +Value *PredicateSimplifier::resolve(SelectInst *SI, const PropertySet &KP) { + Value *Condition = resolve(SI->getCondition(), KP); + if (Condition == ConstantBool::True) + return resolve(SI->getTrueValue(), KP); + else if (Condition == ConstantBool::False) + return resolve(SI->getFalseValue(), KP); + return SI; +} + Value *PredicateSimplifier::resolve(Value *V, const PropertySet &KP) { if (isa(V) || isa(V) || KP.empty()) return V; @@ -553,6 +455,8 @@ if (BinaryOperator *BO = dyn_cast(V)) return resolve(BO, KP); + else if (SelectInst *SI = dyn_cast(V)) + return resolve(SI, KP); return V; } @@ -588,7 +492,7 @@ assert(V && "resolve not supposed to return NULL."); if (V != I) { modified = true; - ++NumResolved; + ++NumInstruction; I->replaceAllUsesWith(V); I->eraseFromParent(); } @@ -645,15 +549,31 @@ Value *Condition = BI->getCondition(); + BasicBlock *TrueDest = BI->getSuccessor(0), + *FalseDest = BI->getSuccessor(1); + + if (Condition == ConstantBool::True) { + FalseDest->removePredecessor(BI->getParent()); + BI->setUnconditionalDest(TrueDest); + modified = true; + ++NumBranches; + proceedToSuccessor(KP, Node, DT->getNode(TrueDest)); + return; + } else if (Condition == ConstantBool::False) { + TrueDest->removePredecessor(BI->getParent()); + BI->setUnconditionalDest(FalseDest); + modified = true; + ++NumBranches; + proceedToSuccessor(KP, Node, DT->getNode(FalseDest)); + return; + } + PropertySet TrueProperties(KP), FalseProperties(KP); DEBUG(std::cerr << "true set:\n"); TrueProperties.addEqual(ConstantBool::True, Condition); DEBUG(std::cerr << "false set:\n"); FalseProperties.addEqual(ConstantBool::False, Condition); - BasicBlock *TrueDest = BI->getSuccessor(0), - *FalseDest = BI->getSuccessor(1); - PropertySet KPcopy(KP); proceedToSuccessor(KP, TrueProperties, Node, DT->getNode(TrueDest)); proceedToSuccessor(KPcopy, FalseProperties, Node, DT->getNode(FalseDest)); @@ -665,17 +585,18 @@ // If there's an NEProperty covering this SwitchInst, we may be able to // eliminate one of the cases. - PropertySet::SynSet S; - - if (KP.findSynSet(Condition, S)) { + if (Value *C = KP.lookup(Condition)) { + Condition = C; for (PropertySet::ConstPropertyIterator I = KP.Properties.begin(), E = KP.Properties.end(); I != E; ++I) { if (I->Opcode != PropertySet::NE) continue; - if (I->S1 != S && I->S2 != S) continue; + Value *V1 = KP.lookup(I->V1), + *V2 = KP.lookup(I->V2); + if (V1 != C && V2 != C) continue; // Is one side a number? - ConstantInt *CI = dyn_cast(KP.lookup(I->S1)); - if (!CI) CI = dyn_cast(KP.lookup(I->S2)); + ConstantInt *CI = dyn_cast(KP.lookup(I->V1)); + if (!CI) CI = dyn_cast(KP.lookup(I->V2)); if (CI) { unsigned i = SI->findCaseValue(CI); @@ -732,11 +653,17 @@ void PredicateSimplifier::visit(BinaryOperator *BO, DominatorTree::Node *, PropertySet &KP) { Instruction::BinaryOps ops = BO->getOpcode(); - if (ops != Instruction::Div && ops != Instruction::Rem) return; - Value *Divisor = BO->getOperand(1); - const Type *Ty = cast(Divisor->getType()); - KP.addNotEqual(Constant::getNullValue(Ty), Divisor); + switch (ops) { + case Instruction::Div: + case Instruction::Rem: { + Value *Divisor = BO->getOperand(1); + KP.addNotEqual(Constant::getNullValue(Divisor->getType()), Divisor); + break; + } + default: + break; + } // Some other things we could do: // In f=x*y, if x != 1 && y != 1 then f != x && f != y. From lattner at cs.uiuc.edu Tue Aug 29 23:17:14 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 Aug 2006 23:17:14 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/Statistic.h Message-ID: <200608300417.k7U4HEIs011508@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: Statistic.h updated: 1.16 -> 1.17 --- Log message: Instantiate Statistic<> in one place, not in every .o file that uses it. --- Diffs of the changes: (+4 -1) Statistic.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/include/llvm/ADT/Statistic.h diff -u llvm/include/llvm/ADT/Statistic.h:1.16 llvm/include/llvm/ADT/Statistic.h:1.17 --- llvm/include/llvm/ADT/Statistic.h:1.16 Wed Jun 21 11:53:47 2006 +++ llvm/include/llvm/ADT/Statistic.h Tue Aug 29 23:17:00 2006 @@ -24,7 +24,8 @@ #ifndef LLVM_ADT_STATISTIC_H #define LLVM_ADT_STATISTIC_H -#include +#include +#include "llvm/Support/Compiler.h" namespace llvm { @@ -85,6 +86,8 @@ const Statistic &operator/=(const DataType &V) { Value /= V; return *this; } }; +EXTERN_TEMPLATE_INSTANTIATION(class Statistic); + } // End llvm namespace #endif From lattner at cs.uiuc.edu Tue Aug 29 23:17:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 Aug 2006 23:17:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/Statistic.cpp Message-ID: <200608300417.k7U4HFp0011513@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Statistic.cpp updated: 1.17 -> 1.18 --- Log message: Instantiate Statistic<> in one place, not in every .o file that uses it. --- Diffs of the changes: (+2 -0) Statistic.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Support/Statistic.cpp diff -u llvm/lib/Support/Statistic.cpp:1.17 llvm/lib/Support/Statistic.cpp:1.18 --- llvm/lib/Support/Statistic.cpp:1.17 Wed Jun 21 11:53:47 2006 +++ llvm/lib/Support/Statistic.cpp Tue Aug 29 23:17:00 2006 @@ -33,6 +33,8 @@ unsigned StatisticBase::NumStats = 0; +TEMPLATE_INSTANTIATION(class Statistic); + // -stats - Command line option to cause transformations to emit stats about // what they did. // From lattner at cs.uiuc.edu Wed Aug 30 00:57:06 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 30 Aug 2006 00:57:06 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200608300557.k7U5v6RR012994@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.128 -> 1.129 --- Log message: fix 80 column issue --- Diffs of the changes: (+1 -1) SelectionDAG.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.128 llvm/include/llvm/CodeGen/SelectionDAG.h:1.129 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.128 Tue Aug 29 01:42:10 2006 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Wed Aug 30 00:56:52 2006 @@ -135,7 +135,7 @@ } - //===----------------------------------------------------------------------===// + //===--------------------------------------------------------------------===// // Node creation methods. // SDOperand getString(const std::string &Val); From jlaskey at apple.com Wed Aug 30 13:47:44 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 13:47:44 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608301847.k7UIli4l008768@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.9 -> 1.10 --- Log message: Debugging newly pass fail report. --- Diffs of the changes: (+27 -23) ProgramResults.php | 50 +++++++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 23 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.9 nightlytest-serverside/ProgramResults.php:1.10 --- nightlytest-serverside/ProgramResults.php:1.9 Tue Aug 22 12:26:12 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 13:47:30 2006 @@ -435,7 +435,7 @@ * Get New Tests * * This is somewhat of a hack because from night 684 forward we now store the test - * in their own table as oppoesd in the night table. + * in their own table as opposed in the night table. */ function getNewTests($cur_id, $prev_id, $mysql_link){ if(strcmp($prev_id, "")===0 || strcmp($cur_id, "")===0){ @@ -463,8 +463,9 @@ $query = "SELECT * FROM tests WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if( !isset($test_hash["{$row['measure']} - {$row['program']}"])){ - $result .= "{$row['measure']} - {$row['program']}
\n"; + $test_key = "{$row['measure']} - {$row['program']}"; + if(!isset($test_hash[$test_key])){ + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); @@ -476,7 +477,7 @@ * Get Removed Tests * * This is somewhat of a hack because from night 684 forward we now store the test - * in their own table as oppoesd in the night table. + * in their own table as opposed in the night table. */ function getRemovedTests($cur_id, $prev_id, $mysql_link){ if(strcmp($prev_id, "")===0 || strcmp($cur_id, "")===0){ @@ -494,18 +495,19 @@ } else{ $test_hash=array(); - $query = "SELECT * FROM tests WHERE night=$cur_id"; + $query = "SELECT * FROM tests WHERE night=$prev_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_hash["{$row['measure']} - {$row['program']}"]=1; } mysql_free_result($program_query); - $query = "SELECT * FROM tests WHERE night=$prev_id"; + $query = "SELECT * FROM tests WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if( !isset($test_hash["{$row['measure']} - {$row['program']}"])){ - $result .= "{$row['measure']} - {$row['program']}
\n"; + $test_key = "{$row['measure']} - {$row['program']}"; + if(!isset($test_hash[$test_key])){ + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); @@ -517,7 +519,7 @@ * Get Fixed Tests * * This is somewhat of a hack because from night 684 forward we now store the test - * in their own table as oppoesd in the night table. + * in their own table as opposed in the night table. */ function getFixedTests($cur_id, $prev_id, $mysql_link){ if(strcmp($prev_id, "")===0 || strcmp($cur_id, "")===0){ @@ -535,21 +537,22 @@ } else{ $test_hash=array(); - $query = "SELECT * FROM tests WHERE night=$cur_id"; + $query = "SELECT * FROM tests WHERE night=$prev_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if(strcmp("{$row['result']}", "PASS")===0){ + if(strcmp("{$row['result']}", "PASS")!==0){ $test_hash["{$row['measure']} - {$row['program']}"]=$row['result']; } } mysql_free_result($program_query); - $query = "SELECT * FROM tests WHERE night=$prev_id"; + $query = "SELECT * FROM tests WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if( isset($test_hash["{$row['measure']} - {$row['program']}"]) && - strcmp($test_hash["{$row['measure']} - {$row['program']}"], $row['result'])!==0){ - $result .= "{$row['measure']} - {$row['program']}
\n"; + $test_key = "{$row['measure']} - {$row['program']}"; + if(isset($test_hash[$test_key]) && + strcmp($test_hash[$test_key], $row['result'])!==0){ + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); @@ -579,21 +582,22 @@ } else{ $test_hash=array(); - $query = "SELECT * FROM tests WHERE night=$prev_id"; + $query = "SELECT * FROM tests WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if(strcmp("{$row['result']}", "PASS")===0){ + if(strcmp("{$row['result']}", "PASS")!==0){ $test_hash["{$row['measure']} - {$row['program']}"]=$row['result']; - } + } } mysql_free_result($program_query); - $query = "SELECT * FROM tests WHERE night=$cur_id"; + $query = "SELECT * FROM tests WHERE night=$prev_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if( isset($test_hash["{$row['measure']} - {$row['program']}"]) && - strcmp($test_hash["{$row['measure']} - {$row['program']}"], $row['result'])!==0){ - $result .= "{$row['measure']} - {$row['program']}
\n"; + $test_key = "{$row['measure']} - {$row['program']}"; + if(isset($test_hash[$test_key]) && + strcmp($test_hash[$test_key], $row['result'])!==0){ + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); @@ -691,4 +695,4 @@ } -?> \ No newline at end of file +?> From jlaskey at apple.com Wed Aug 30 13:52:10 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 13:52:10 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608301852.k7UIqAh1008895@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.10 -> 1.11 --- Log message: Debugging newly pass fail report attempt #2. --- Diffs of the changes: (+2 -2) ProgramResults.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.10 nightlytest-serverside/ProgramResults.php:1.11 --- nightlytest-serverside/ProgramResults.php:1.10 Wed Aug 30 13:47:30 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 13:51:55 2006 @@ -495,14 +495,14 @@ } else{ $test_hash=array(); - $query = "SELECT * FROM tests WHERE night=$prev_id"; + $query = "SELECT * FROM tests WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_hash["{$row['measure']} - {$row['program']}"]=1; } mysql_free_result($program_query); - $query = "SELECT * FROM tests WHERE night=$cur_id"; + $query = "SELECT * FROM tests WHERE night=$prev_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['measure']} - {$row['program']}"; From jlaskey at apple.com Wed Aug 30 14:40:05 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 14:40:05 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608301940.k7UJe50O009798@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.11 -> 1.12 --- Log message: Debugging newly pass fail report attempt #3. --- Diffs of the changes: (+4 -2) ProgramResults.php | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.11 nightlytest-serverside/ProgramResults.php:1.12 --- nightlytest-serverside/ProgramResults.php:1.11 Wed Aug 30 13:51:55 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 14:39:51 2006 @@ -552,8 +552,9 @@ $test_key = "{$row['measure']} - {$row['program']}"; if(isset($test_hash[$test_key]) && strcmp($test_hash[$test_key], $row['result'])!==0){ - $result .= $test_key . "
\n"; +// $result .= $test_key . "
\n"; } + $result .= $test_key . "
\n"; } mysql_free_result($program_query); } @@ -597,8 +598,9 @@ $test_key = "{$row['measure']} - {$row['program']}"; if(isset($test_hash[$test_key]) && strcmp($test_hash[$test_key], $row['result'])!==0){ - $result .= $test_key . "
\n"; +// $result .= $test_key . "
\n"; } + $result .= $test_key . "
\n"; } mysql_free_result($program_query); } From jlaskey at apple.com Wed Aug 30 14:41:47 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 14:41:47 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608301941.k7UJfleM009888@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.12 -> 1.13 --- Log message: Debugging newly pass fail report attempt #4. --- Diffs of the changes: (+2 -4) ProgramResults.php | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.12 nightlytest-serverside/ProgramResults.php:1.13 --- nightlytest-serverside/ProgramResults.php:1.12 Wed Aug 30 14:39:51 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 14:41:33 2006 @@ -552,9 +552,8 @@ $test_key = "{$row['measure']} - {$row['program']}"; if(isset($test_hash[$test_key]) && strcmp($test_hash[$test_key], $row['result'])!==0){ -// $result .= $test_key . "
\n"; + $result .= $test_key . "
\n"; } - $result .= $test_key . "
\n"; } mysql_free_result($program_query); } @@ -598,9 +597,8 @@ $test_key = "{$row['measure']} - {$row['program']}"; if(isset($test_hash[$test_key]) && strcmp($test_hash[$test_key], $row['result'])!==0){ -// $result .= $test_key . "
\n"; + $result .= $test_key . "
\n"; } - $result .= $test_key . "
\n"; } mysql_free_result($program_query); } From lattner at cs.uiuc.edu Wed Aug 30 15:37:20 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 30 Aug 2006 15:37:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/DynamicLibrary.cpp Message-ID: <200608302037.k7UKbKqm011069@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: DynamicLibrary.cpp updated: 1.17 -> 1.18 --- Log message: Guess what happens when asserts are disabled. :( Also, the assert could never fire due to || instead of &&. --- Diffs of the changes: (+2 -1) DynamicLibrary.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/System/DynamicLibrary.cpp diff -u llvm/lib/System/DynamicLibrary.cpp:1.17 llvm/lib/System/DynamicLibrary.cpp:1.18 --- llvm/lib/System/DynamicLibrary.cpp:1.17 Fri Aug 25 14:54:53 2006 +++ llvm/lib/System/DynamicLibrary.cpp Wed Aug 30 15:37:06 2006 @@ -48,7 +48,8 @@ static inline void check_ltdl_initialization() { static bool did_initialize_ltdl = false; if (!did_initialize_ltdl) { - assert(0 == lt_dlinit() || "Can't init the ltdl library"); + int Err = lt_dlinit(); + assert(0 == Err && "Can't init the ltdl library"); did_initialize_ltdl = true; } } From lattner at cs.uiuc.edu Wed Aug 30 15:48:02 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 30 Aug 2006 15:48:02 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Reader.h Message-ID: <200608302048.k7UKm2BI011323@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Reader.h updated: 1.26 -> 1.27 --- Log message: Restore source-level compatibility with clients of these functions. --- Diffs of the changes: (+6 -6) Reader.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/include/llvm/Bytecode/Reader.h diff -u llvm/include/llvm/Bytecode/Reader.h:1.26 llvm/include/llvm/Bytecode/Reader.h:1.27 --- llvm/include/llvm/Bytecode/Reader.h:1.26 Fri Aug 25 12:43:11 2006 +++ llvm/include/llvm/Bytecode/Reader.h Wed Aug 30 15:47:48 2006 @@ -36,7 +36,7 @@ /// @brief Get a ModuleProvide for a bytecode file. ModuleProvider *getBytecodeModuleProvider( const std::string &Filename, ///< Name of file to be read - std::string* ErrMsg, ///< Optional error message holder + std::string* ErrMsg = 0, ///< Optional error message holder BytecodeHandler* H = 0 ///< Optional handler for reader events ); @@ -49,8 +49,8 @@ const unsigned char *Buffer, ///< Start of buffer to parse unsigned BufferSize, ///< Size of the buffer const std::string &ModuleID, ///< Name to give the module - std::string* ErrMsg, ///< Optional place to return an error message - BytecodeHandler* H ///< Optional handler for reader events + std::string* ErrMsg = 0, ///< Optional place to return an error message + BytecodeHandler* H = 0 ///< Optional handler for reader events ); /// This is the main interface to bytecode parsing. It opens the file specified @@ -84,7 +84,7 @@ bool GetBytecodeDependentLibraries( const std::string &fileName, ///< File name to read bytecode from Module::LibraryListType& deplibs, ///< List of dependent libraries extracted - std::string* ErrMsg ///< Optional error message holder + std::string* ErrMsg = 0 ///< Optional error message holder ); /// This function will read only the necessary parts of a bytecode file in order @@ -96,7 +96,7 @@ bool GetBytecodeSymbols( const sys::Path& fileName, ///< Filename to read bytecode from std::vector& syms, ///< Vector to return symbols in - std::string* ErrMsg ///< Optional error message holder + std::string* ErrMsg = 0 ///< Optional error message holder ); /// This function will read only the necessary parts of a bytecode buffer in @@ -111,7 +111,7 @@ unsigned Length, ///< The length of \p Buffer const std::string& ModuleID, ///< An identifier for the module std::vector& symbols, ///< The symbols defined in the module - std::string* ErrMsg ///< Optional error message holder + std::string* ErrMsg = 0 ///< Optional error message holder ); } // End llvm namespace From rspencer at reidspencer.com Wed Aug 30 15:52:09 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 30 Aug 2006 13:52:09 -0700 Subject: [llvm-commits] CVS: llvm/lib/System/DynamicLibrary.cpp In-Reply-To: <200608302037.k7UKbKqm011069@zion.cs.uiuc.edu> References: <200608302037.k7UKbKqm011069@zion.cs.uiuc.edu> Message-ID: <1156971129.2694.39.camel@bashful.x10sys.com> Oops! On Wed, 2006-08-30 at 15:37 -0500, Chris Lattner wrote: > > Changes in directory llvm/lib/System: > > DynamicLibrary.cpp updated: 1.17 -> 1.18 > --- > Log message: > > Guess what happens when asserts are disabled. :( > > Also, the assert could never fire due to || instead of &&. > > > --- > Diffs of the changes: (+2 -1) > > DynamicLibrary.cpp | 3 ++- > 1 files changed, 2 insertions(+), 1 deletion(-) > > > Index: llvm/lib/System/DynamicLibrary.cpp > diff -u llvm/lib/System/DynamicLibrary.cpp:1.17 llvm/lib/System/DynamicLibrary.cpp:1.18 > --- llvm/lib/System/DynamicLibrary.cpp:1.17 Fri Aug 25 14:54:53 2006 > +++ llvm/lib/System/DynamicLibrary.cpp Wed Aug 30 15:37:06 2006 > @@ -48,7 +48,8 @@ > static inline void check_ltdl_initialization() { > static bool did_initialize_ltdl = false; > if (!did_initialize_ltdl) { > - assert(0 == lt_dlinit() || "Can't init the ltdl library"); > + int Err = lt_dlinit(); > + assert(0 == Err && "Can't init the ltdl library"); > did_initialize_ltdl = true; > } > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From rspencer at reidspencer.com Wed Aug 30 15:53:34 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 30 Aug 2006 13:53:34 -0700 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Reader.h In-Reply-To: <200608302048.k7UKm2BI011323@zion.cs.uiuc.edu> References: <200608302048.k7UKm2BI011323@zion.cs.uiuc.edu> Message-ID: <1156971214.2694.41.camel@bashful.x10sys.com> Personally, I consider this "compatibility" to be wrong since it allows callers to avoid the error message. We should report errors that occur. Reid. On Wed, 2006-08-30 at 15:48 -0500, Chris Lattner wrote: > > Changes in directory llvm/include/llvm/Bytecode: > > Reader.h updated: 1.26 -> 1.27 > --- > Log message: > > Restore source-level compatibility with clients of these functions. > > > --- > Diffs of the changes: (+6 -6) > > Reader.h | 12 ++++++------ > 1 files changed, 6 insertions(+), 6 deletions(-) > > > Index: llvm/include/llvm/Bytecode/Reader.h > diff -u llvm/include/llvm/Bytecode/Reader.h:1.26 llvm/include/llvm/Bytecode/Reader.h:1.27 > --- llvm/include/llvm/Bytecode/Reader.h:1.26 Fri Aug 25 12:43:11 2006 > +++ llvm/include/llvm/Bytecode/Reader.h Wed Aug 30 15:47:48 2006 > @@ -36,7 +36,7 @@ > /// @brief Get a ModuleProvide for a bytecode file. > ModuleProvider *getBytecodeModuleProvider( > const std::string &Filename, ///< Name of file to be read > - std::string* ErrMsg, ///< Optional error message holder > + std::string* ErrMsg = 0, ///< Optional error message holder > BytecodeHandler* H = 0 ///< Optional handler for reader events > ); > > @@ -49,8 +49,8 @@ > const unsigned char *Buffer, ///< Start of buffer to parse > unsigned BufferSize, ///< Size of the buffer > const std::string &ModuleID, ///< Name to give the module > - std::string* ErrMsg, ///< Optional place to return an error message > - BytecodeHandler* H ///< Optional handler for reader events > + std::string* ErrMsg = 0, ///< Optional place to return an error message > + BytecodeHandler* H = 0 ///< Optional handler for reader events > ); > > /// This is the main interface to bytecode parsing. It opens the file specified > @@ -84,7 +84,7 @@ > bool GetBytecodeDependentLibraries( > const std::string &fileName, ///< File name to read bytecode from > Module::LibraryListType& deplibs, ///< List of dependent libraries extracted > - std::string* ErrMsg ///< Optional error message holder > + std::string* ErrMsg = 0 ///< Optional error message holder > ); > > /// This function will read only the necessary parts of a bytecode file in order > @@ -96,7 +96,7 @@ > bool GetBytecodeSymbols( > const sys::Path& fileName, ///< Filename to read bytecode from > std::vector& syms, ///< Vector to return symbols in > - std::string* ErrMsg ///< Optional error message holder > + std::string* ErrMsg = 0 ///< Optional error message holder > ); > > /// This function will read only the necessary parts of a bytecode buffer in > @@ -111,7 +111,7 @@ > unsigned Length, ///< The length of \p Buffer > const std::string& ModuleID, ///< An identifier for the module > std::vector& symbols, ///< The symbols defined in the module > - std::string* ErrMsg ///< Optional error message holder > + std::string* ErrMsg = 0 ///< Optional error message holder > ); > > } // End llvm namespace > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jlaskey at apple.com Wed Aug 30 15:57:05 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 15:57:05 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302057.k7UKv5qL011519@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.13 -> 1.14 --- Log message: Debugging newly pass fail report attempt #5. --- Diffs of the changes: (+42 -0) ProgramResults.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.13 nightlytest-serverside/ProgramResults.php:1.14 --- nightlytest-serverside/ProgramResults.php:1.13 Wed Aug 30 14:41:33 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 15:56:51 2006 @@ -556,6 +556,27 @@ } } mysql_free_result($program_query); + + $test_hash=array(); + $query = "SELECT * FROM program WHERE night=$prev_id"; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)){ + if(strcmp("{$row['result']}", "PASS")!==0){ + $test_hash["{$row['measure']} - {$row['program']}"]=$row['result']; + } + } + mysql_free_result($program_query); + + $query = "SELECT * FROM program WHERE night=$cur_id"; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)){ + $test_key = "{$row['measure']} - {$row['program']}"; + if(isset($test_hash[$test_key]) && + strcmp($test_hash[$test_key], $row['result'])!==0){ + $result .= $test_key . "
\n"; + } + } + mysql_free_result($program_query); } return $result; } @@ -601,6 +622,27 @@ } } mysql_free_result($program_query); + + $test_hash=array(); + $query = "SELECT * FROM program WHERE night=$cur_id"; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)){ + if(strcmp("{$row['result']}", "PASS")!==0){ + $test_hash["{$row['measure']} - {$row['program']}"]=$row['result']; + } + } + mysql_free_result($program_query); + + $query = "SELECT * FROM program WHERE night=$prev_id"; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)){ + $test_key = "{$row['measure']} - {$row['program']}"; + if(isset($test_hash[$test_key]) && + strcmp($test_hash[$test_key], $row['result'])!==0){ + $result .= $test_key . "
\n"; + } + } + mysql_free_result($program_query); } return $result; } From sabre at nondot.org Wed Aug 30 16:38:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 30 Aug 2006 14:38:34 -0700 (PDT) Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Reader.h In-Reply-To: <1156971214.2694.41.camel@bashful.x10sys.com> References: <200608302048.k7UKm2BI011323@zion.cs.uiuc.edu> <1156971214.2694.41.camel@bashful.x10sys.com> Message-ID: On Wed, 30 Aug 2006, Reid Spencer wrote: > Personally, I consider this "compatibility" to be wrong since it allows > callers to avoid the error message. We should report errors that occur. Depends on the client. In this case, it was a gratuitous source-level incompatibility... -Chris > On Wed, 2006-08-30 at 15:48 -0500, Chris Lattner wrote: >> >> Changes in directory llvm/include/llvm/Bytecode: >> >> Reader.h updated: 1.26 -> 1.27 >> --- >> Log message: >> >> Restore source-level compatibility with clients of these functions. >> >> >> --- >> Diffs of the changes: (+6 -6) >> >> Reader.h | 12 ++++++------ >> 1 files changed, 6 insertions(+), 6 deletions(-) >> >> >> Index: llvm/include/llvm/Bytecode/Reader.h >> diff -u llvm/include/llvm/Bytecode/Reader.h:1.26 llvm/include/llvm/Bytecode/Reader.h:1.27 >> --- llvm/include/llvm/Bytecode/Reader.h:1.26 Fri Aug 25 12:43:11 2006 >> +++ llvm/include/llvm/Bytecode/Reader.h Wed Aug 30 15:47:48 2006 >> @@ -36,7 +36,7 @@ >> /// @brief Get a ModuleProvide for a bytecode file. >> ModuleProvider *getBytecodeModuleProvider( >> const std::string &Filename, ///< Name of file to be read >> - std::string* ErrMsg, ///< Optional error message holder >> + std::string* ErrMsg = 0, ///< Optional error message holder >> BytecodeHandler* H = 0 ///< Optional handler for reader events >> ); >> >> @@ -49,8 +49,8 @@ >> const unsigned char *Buffer, ///< Start of buffer to parse >> unsigned BufferSize, ///< Size of the buffer >> const std::string &ModuleID, ///< Name to give the module >> - std::string* ErrMsg, ///< Optional place to return an error message >> - BytecodeHandler* H ///< Optional handler for reader events >> + std::string* ErrMsg = 0, ///< Optional place to return an error message >> + BytecodeHandler* H = 0 ///< Optional handler for reader events >> ); >> >> /// This is the main interface to bytecode parsing. It opens the file specified >> @@ -84,7 +84,7 @@ >> bool GetBytecodeDependentLibraries( >> const std::string &fileName, ///< File name to read bytecode from >> Module::LibraryListType& deplibs, ///< List of dependent libraries extracted >> - std::string* ErrMsg ///< Optional error message holder >> + std::string* ErrMsg = 0 ///< Optional error message holder >> ); >> >> /// This function will read only the necessary parts of a bytecode file in order >> @@ -96,7 +96,7 @@ >> bool GetBytecodeSymbols( >> const sys::Path& fileName, ///< Filename to read bytecode from >> std::vector& syms, ///< Vector to return symbols in >> - std::string* ErrMsg ///< Optional error message holder >> + std::string* ErrMsg = 0 ///< Optional error message holder >> ); >> >> /// This function will read only the necessary parts of a bytecode buffer in >> @@ -111,7 +111,7 @@ >> unsigned Length, ///< The length of \p Buffer >> const std::string& ModuleID, ///< An identifier for the module >> std::vector& symbols, ///< The symbols defined in the module >> - std::string* ErrMsg ///< Optional error message holder >> + std::string* ErrMsg = 0 ///< Optional error message holder >> ); >> >> } // End llvm namespace >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -Chris -- http://nondot.org/sabre/ http://llvm.org/ From jlaskey at apple.com Wed Aug 30 16:00:19 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 16:00:19 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302100.k7UL0JwE011633@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.14 -> 1.15 --- Log message: Debugging newly pass fail report attempt #6. --- Diffs of the changes: (+6 -6) ProgramResults.php | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.14 nightlytest-serverside/ProgramResults.php:1.15 --- nightlytest-serverside/ProgramResults.php:1.14 Wed Aug 30 15:56:51 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 16:00:05 2006 @@ -546,7 +546,7 @@ } mysql_free_result($program_query); - $query = "SELECT * FROM tests WHERE night=$cur_id"; + $query = "SELECT * FROM tests WHERE night=$cur_id ORDER BY program ASC" ; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['measure']} - {$row['program']}"; @@ -567,7 +567,7 @@ } mysql_free_result($program_query); - $query = "SELECT * FROM program WHERE night=$cur_id"; + $query = "SELECT * FROM program WHERE night=$cur_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['measure']} - {$row['program']}"; @@ -612,7 +612,7 @@ } mysql_free_result($program_query); - $query = "SELECT * FROM tests WHERE night=$prev_id"; + $query = "SELECT * FROM tests WHERE night=$prev_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['measure']} - {$row['program']}"; @@ -628,15 +628,15 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ if(strcmp("{$row['result']}", "PASS")!==0){ - $test_hash["{$row['measure']} - {$row['program']}"]=$row['result']; + $test_hash["{$row['program']}"]=$row['result']; } } mysql_free_result($program_query); - $query = "SELECT * FROM program WHERE night=$prev_id"; + $query = "SELECT * FROM program WHERE night=$prev_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - $test_key = "{$row['measure']} - {$row['program']}"; + $test_key = "{$row['program']}"; if(isset($test_hash[$test_key]) && strcmp($test_hash[$test_key], $row['result'])!==0){ $result .= $test_key . "
\n"; From jlaskey at apple.com Wed Aug 30 16:08:21 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 16:08:21 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302108.k7UL8LFO011863@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.15 -> 1.16 --- Log message: Debugging newly pass fail report attempt #7. --- Diffs of the changes: (+8 -6) ProgramResults.php | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.15 nightlytest-serverside/ProgramResults.php:1.16 --- nightlytest-serverside/ProgramResults.php:1.15 Wed Aug 30 16:00:05 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 16:08:06 2006 @@ -460,7 +460,7 @@ } mysql_free_result($program_query); - $query = "SELECT * FROM tests WHERE night=$cur_id"; + $query = "SELECT * FROM tests WHERE night=$cur_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['measure']} - {$row['program']}"; @@ -502,7 +502,7 @@ } mysql_free_result($program_query); - $query = "SELECT * FROM tests WHERE night=$prev_id"; + $query = "SELECT * FROM tests WHERE night=$prev_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['measure']} - {$row['program']}"; @@ -562,7 +562,7 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ if(strcmp("{$row['result']}", "PASS")!==0){ - $test_hash["{$row['measure']} - {$row['program']}"]=$row['result']; + $test_hash["{$row['program']}"]=$row['result']; } } mysql_free_result($program_query); @@ -570,10 +570,11 @@ $query = "SELECT * FROM program WHERE night=$cur_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - $test_key = "{$row['measure']} - {$row['program']}"; + $test_key = "{$row['program']}"; if(isset($test_hash[$test_key]) && strcmp($test_hash[$test_key], $row['result'])!==0){ - $result .= $test_key . "
\n"; + // $result .= $test_key . "
\n"; + $result .= $row['result'] . ":" . $test_key . "
\n"; } } mysql_free_result($program_query); @@ -639,7 +640,8 @@ $test_key = "{$row['program']}"; if(isset($test_hash[$test_key]) && strcmp($test_hash[$test_key], $row['result'])!==0){ - $result .= $test_key . "
\n"; + // $result .= $test_key . "
\n"; + $result .= $row['result'] . ":" . $test_key . "
\n"; } } mysql_free_result($program_query); From jlaskey at apple.com Wed Aug 30 16:20:15 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 16:20:15 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302120.k7ULKFts012120@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.16 -> 1.17 --- Log message: Debugging newly pass fail report attempt #8. --- Diffs of the changes: (+7 -11) ProgramResults.php | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.16 nightlytest-serverside/ProgramResults.php:1.17 --- nightlytest-serverside/ProgramResults.php:1.16 Wed Aug 30 16:08:06 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 16:20:01 2006 @@ -561,7 +561,7 @@ $query = "SELECT * FROM program WHERE night=$prev_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if(strcmp("{$row['result']}", "PASS")!==0){ + if("{$row['result']}" !~ \\*\){ $test_hash["{$row['program']}"]=$row['result']; } } @@ -571,10 +571,8 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['program']}"; - if(isset($test_hash[$test_key]) && - strcmp($test_hash[$test_key], $row['result'])!==0){ - // $result .= $test_key . "
\n"; - $result .= $row['result'] . ":" . $test_key . "
\n"; + if(isset($test_hash[$test_key]) && "{$row['result']}" =~ \\*\){ + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); @@ -628,8 +626,8 @@ $query = "SELECT * FROM program WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if(strcmp("{$row['result']}", "PASS")!==0){ - $test_hash["{$row['program']}"]=$row['result']; + if("{$row['result']}" =~ \\*\){ + $test_hash["{$row['program']}"]=1; } } mysql_free_result($program_query); @@ -638,10 +636,8 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['program']}"; - if(isset($test_hash[$test_key]) && - strcmp($test_hash[$test_key], $row['result'])!==0){ - // $result .= $test_key . "
\n"; - $result .= $row['result'] . ":" . $test_key . "
\n"; + if(isset($test_hash[$test_key]) && "{$row['result']}" !~ \\*\){ + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); From jlaskey at apple.com Wed Aug 30 16:29:46 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 16:29:46 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302129.k7ULTkg6012312@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.17 -> 1.18 --- Log message: Debugging newly pass fail report attempt #9. --- Diffs of the changes: (+4 -4) ProgramResults.php | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.17 nightlytest-serverside/ProgramResults.php:1.18 --- nightlytest-serverside/ProgramResults.php:1.17 Wed Aug 30 16:20:01 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 16:29:31 2006 @@ -561,7 +561,7 @@ $query = "SELECT * FROM program WHERE night=$prev_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if("{$row['result']}" !~ \\*\){ + if(strpos("{$row['result']}", "*") !== false) { $test_hash["{$row['program']}"]=$row['result']; } } @@ -571,7 +571,7 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['program']}"; - if(isset($test_hash[$test_key]) && "{$row['result']}" =~ \\*\){ + if(isset($test_hash[$test_key]) && strpos("{$row['result']}", "*") === false){ $result .= $test_key . "
\n"; } } @@ -626,7 +626,7 @@ $query = "SELECT * FROM program WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if("{$row['result']}" =~ \\*\){ + if(strpos("{$row['result']}", "*") === false) { $test_hash["{$row['program']}"]=1; } } @@ -636,7 +636,7 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['program']}"; - if(isset($test_hash[$test_key]) && "{$row['result']}" !~ \\*\){ + if(isset($test_hash[$test_key]) && strpos("{$row['result']}", "*") !== false){ $result .= $test_key . "
\n"; } } From jlaskey at apple.com Wed Aug 30 16:36:38 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 16:36:38 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302136.k7ULacVS012493@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.18 -> 1.19 --- Log message: Debugging newly pass fail report attempt #10. --- Diffs of the changes: (+2 -2) ProgramResults.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.18 nightlytest-serverside/ProgramResults.php:1.19 --- nightlytest-serverside/ProgramResults.php:1.18 Wed Aug 30 16:29:31 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 16:36:23 2006 @@ -561,7 +561,7 @@ $query = "SELECT * FROM program WHERE night=$prev_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if(strpos("{$row['result']}", "*") !== false) { + if(!(strpos("{$row['result']}", "*") === false)) { $test_hash["{$row['program']}"]=$row['result']; } } @@ -636,7 +636,7 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['program']}"; - if(isset($test_hash[$test_key]) && strpos("{$row['result']}", "*") !== false){ + if(isset($test_hash[$test_key]) && !(strpos("{$row['result']}", "*") === false)){ $result .= $test_key . "
\n"; } } From jlaskey at apple.com Wed Aug 30 16:39:05 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 16:39:05 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302139.k7ULd5Md012597@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.19 -> 1.20 --- Log message: Debugging newly pass fail report attempt #11. --- Diffs of the changes: (+2 -2) ProgramResults.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.19 nightlytest-serverside/ProgramResults.php:1.20 --- nightlytest-serverside/ProgramResults.php:1.19 Wed Aug 30 16:36:23 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 16:38:51 2006 @@ -507,7 +507,7 @@ while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['measure']} - {$row['program']}"; if(!isset($test_hash[$test_key])){ - $result .= $test_key . "
\n"; + $result .= "{$row['result']}" . ":" . $test_key . "
\n"; } } mysql_free_result($program_query); @@ -572,7 +572,7 @@ while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['program']}"; if(isset($test_hash[$test_key]) && strpos("{$row['result']}", "*") === false){ - $result .= $test_key . "
\n"; + $result .= "{$row['result']}" . ":" . $test_key . "
\n"; } } mysql_free_result($program_query); From jlaskey at apple.com Wed Aug 30 16:50:20 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 16:50:20 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302150.k7ULoKAJ012845@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.20 -> 1.21 --- Log message: Debugging newly pass fail report attempt #12. --- Diffs of the changes: (+11 -11) ProgramResults.php | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.20 nightlytest-serverside/ProgramResults.php:1.21 --- nightlytest-serverside/ProgramResults.php:1.20 Wed Aug 30 16:38:51 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 16:50:06 2006 @@ -507,7 +507,7 @@ while($row = mysql_fetch_array($program_query)){ $test_key = "{$row['measure']} - {$row['program']}"; if(!isset($test_hash[$test_key])){ - $result .= "{$row['result']}" . ":" . $test_key . "
\n"; + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); @@ -561,8 +561,8 @@ $query = "SELECT * FROM program WHERE night=$prev_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if(!(strpos("{$row['result']}", "*") === false)) { - $test_hash["{$row['program']}"]=$row['result']; + if(!(strpos($row['result'], "*") === false)) { + $test_hash[$row['program']]=$row['result']; } } mysql_free_result($program_query); @@ -570,9 +570,9 @@ $query = "SELECT * FROM program WHERE night=$cur_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - $test_key = "{$row['program']}"; - if(isset($test_hash[$test_key]) && strpos("{$row['result']}", "*") === false){ - $result .= "{$row['result']}" . ":" . $test_key . "
\n"; + $test_key = $row['program']; + if(isset($test_hash[$test_key]) && strpos($row['result'], "*") === false){ + $result .= $row['result'] . ":" . $test_key . "
\n"; } } mysql_free_result($program_query); @@ -626,8 +626,8 @@ $query = "SELECT * FROM program WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if(strpos("{$row['result']}", "*") === false) { - $test_hash["{$row['program']}"]=1; + if(strpos($row['result'], "*") === false) { + $test_hash[$row['program']]=1; } } mysql_free_result($program_query); @@ -635,9 +635,9 @@ $query = "SELECT * FROM program WHERE night=$prev_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - $test_key = "{$row['program']}"; - if(isset($test_hash[$test_key]) && !(strpos("{$row['result']}", "*") === false)){ - $result .= $test_key . "
\n"; + $test_key = $row['program']; + if(isset($test_hash[$test_key]) && !(strpos($row['result'], "*") === false)){ + $result .= $row['result'] . ":" . $test_key . "
\n"; } } mysql_free_result($program_query); From jlaskey at apple.com Wed Aug 30 16:55:09 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 16:55:09 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302155.k7ULt9DJ012972@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.21 -> 1.22 --- Log message: Debugging newly pass fail report attempt #13. --- Diffs of the changes: (+4 -4) ProgramResults.php | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.21 nightlytest-serverside/ProgramResults.php:1.22 --- nightlytest-serverside/ProgramResults.php:1.21 Wed Aug 30 16:50:06 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 16:54:55 2006 @@ -572,7 +572,7 @@ while($row = mysql_fetch_array($program_query)){ $test_key = $row['program']; if(isset($test_hash[$test_key]) && strpos($row['result'], "*") === false){ - $result .= $row['result'] . ":" . $test_key . "
\n"; + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); @@ -626,7 +626,7 @@ $query = "SELECT * FROM program WHERE night=$cur_id"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - if(strpos($row['result'], "*") === false) { + if(!(strpos($row['result'], "*") === false)) { $test_hash[$row['program']]=1; } } @@ -636,8 +636,8 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ $test_key = $row['program']; - if(isset($test_hash[$test_key]) && !(strpos($row['result'], "*") === false)){ - $result .= $row['result'] . ":" . $test_key . "
\n"; + if(isset($test_hash[$test_key]) && strpos($row['result'], "*") === false){ + $result .= $test_key . "
\n"; } } mysql_free_result($program_query); From jlaskey at apple.com Wed Aug 30 17:08:56 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 30 Aug 2006 17:08:56 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608302208.k7UM8uWJ013249@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.22 -> 1.23 --- Log message: New/Dropped/Pass/Fail working for llvm-test. --- Diffs of the changes: (+36 -0) ProgramResults.php | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.22 nightlytest-serverside/ProgramResults.php:1.23 --- nightlytest-serverside/ProgramResults.php:1.22 Wed Aug 30 16:54:55 2006 +++ nightlytest-serverside/ProgramResults.php Wed Aug 30 17:08:42 2006 @@ -469,6 +469,24 @@ } } mysql_free_result($program_query); + + $test_hash=array(); + $query = "SELECT * FROM program WHERE night=$prev_id"; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)){ + $test_hash[$row['program']]=1; + } + mysql_free_result($program_query); + + $query = "SELECT * FROM program WHERE night=$cur_id ORDER BY program ASC"; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)){ + $test_key = $row['program']; + if(!isset($test_hash[$test_key])){ + $result .= $test_key . "
\n"; + } + } + mysql_free_result($program_query); } return $result; } @@ -511,6 +529,24 @@ } } mysql_free_result($program_query); + + $test_hash=array(); + $query = "SELECT * FROM program WHERE night=$cur_id"; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)){ + $test_hash[$row['program']]=1; + } + mysql_free_result($program_query); + + $query = "SELECT * FROM program WHERE night=$prev_id ORDER BY program ASC"; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)){ + $test_key = $row['program']; + if(!isset($test_hash[$test_key])){ + $result .= $test_key . "
\n"; + } + } + mysql_free_result($program_query); } return $result; } From lattner at cs.uiuc.edu Wed Aug 30 18:02:43 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 30 Aug 2006 18:02:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200608302302.k7UN2hEK014163@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.172 -> 1.173 --- Log message: Fix a compiler crash bootstrapping llvm-gcc. --- Diffs of the changes: (+6 -2) LiveIntervalAnalysis.cpp | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.172 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.173 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.172 Tue Aug 29 18:18:15 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Aug 30 18:02:29 2006 @@ -570,7 +570,7 @@ else if (allocatableRegs_[reg]) { handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(reg)); for (const unsigned* AS = mri_->getAliasSet(reg); *AS; ++AS) - handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(*AS)); + handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(*AS), true); } } @@ -684,7 +684,11 @@ if (ValLR+1 != BLR) return false; DEBUG(std::cerr << "\nExtending: "; IntB.print(std::cerr, mri_)); - + + // We are about to delete CopyMI, so need to remove it as the 'instruction + // that defines this value #'. + IntB.setInstDefiningValNum(BValNo, ~0U); + // Okay, we can merge them. We need to insert a new liverange: // [ValLR.end, BLR.begin) of either value number, then we merge the // two value numbers. From lattner at cs.uiuc.edu Wed Aug 30 18:03:49 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 30 Aug 2006 18:03:49 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-08-30-CoallescerCrash.ll Message-ID: <200608302303.k7UN3nMv014236@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-08-30-CoallescerCrash.ll added (r1.1) --- Log message: Bugfix for recent coallescer crash --- Diffs of the changes: (+115 -0) 2006-08-30-CoallescerCrash.ll | 115 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 115 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2006-08-30-CoallescerCrash.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2006-08-30-CoallescerCrash.ll:1.1 *** /dev/null Wed Aug 30 18:03:45 2006 --- llvm/test/Regression/CodeGen/Generic/2006-08-30-CoallescerCrash.ll Wed Aug 30 18:03:35 2006 *************** *** 0 **** --- 1,115 ---- + ; RUN: llvm-as < %s | llc + + %struct.CUMULATIVE_ARGS = type { int, int, int, int, int, int, int, int, int, int, int, int, int, int } + %struct.VEC_edge = type { uint, uint, [1 x %struct.edge_def*] } + %struct._obstack_chunk = type { sbyte*, %struct._obstack_chunk*, [4 x sbyte] } + %struct.basic_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.tree_node*, %struct.VEC_edge*, %struct.VEC_edge*, %struct.bitmap_head_def*, %struct.bitmap_head_def*, sbyte*, %struct.loop*, [2 x %struct.et_node*], %struct.basic_block_def*, %struct.basic_block_def*, %struct.reorder_block_def*, %struct.bb_ann_d*, long, int, int, int, int } + %struct.bb_ann_d = type { %struct.tree_node*, ubyte, %struct.edge_prediction* } + %struct.bitmap_element_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, uint, [4 x uint] } + %struct.bitmap_head_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, uint, %struct.bitmap_obstack* } + %struct.bitmap_obstack = type { %struct.bitmap_element_def*, %struct.bitmap_head_def*, %struct.obstack } + %struct.cost_pair = type { %struct.iv_cand*, uint, %struct.bitmap_head_def* } + %struct.dataflow_d = type { %struct.varray_head_tag*, [2 x %struct.tree_node*] } + %struct.def_operand_ptr = type { %struct.tree_node** } + %struct.def_optype_d = type { uint, [1 x %struct.def_operand_ptr] } + %struct.edge_def = type { %struct.basic_block_def*, %struct.basic_block_def*, %struct.edge_def_insns, sbyte*, %struct.location_t*, int, int, long, uint } + %struct.edge_def_insns = type { %struct.rtx_def* } + %struct.edge_prediction = type { %struct.edge_prediction*, %struct.edge_def*, uint, int } + %struct.eh_status = type opaque + %struct.emit_status = type { int, int, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, int, %struct.location_t, int, ubyte*, %struct.rtx_def** } + %struct.et_node = type opaque + %struct.expr_status = type { int, int, int, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* } + %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.function*, int, int, int, int, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, ubyte, int, long, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.varray_head_tag*, %struct.temp_slot*, int, %struct.var_refs_queue*, int, int, %struct.rtvec_def*, %struct.tree_node*, int, int, int, %struct.machine_function*, uint, uint, bool, bool, %struct.language_function*, %struct.rtx_def*, uint, int, int, int, %struct.location_t, %struct.varray_head_tag*, %struct.tree_node*, ubyte, ubyte, ubyte } + %struct.htab = type { uint (sbyte*)*, int (sbyte*, sbyte*)*, void (sbyte*)*, sbyte**, uint, uint, uint, uint, uint, sbyte* (uint, uint)*, void (sbyte*)*, sbyte*, sbyte* (sbyte*, uint, uint)*, void (sbyte*, sbyte*)*, uint } + %struct.initial_value_struct = type opaque + %struct.iv = type { %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, bool, bool, uint } + %struct.iv_cand = type { uint, bool, uint, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.iv*, uint } + %struct.iv_use = type { uint, uint, %struct.iv*, %struct.tree_node*, %struct.tree_node**, %struct.bitmap_head_def*, uint, %struct.cost_pair*, %struct.iv_cand* } + %struct.ivopts_data = type { %struct.loop*, %struct.htab*, uint, %struct.version_info*, %struct.bitmap_head_def*, uint, %struct.varray_head_tag*, %struct.varray_head_tag*, %struct.bitmap_head_def*, bool } + %struct.lang_decl = type opaque + %struct.language_function = type opaque + %struct.location_t = type { sbyte*, int } + %struct.loop = type { int, %struct.basic_block_def*, %struct.basic_block_def*, %struct.basic_block_def*, %struct.lpt_decision, uint, uint, %struct.edge_def**, int, %struct.basic_block_def*, %struct.basic_block_def*, uint, %struct.edge_def**, int, %struct.edge_def**, int, %struct.simple_bitmap_def*, int, %struct.loop**, int, %struct.loop*, %struct.loop*, %struct.loop*, %struct.loop*, int, sbyte*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, int, %struct.tree_node*, %struct.tree_node*, %struct.nb_iter_bound*, %struct.edge_def*, bool } + %struct.lpt_decision = type { uint, uint } + %struct.machine_function = type { %struct.stack_local_entry*, sbyte*, %struct.rtx_def*, int, int, int, int, int } + %struct.nb_iter_bound = type { %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.nb_iter_bound* } + %struct.obstack = type { int, %struct._obstack_chunk*, sbyte*, sbyte*, sbyte*, int, int, %struct._obstack_chunk* (sbyte*, int)*, void (sbyte*, %struct._obstack_chunk*)*, sbyte*, ubyte } + %struct.reorder_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.basic_block_def*, %struct.basic_block_def*, %struct.basic_block_def*, int, int, int } + %struct.rtvec_def = type { int, [1 x %struct.rtx_def*] } + %struct.rtx_def = type { ushort, ubyte, ubyte, %struct.u } + %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* } + %struct.simple_bitmap_def = type { uint, uint, uint, [1 x ulong] } + %struct.stack_local_entry = type opaque + %struct.stmt_ann_d = type { %struct.tree_ann_common_d, ubyte, %struct.basic_block_def*, %struct.stmt_operands_d, %struct.dataflow_d*, %struct.bitmap_head_def*, uint } + %struct.stmt_operands_d = type { %struct.def_optype_d*, %struct.def_optype_d*, %struct.v_may_def_optype_d*, %struct.vuse_optype_d*, %struct.v_may_def_optype_d* } + %struct.temp_slot = type opaque + %struct.tree_ann_common_d = type { uint, sbyte*, %struct.tree_node* } + %struct.tree_ann_d = type { %struct.stmt_ann_d } + %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %struct.tree_ann_d*, ubyte, ubyte, ubyte, ubyte, ubyte } + %struct.tree_decl = type { %struct.tree_common, %struct.location_t, uint, %struct.tree_node*, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, uint, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, int, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, long, %struct.lang_decl* } + %struct.tree_decl_u1 = type { long } + %struct.tree_decl_u2 = type { %struct.function* } + %struct.tree_node = type { %struct.tree_decl } + %struct.u = type { [1 x long] } + %struct.v_def_use_operand_type_t = type { %struct.tree_node*, %struct.tree_node* } + %struct.v_may_def_optype_d = type { uint, [1 x %struct.v_def_use_operand_type_t] } + %struct.var_refs_queue = type { %struct.rtx_def*, uint, int, %struct.var_refs_queue* } + %struct.varasm_status = type opaque + %struct.varray_head_tag = type { uint, uint, uint, sbyte*, %struct.u } + %struct.version_info = type { %struct.tree_node*, %struct.iv*, bool, uint, bool } + %struct.vuse_optype_d = type { uint, [1 x %struct.tree_node*] } + + implementation ; Functions: + + bool %determine_use_iv_cost(%struct.ivopts_data* %data, %struct.iv_use* %use, %struct.iv_cand* %cand) { + entry: + switch uint 0, label %bb91 [ + uint 0, label %bb + uint 1, label %bb6 + uint 3, label %cond_next135 + ] + + bb: ; preds = %entry + ret bool false + + bb6: ; preds = %entry + br bool false, label %bb87, label %cond_next27 + + cond_next27: ; preds = %bb6 + br bool false, label %cond_true30, label %cond_next55 + + cond_true30: ; preds = %cond_next27 + br bool false, label %cond_next41, label %cond_true35 + + cond_true35: ; preds = %cond_true30 + ret bool false + + cond_next41: ; preds = %cond_true30 + %tmp44 = call uint %force_var_cost( %struct.ivopts_data* %data, %struct.tree_node* null, %struct.bitmap_head_def** null ) ; [#uses=2] + %tmp46 = div uint %tmp44, 5 ; [#uses=1] + call void %set_use_iv_cost( %struct.ivopts_data* %data, %struct.iv_use* %use, %struct.iv_cand* %cand, uint %tmp46, %struct.bitmap_head_def* null ) + %tmp44.off = add uint %tmp44, 4244967296 ; [#uses=1] + %tmp52 = setgt uint %tmp44.off, 4 ; [#uses=1] + %tmp52 = cast bool %tmp52 to int ; [#uses=1] + br label %bb87 + + cond_next55: ; preds = %cond_next27 + ret bool false + + bb87: ; preds = %cond_next41, %bb6 + %tmp2.0 = phi int [ %tmp52, %cond_next41 ], [ 1, %bb6 ] ; [#uses=0] + ret bool false + + bb91: ; preds = %entry + ret bool false + + cond_next135: ; preds = %entry + %tmp193 = call bool %determine_use_iv_cost_generic( %struct.ivopts_data* %data, %struct.iv_use* %use, %struct.iv_cand* %cand ) ; [#uses=0] + ret bool false + } + + declare void %set_use_iv_cost(%struct.ivopts_data*, %struct.iv_use*, %struct.iv_cand*, uint, %struct.bitmap_head_def*) + + declare uint %force_var_cost(%struct.ivopts_data*, %struct.tree_node*, %struct.bitmap_head_def**) + + declare bool %determine_use_iv_cost_generic(%struct.ivopts_data*, %struct.iv_use*, %struct.iv_cand*) From nicholas at mxc.ca Wed Aug 30 19:39:31 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 30 Aug 2006 19:39:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200608310039.k7V0dVjv015998@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.2 -> 1.3 --- Log message: Properties where both Values weren't in the union (as being equal to another Value) weren't being found by findProperties. This fixes predsimplify.ll test6, a missed optimization opportunity. --- Diffs of the changes: (+18 -24) PredicateSimplifier.cpp | 42 ++++++++++++++++++------------------------ 1 files changed, 18 insertions(+), 24 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.2 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.3 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.2 Tue Aug 29 21:46:48 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Aug 30 19:39:16 2006 @@ -121,21 +121,8 @@ void addNotEqual(Value *V1, Value *V2) { DEBUG(std::cerr << "not equal: " << *V1 << " and " << *V2 << "\n"); - V1 = canonicalize(V1); - V2 = canonicalize(V2); - - // Does the property already exist? - for (PropertyIterator I = Properties.begin(), E = Properties.end(); - I != E; ++I) { - if (I->Opcode != NE) continue; - - I->V1 = canonicalize(I->V1); - I->V2 = canonicalize(I->V2); - if ((I->V1 == V1 && I->V2 == V2) || - (I->V1 == V2 && I->V2 == V1)) { - return; // Found. - } - } + if (findProperty(NE, V1, V2) != Properties.end()) + return; // found. // Add the property. Properties.push_back(Property(NE, V1, V2)); @@ -146,9 +133,8 @@ assert(Opcode != EQ && "Can't findProperty on EQ." "Use the lookup method instead."); - V1 = lookup(V1); - V2 = lookup(V2); - if (!V1 || !V2) return Properties.end(); + V1 = canonicalize(V1); + V2 = canonicalize(V2); // Does the property already exist? for (PropertyIterator I = Properties.begin(), E = Properties.end(); @@ -170,18 +156,16 @@ assert(Opcode != EQ && "Can't findProperty on EQ." "Use the lookup method instead."); - V1 = lookup(V1); - V2 = lookup(V2); - if (!V1 || !V2) return Properties.end(); + V1 = canonicalize(V1); + V2 = canonicalize(V2); // Does the property already exist? for (ConstPropertyIterator I = Properties.begin(), E = Properties.end(); I != E; ++I) { if (I->Opcode != Opcode) continue; - Value *v1 = lookup(I->V1), - *v2 = lookup(I->V2); - if (!v1 || !v2) continue; + Value *v1 = canonicalize(I->V1), + *v2 = canonicalize(I->V2); if ((v1 == V1 && v2 == V2) || (v1 == V2 && v2 == V1)) { return I; // Found. @@ -291,6 +275,14 @@ public: void debug(std::ostream &os) const { + for (EquivalenceClasses::iterator I = union_find.begin(), + E = union_find.end(); I != E; ++I) { + if (!I->isLeader()) continue; + for (EquivalenceClasses::member_iterator MI = + union_find.member_begin(I); MI != union_find.member_end(); ++MI) + std::cerr << **MI << " "; + std::cerr << "\n--\n"; + } } std::vector Properties; @@ -571,8 +563,10 @@ PropertySet TrueProperties(KP), FalseProperties(KP); DEBUG(std::cerr << "true set:\n"); TrueProperties.addEqual(ConstantBool::True, Condition); + DEBUG(TrueProperties.debug(std::cerr)); DEBUG(std::cerr << "false set:\n"); FalseProperties.addEqual(ConstantBool::False, Condition); + DEBUG(FalseProperties.debug(std::cerr)); PropertySet KPcopy(KP); proceedToSuccessor(KP, TrueProperties, Node, DT->getNode(TrueDest)); From llvm at cs.uiuc.edu Wed Aug 30 19:40:42 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:40:42 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/ Message-ID: <200608310040.k7V0egu6016036@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:40:42 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:40:42 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/ Message-ID: <200608310040.k7V0egaZ016039@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:02 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:02 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/403.gcc/ Message-ID: <200608310041.k7V0f2jQ016083@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/403.gcc: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/403.gcc added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/462.libquantum/ Message-ID: <200608310041.k7V0f36N016104@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/462.libquantum: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/462.libquantum added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/429.mcf/ Message-ID: <200608310041.k7V0f3qB016086@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/429.mcf: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/429.mcf added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/483.xalancbmk/ Message-ID: <200608310041.k7V0f3Lf016124@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/483.xalancbmk: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/483.xalancbmk added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:02 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:02 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/401.bzip2/ Message-ID: <200608310041.k7V0f2TL016081@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/401.bzip2: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/401.bzip2 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/473.astar/ Message-ID: <200608310041.k7V0f3pK016119@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/473.astar: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/473.astar added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/445.gobmk/ Message-ID: <200608310041.k7V0f3De016091@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/445.gobmk: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/445.gobmk added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/456.hmmer/ Message-ID: <200608310041.k7V0f3Uw016096@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/456.hmmer: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/456.hmmer added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/464.h264ref/ Message-ID: <200608310041.k7V0f3mW016109@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/464.h264ref: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/464.h264ref added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/471.omnetpp/ Message-ID: <200608310041.k7V0f3xp016114@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/471.omnetpp: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/471.omnetpp added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:03 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:03 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/458.sjeng/ Message-ID: <200608310041.k7V0f3nY016101@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/458.sjeng: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/458.sjeng added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:41:02 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:41:02 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/400.perlbench/ Message-ID: <200608310041.k7V0f2h9016078@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/400.perlbench: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CINT2006/400.perlbench added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/410.bwaves/ Message-ID: <200608310042.k7V0gvTJ016200@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/410.bwaves: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/410.bwaves added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/416.gamess/ Message-ID: <200608310042.k7V0gvMC016203@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/416.gamess: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/416.gamess added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/433.milc/ Message-ID: <200608310042.k7V0gvIi016206@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/433.milc: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/433.milc added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/437.leslie3d/ Message-ID: <200608310042.k7V0gvhr016223@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/437.leslie3d: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/437.leslie3d added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/436.cactusADM/ Message-ID: <200608310042.k7V0gvlC016218@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/436.cactusADM: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/436.cactusADM added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/454.calculix/ Message-ID: <200608310042.k7V0gvWf016246@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/454.calculix: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/454.calculix added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/447.dealII/ Message-ID: <200608310042.k7V0gv45016231@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/447.dealII: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/447.dealII added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/444.namd/ Message-ID: <200608310042.k7V0gv2o016226@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/444.namd: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/444.namd added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/434.zeusmp/ Message-ID: <200608310042.k7V0gvc0016209@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/434.zeusmp: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/434.zeusmp added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/465.tonto/ Message-ID: <200608310042.k7V0gvvh016254@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/465.tonto: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/465.tonto added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/470.lbm/ Message-ID: <200608310042.k7V0gv5L016259@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/470.lbm: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/470.lbm added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/459.GemsFDTD/ Message-ID: <200608310042.k7V0gvNr016251@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/459.GemsFDTD: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/459.GemsFDTD added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/435.gromacs/ Message-ID: <200608310042.k7V0gv6K016213@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/435.gromacs: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/435.gromacs added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/450.soplex/ Message-ID: <200608310042.k7V0gv2D016236@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/450.soplex: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/450.soplex added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:57 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/453.povray/ Message-ID: <200608310042.k7V0gvO6016241@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/453.povray: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/453.povray added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:58 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:58 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/482.sphinx3/ Message-ID: <200608310042.k7V0gwcD016269@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/482.sphinx3: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/482.sphinx3 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From llvm at cs.uiuc.edu Wed Aug 30 19:42:58 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 30 Aug 2006 19:42:58 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/481.wrf/ Message-ID: <200608310042.k7V0gwCO016264@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/481.wrf: --- Log message: Directory /var/cvs/llvm/llvm-test/External/SPEC/CFP2006/481.wrf added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From nicholas at mxc.ca Wed Aug 30 22:13:19 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 30 Aug 2006 22:13:19 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg4.ll Message-ID: <200608310313.k7V3DJ3B018899@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: predsimplify.reg4.ll added (r1.1) --- Log message: This program crashes the PredicateSimplifier. Not marked XFAIL because the PredicateSimplifier is skipped in make check anyways. --- Diffs of the changes: (+36 -0) predsimplify.reg4.ll | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+) Index: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg4.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg4.ll:1.1 *** /dev/null Wed Aug 30 22:13:15 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.reg4.ll Wed Aug 30 22:13:05 2006 *************** *** 0 **** --- 1,36 ---- + ; RUN: llvm-as < %s | opt -predsimplify -disable-output + + ; ModuleID = '' + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + + implementation ; Functions: + + void %f(int %x, int %y) { + entry: + %tmp = seteq int %x, 10 ; [#uses=1] + %tmp.not = xor bool %tmp, true ; [#uses=1] + %tmp3 = seteq int %x, %y ; [#uses=1] + %bothcond = and bool %tmp.not, %tmp3 ; [#uses=1] + br bool %bothcond, label %cond_true4, label %return + + cond_true4: ; preds = %entry + switch int %y, label %return [ + int 9, label %bb + int 10, label %bb6 + ] + + bb: ; preds = %cond_true4 + call void %g( int 9 ) + ret void + + bb6: ; preds = %cond_true4 + call void %g( int 10 ) + ret void + + return: ; preds = %cond_true4, %entry + ret void + } + + declare void %g(int) From lattner at cs.uiuc.edu Wed Aug 30 23:26:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 30 Aug 2006 23:26:46 -0500 Subject: [llvm-commits] CVS: llvm/docs/FAQ.html Message-ID: <200608310426.k7V4QkHI020075@zion.cs.uiuc.edu> Changes in directory llvm/docs: FAQ.html updated: 1.39 -> 1.40 --- Log message: Add a note about C++ -> C with libstdc++ --- Diffs of the changes: (+12 -3) FAQ.html | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) Index: llvm/docs/FAQ.html diff -u llvm/docs/FAQ.html:1.39 llvm/docs/FAQ.html:1.40 --- llvm/docs/FAQ.html:1.39 Mon Aug 14 19:43:35 2006 +++ llvm/docs/FAQ.html Wed Aug 30 23:26:31 2006 @@ -541,8 +541,8 @@

or:

- llvm-g++ a.cpp -c - llvm-g++ b.cpp -c + llvm-g++ a.cpp -c
+ llvm-g++ b.cpp -c
llvm-g++ a.o b.o -o program
@@ -566,6 +566,15 @@ use setjmp/longjmp to implement exception support that is correct but relatively slow.

+ +

Also note: this specific sequence of commands won't work if you use a +function defined in the C++ runtime library (or any other C++ library). To +access an external C++ library, you must manually +compile libstdc++ to LLVM bytecode, statically link it into your program, then +use the commands above to convert the whole result into C code. Alternatively, +you can compile the libraries and your application into two different chunks +of C code and link them.

+ @@ -683,7 +692,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
- Last modified: $Date: 2006/08/15 00:43:35 $ + Last modified: $Date: 2006/08/31 04:26:31 $ From lattner at cs.uiuc.edu Thu Aug 31 00:55:00 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 31 Aug 2006 00:55:00 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp LiveIntervalAnalysis.cpp Message-ID: <200608310555.k7V5t0LN021445@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.33 -> 1.34 LiveIntervalAnalysis.cpp updated: 1.173 -> 1.174 --- Log message: avoid calling the virtual isMoveInstr method endlessly by caching its results. --- Diffs of the changes: (+73 -75) LiveInterval.cpp | 24 ++++----- LiveIntervalAnalysis.cpp | 124 +++++++++++++++++++++++------------------------ 2 files changed, 73 insertions(+), 75 deletions(-) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.33 llvm/lib/CodeGen/LiveInterval.cpp:1.34 --- llvm/lib/CodeGen/LiveInterval.cpp:1.33 Tue Aug 29 18:18:15 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Thu Aug 31 00:54:43 2006 @@ -280,7 +280,8 @@ /// the intervals are not joinable, this aborts. void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments, int *RHSValNoAssignments, - SmallVector &NewInstDefiningValue) { + SmallVector, 16> &NewValueNumberInfo) { // Try to do the least amount of work possible. In particular, if there are // more liverange chunks in the other set than there are in the 'this' set, @@ -300,7 +301,7 @@ // we want to avoid the interval scan if not. bool MustMapCurValNos = false; for (unsigned i = 0, e = getNumValNums(); i != e; ++i) { - if (InstDefiningValue[i] == ~2U) continue; // tombstone value # + if (ValueNumberInfo[i].first == ~2U) continue; // tombstone value # if (i != (unsigned)LHSValNoAssignments[i]) { MustMapCurValNos = true; break; @@ -345,9 +346,8 @@ InsertPos = addRangeFrom(*I, InsertPos); } - InstDefiningValue.clear(); - InstDefiningValue.append(NewInstDefiningValue.begin(), - NewInstDefiningValue.end()); + ValueNumberInfo.clear(); + ValueNumberInfo.append(NewValueNumberInfo.begin(), NewValueNumberInfo.end()); weight += Other.weight; } @@ -360,7 +360,7 @@ // Find a value # to use for the clobber ranges. If there is already a value# // for unknown values, use it. // FIXME: Use a single sentinal number for these! - unsigned ClobberValNo = getNextValue(~0U); + unsigned ClobberValNo = getNextValue(~0U, 0); iterator IP = begin(); for (const_iterator I = Clobbers.begin(), E = Clobbers.end(); I != E; ++I) { @@ -399,7 +399,7 @@ // Make sure V2 is smaller than V1. if (V1 < V2) { - setInstDefiningValNum(V1, getInstForValNum(V2)); + setValueNumberInfo(V1, getValNumInfo(V2)); std::swap(V1, V2); } @@ -443,10 +443,10 @@ // ~1U so it can be nuked later. if (V1 == getNumValNums()-1) { do { - InstDefiningValue.pop_back(); - } while (InstDefiningValue.back() == ~1U); + ValueNumberInfo.pop_back(); + } while (ValueNumberInfo.back().first == ~1U); } else { - InstDefiningValue[V1] = ~1U; + ValueNumberInfo[V1].first = ~1U; } } @@ -482,10 +482,10 @@ for (unsigned i = 0; i != getNumValNums(); ++i) { if (i) OS << " "; OS << i << "@"; - if (InstDefiningValue[i] == ~0U) { + if (ValueNumberInfo[i].first == ~0U) { OS << "?"; } else { - OS << InstDefiningValue[i]; + OS << ValueNumberInfo[i].first; } } } Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.173 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.174 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.173 Wed Aug 30 18:02:29 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Aug 31 00:54:43 2006 @@ -138,10 +138,10 @@ for (MachineFunction::livein_iterator I = fn.livein_begin(), E = fn.livein_end(); I != E; ++I) { handlePhysicalRegisterDef(Entry, Entry->begin(), - getOrCreateInterval(I->first), true); + getOrCreateInterval(I->first), 0); for (const unsigned* AS = mri_->getAliasSet(I->first); *AS; ++AS) handlePhysicalRegisterDef(Entry, Entry->begin(), - getOrCreateInterval(*AS), true); + getOrCreateInterval(*AS), 0); } } @@ -321,7 +321,7 @@ // the spill weight is now infinity as it // cannot be spilled again nI.weight = float(HUGE_VAL); - LiveRange LR(start, end, nI.getNextValue(~0U)); + LiveRange LR(start, end, nI.getNextValue(~0U, 0)); DEBUG(std::cerr << " +" << LR); nI.addRange(LR); added.push_back(&nI); @@ -366,7 +366,13 @@ // Get the Idx of the defining instructions. unsigned defIndex = getDefIndex(getInstructionIndex(mi)); - unsigned ValNum = interval.getNextValue(defIndex); + unsigned ValNum; + unsigned SrcReg, DstReg; + if (!tii_->isMoveInstr(*mi, SrcReg, DstReg)) + ValNum = interval.getNextValue(~0U, 0); + else + ValNum = interval.getNextValue(defIndex, SrcReg); + assert(ValNum == 0 && "First value in interval is not 0?"); ValNum = 0; // Clue in the optimizer. @@ -455,12 +461,13 @@ // that at this point, there should be exactly one value number in it. assert(interval.containsOneValue() && "Unexpected 2-addr liveint!"); - // The new value number is defined by the instruction we claimed defined - // value #0. - unsigned ValNo = interval.getNextValue(DefIndex); + // The new value number (#1) is defined by the instruction we claimed + // defined value #0. + unsigned ValNo = interval.getNextValue(0, 0); + interval.setValueNumberInfo(1, interval.getValNumInfo(0)); - // Value#1 is now defined by the 2-addr instruction. - interval.setInstDefiningValNum(0, RedefIndex); + // Value#0 is now defined by the 2-addr instruction. + interval.setValueNumberInfo(0, std::make_pair(~0U, 0U)); // Add the new live interval which replaces the range for the input copy. LiveRange LR(DefIndex, RedefIndex, ValNo); @@ -493,7 +500,7 @@ // Replace the interval with one of a NEW value number. Note that this // value number isn't actually defined by an instruction, weird huh? :) - LiveRange LR(Start, End, interval.getNextValue(~0U)); + LiveRange LR(Start, End, interval.getNextValue(~0U, 0)); DEBUG(std::cerr << " replace range with " << LR); interval.addRange(LR); DEBUG(std::cerr << "RESULT: "; interval.print(std::cerr, mri_)); @@ -503,9 +510,16 @@ // live until the end of the block. We've already taken care of the // rest of the live range. unsigned defIndex = getDefIndex(getInstructionIndex(mi)); + + unsigned ValNum; + unsigned SrcReg, DstReg; + if (!tii_->isMoveInstr(*mi, SrcReg, DstReg)) + ValNum = interval.getNextValue(~0U, 0); + else + ValNum = interval.getNextValue(defIndex, SrcReg); + LiveRange LR(defIndex, - getInstructionIndex(&mbb->back()) + InstrSlots::NUM, - interval.getNextValue(defIndex)); + getInstructionIndex(&mbb->back()) + InstrSlots::NUM, ValNum); interval.addRange(LR); DEBUG(std::cerr << " +" << LR); } @@ -516,8 +530,8 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock *MBB, MachineBasicBlock::iterator mi, - LiveInterval& interval, - bool isLiveIn) { + LiveInterval &interval, + unsigned SrcReg) { // A physical register cannot be live across basic block, so its // lifetime must end somewhere in its defining basic block. DEBUG(std::cerr << "\t\tregister: "; printRegName(interval.reg)); @@ -551,13 +565,14 @@ // The only case we should have a dead physreg here without a killing or // instruction where we know it's dead is if it is live-in to the function // and never used. - assert(isLiveIn && "physreg was not killed in defining block!"); + assert(!SrcReg && "physreg was not killed in defining block!"); end = getDefIndex(start) + 1; // It's dead. exit: assert(start < end && "did not find end of interval?"); - LiveRange LR(start, end, interval.getNextValue(isLiveIn ? ~0U : start)); + LiveRange LR(start, end, interval.getNextValue(SrcReg != 0 ? start : ~0U, + SrcReg)); interval.addRange(LR); DEBUG(std::cerr << " +" << LR << '\n'); } @@ -568,9 +583,12 @@ if (MRegisterInfo::isVirtualRegister(reg)) handleVirtualRegisterDef(MBB, MI, getOrCreateInterval(reg)); else if (allocatableRegs_[reg]) { - handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(reg)); + unsigned SrcReg, DstReg; + if (!tii_->isMoveInstr(*MI, SrcReg, DstReg)) + SrcReg = 0; + handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(reg), SrcReg); for (const unsigned* AS = mri_->getAliasSet(reg); *AS; ++AS) - handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(*AS), true); + handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(*AS), 0); } } @@ -652,24 +670,17 @@ // If AValNo is defined as a copy from IntB, we can potentially process this. // Get the instruction that defines this value number. - unsigned AValNoInstIdx = IntA.getInstForValNum(AValNo); - - // If it's unknown, ignore it. - if (AValNoInstIdx == ~0U || AValNoInstIdx == ~1U) return false; - // Otherwise, get the instruction for it. - MachineInstr *AValNoInstMI = getInstructionFromIndex(AValNoInstIdx); + unsigned SrcReg = IntA.getSrcRegForValNum(AValNo); + if (!SrcReg) return false; // Not defined by a copy. // If the value number is not defined by a copy instruction, ignore it. - unsigned SrcReg, DstReg; - if (!tii_->isMoveInstr(*AValNoInstMI, SrcReg, DstReg)) - return false; // If the source register comes from an interval other than IntB, we can't // handle this. - assert(rep(DstReg) == IntA.reg && "Not defining a reg in IntA?"); if (rep(SrcReg) != IntB.reg) return false; - + // Get the LiveRange in IntB that this value number starts with. + unsigned AValNoInstIdx = IntA.getInstForValNum(AValNo); LiveInterval::iterator ValLR = IntB.FindLiveRangeContaining(AValNoInstIdx-1); // Make sure that the end of the live range is inside the same block as @@ -687,7 +698,7 @@ // We are about to delete CopyMI, so need to remove it as the 'instruction // that defines this value #'. - IntB.setInstDefiningValNum(BValNo, ~0U); + IntB.setValueNumberInfo(BValNo, std::make_pair(~0U, 0)); // Okay, we can merge them. We need to insert a new liverange: // [ValLR.end, BLR.begin) of either value number, then we merge the @@ -701,7 +712,7 @@ for (const unsigned *AS = mri_->getAliasSet(IntB.reg); *AS; ++AS) { LiveInterval &AliasLI = getInterval(*AS); AliasLI.addRange(LiveRange(FillerStart, FillerEnd, - AliasLI.getNextValue(~0U))); + AliasLI.getNextValue(~0U, 0))); } } @@ -832,7 +843,8 @@ /// contains the value number the copy is from. /// static unsigned ComputeUltimateVN(unsigned VN, - SmallVector &InstDefiningValue, + SmallVector, 16> &ValueNumberInfo, SmallVector &ThisFromOther, SmallVector &OtherFromThis, SmallVector &ThisValNoAssignments, @@ -847,8 +859,8 @@ // number in the destination. int OtherValNo = ThisFromOther[VN]; if (OtherValNo == -1) { - InstDefiningValue.push_back(ThisLI.getInstForValNum(VN)); - return ThisValNoAssignments[VN] = InstDefiningValue.size()-1; + ValueNumberInfo.push_back(ThisLI.getValNumInfo(VN)); + return ThisValNoAssignments[VN] = ValueNumberInfo.size()-1; } // Otherwise, this *is* a copy from the RHS. Mark this value number as @@ -856,7 +868,7 @@ // value is. ThisValNoAssignments[VN] = -2; unsigned UltimateVN = - ComputeUltimateVN(OtherValNo, InstDefiningValue, + ComputeUltimateVN(OtherValNo, ValueNumberInfo, OtherFromThis, ThisFromOther, OtherValNoAssignments, ThisValNoAssignments, OtherLI, ThisLI); @@ -875,24 +887,17 @@ SmallVector LHSValsDefinedFromRHS; LHSValsDefinedFromRHS.resize(LHS.getNumValNums(), -1); for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { - unsigned ValInst = LHS.getInstForValNum(VN); - if (ValInst == ~0U || ValInst == ~1U) - continue; - - // If the instruction defining the LHS's value is a copy. - MachineInstr *ValInstMI = getInstructionFromIndex(ValInst); - - // If the value number is not defined by a copy instruction, ignore it. - unsigned SrcReg, DstReg; - if (!tii_->isMoveInstr(*ValInstMI, SrcReg, DstReg)) + unsigned ValSrcReg = LHS.getSrcRegForValNum(VN); + if (ValSrcReg == 0) // Src not defined by a copy? continue; - + // DstReg is known to be a register in the LHS interval. If the src is from // the RHS interval, we can use its value #. - if (rep(SrcReg) != RHS.reg) + if (rep(ValSrcReg) != RHS.reg) continue; - + // Figure out the value # from the RHS. + unsigned ValInst = LHS.getInstForValNum(VN); LHSValsDefinedFromRHS[VN] = RHS.getLiveRangeContaining(ValInst-1)->ValId; } @@ -901,24 +906,17 @@ SmallVector RHSValsDefinedFromLHS; RHSValsDefinedFromLHS.resize(RHS.getNumValNums(), -1); for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { - unsigned ValInst = RHS.getInstForValNum(VN); - if (ValInst == ~0U || ValInst == ~1U) - continue; - - // If the instruction defining the RHS's value is a copy. - MachineInstr *ValInstMI = getInstructionFromIndex(ValInst); - - // If the value number is not defined by a copy instruction, ignore it. - unsigned SrcReg, DstReg; - if (!tii_->isMoveInstr(*ValInstMI, SrcReg, DstReg)) + unsigned ValSrcReg = RHS.getSrcRegForValNum(VN); + if (ValSrcReg == 0) // Src not defined by a copy? continue; // DstReg is known to be a register in the RHS interval. If the src is from // the LHS interval, we can use its value #. - if (rep(SrcReg) != LHS.reg) + if (rep(ValSrcReg) != LHS.reg) continue; // Figure out the value # from the LHS. + unsigned ValInst = RHS.getInstForValNum(VN); RHSValsDefinedFromLHS[VN] = LHS.getLiveRangeContaining(ValInst-1)->ValId; } @@ -926,20 +924,20 @@ // assuming that the live ranges can be coallesced. SmallVector LHSValNoAssignments; SmallVector RHSValNoAssignments; - SmallVector InstDefiningValue; + SmallVector, 16> ValueNumberInfo; LHSValNoAssignments.resize(LHS.getNumValNums(), -1); RHSValNoAssignments.resize(RHS.getNumValNums(), -1); // Compute ultimate value numbers for the LHS and RHS values. for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { if (LHS.getInstForValNum(VN) == ~2U) continue; - ComputeUltimateVN(VN, InstDefiningValue, + ComputeUltimateVN(VN, ValueNumberInfo, LHSValsDefinedFromRHS, RHSValsDefinedFromLHS, LHSValNoAssignments, RHSValNoAssignments, LHS, RHS); } for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { if (RHS.getInstForValNum(VN) == ~2U) continue; - ComputeUltimateVN(VN, InstDefiningValue, + ComputeUltimateVN(VN, ValueNumberInfo, RHSValsDefinedFromLHS, LHSValsDefinedFromRHS, RHSValNoAssignments, LHSValNoAssignments, RHS, LHS); } @@ -989,7 +987,7 @@ // If we get here, we know that we can coallesce the live ranges. Ask the // intervals to coallesce themselves now. LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0], - InstDefiningValue); + ValueNumberInfo); return true; } From lattner at cs.uiuc.edu Thu Aug 31 00:55:00 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 31 Aug 2006 00:55:00 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveInterval.h LiveIntervalAnalysis.h Message-ID: <200608310555.k7V5t0Lo021452@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveInterval.h updated: 1.22 -> 1.23 LiveIntervalAnalysis.h updated: 1.55 -> 1.56 --- Log message: avoid calling the virtual isMoveInstr method endlessly by caching its results. --- Diffs of the changes: (+34 -19) LiveInterval.h | 49 ++++++++++++++++++++++++++++++++----------------- LiveIntervalAnalysis.h | 4 ++-- 2 files changed, 34 insertions(+), 19 deletions(-) Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.22 llvm/include/llvm/CodeGen/LiveInterval.h:1.23 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.22 Tue Aug 29 18:17:59 2006 +++ llvm/include/llvm/CodeGen/LiveInterval.h Thu Aug 31 00:54:43 2006 @@ -78,10 +78,12 @@ float weight; // weight of this interval Ranges ranges; // the ranges in which this register is live private: - /// InstDefiningValue - This tracks the def index of the instruction that - /// defines a particular value number in the interval. This may be ~0, - /// which is treated as unknown, or ~1, which is a deleted value number. - SmallVector InstDefiningValue; + /// ValueNumberInfo - If this value number is not defined by a copy, this + /// holds ~0,x. If the value number is not in use, it contains ~1,x to + /// indicate that the value # is not used. If the val# is defined by a + /// copy, the first entry is the instruction # of the copy, and the second + /// is the register number copied from. + SmallVector, 4> ValueNumberInfo; public: LiveInterval(unsigned Reg, float Weight) @@ -113,31 +115,44 @@ std::swap(reg, other.reg); std::swap(weight, other.weight); std::swap(ranges, other.ranges); - std::swap(InstDefiningValue, other.InstDefiningValue); + std::swap(ValueNumberInfo, other.ValueNumberInfo); } - bool containsOneValue() const { return InstDefiningValue.size() == 1; } + bool containsOneValue() const { return ValueNumberInfo.size() == 1; } - unsigned getNumValNums() const { return InstDefiningValue.size(); } + unsigned getNumValNums() const { return ValueNumberInfo.size(); } /// getNextValue - Create a new value number and return it. MIIdx specifies /// the instruction that defines the value number. - unsigned getNextValue(unsigned MIIdx) { - InstDefiningValue.push_back(MIIdx); - return InstDefiningValue.size()-1; + unsigned getNextValue(unsigned MIIdx, unsigned SrcReg) { + ValueNumberInfo.push_back(std::make_pair(MIIdx, SrcReg)); + return ValueNumberInfo.size()-1; } /// getInstForValNum - Return the machine instruction index that defines the /// specified value number. unsigned getInstForValNum(unsigned ValNo) const { - assert(ValNo < InstDefiningValue.size()); - return InstDefiningValue[ValNo]; + assert(ValNo < ValueNumberInfo.size()); + return ValueNumberInfo[ValNo].first; } - /// setInstDefiningValNum - Change the instruction defining the specified - /// value number to the specified instruction. - void setInstDefiningValNum(unsigned ValNo, unsigned MIIdx) { - InstDefiningValue[ValNo] = MIIdx; + unsigned getSrcRegForValNum(unsigned ValNo) const { + assert(ValNo < ValueNumberInfo.size()); + if (ValueNumberInfo[ValNo].first < ~2U) + return ValueNumberInfo[ValNo].second; + return 0; + } + + std::pair getValNumInfo(unsigned ValNo) const { + assert(ValNo < ValueNumberInfo.size()); + return ValueNumberInfo[ValNo]; + } + + /// setValueNumberInfo - Change the value number info for the specified + /// value number. + void setValueNumberInfo(unsigned ValNo, + const std::pair &I){ + ValueNumberInfo[ValNo] = I; } /// MergeValueNumberInto - This method is called when two value nubmers @@ -216,7 +231,7 @@ /// the intervals are not joinable, this aborts. void join(LiveInterval &Other, int *ValNoAssignments, int *RHSValNoAssignments, - SmallVector &NewInstDefiningValue); + SmallVector,16> &NewValueNumberInfo); /// removeRange - Remove the specified range from this interval. Note that Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.55 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.56 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.55 Tue Aug 29 18:17:59 2006 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Thu Aug 31 00:54:43 2006 @@ -198,8 +198,8 @@ /// def. void handlePhysicalRegisterDef(MachineBasicBlock* mbb, MachineBasicBlock::iterator mi, - LiveInterval& interval, - bool isLiveIn = false); + LiveInterval &interval, + unsigned SrcReg); /// Return true if the two specified registers belong to different /// register classes. The registers may be either phys or virt regs. From lattner at cs.uiuc.edu Thu Aug 31 00:59:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 31 Aug 2006 00:59:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200608310559.k7V5xDhu021551@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.174 -> 1.175 --- Log message: Delete copies as they are coallesced instead of waiting until the end. --- Diffs of the changes: (+4 -0) LiveIntervalAnalysis.cpp | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.174 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.175 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.174 Thu Aug 31 00:54:43 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Aug 31 00:58:59 2006 @@ -823,6 +823,10 @@ r2iMap_.erase(SrcReg); r2rMap_[SrcReg] = DstReg; + // Finally, delete the copy instruction. + RemoveMachineInstrFromMaps(CopyMI); + CopyMI->eraseFromParent(); + ++numPeep; ++numJoins; return true; } From lattner at cs.uiuc.edu Thu Aug 31 01:48:40 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 31 Aug 2006 01:48:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200608310648.k7V6meFP022327@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.175 -> 1.176 --- Log message: Add a special case that speeds up coallescing a bit, but not enough. --- Diffs of the changes: (+107 -51) LiveIntervalAnalysis.cpp | 158 +++++++++++++++++++++++++++++++---------------- 1 files changed, 107 insertions(+), 51 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.175 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.176 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.175 Thu Aug 31 00:58:59 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Aug 31 01:48:26 2006 @@ -886,46 +886,8 @@ /// "RHS" will not have been modified, so we can use this information /// below to update aliases. bool LiveIntervals::JoinIntervals(LiveInterval &LHS, LiveInterval &RHS) { - // Loop over the value numbers of the LHS, seeing if any are defined from the - // RHS. - SmallVector LHSValsDefinedFromRHS; - LHSValsDefinedFromRHS.resize(LHS.getNumValNums(), -1); - for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { - unsigned ValSrcReg = LHS.getSrcRegForValNum(VN); - if (ValSrcReg == 0) // Src not defined by a copy? - continue; - - // DstReg is known to be a register in the LHS interval. If the src is from - // the RHS interval, we can use its value #. - if (rep(ValSrcReg) != RHS.reg) - continue; - - // Figure out the value # from the RHS. - unsigned ValInst = LHS.getInstForValNum(VN); - LHSValsDefinedFromRHS[VN] = RHS.getLiveRangeContaining(ValInst-1)->ValId; - } - - // Loop over the value numbers of the RHS, seeing if any are defined from the - // LHS. - SmallVector RHSValsDefinedFromLHS; - RHSValsDefinedFromLHS.resize(RHS.getNumValNums(), -1); - for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { - unsigned ValSrcReg = RHS.getSrcRegForValNum(VN); - if (ValSrcReg == 0) // Src not defined by a copy? - continue; - - // DstReg is known to be a register in the RHS interval. If the src is from - // the LHS interval, we can use its value #. - if (rep(ValSrcReg) != LHS.reg) - continue; - - // Figure out the value # from the LHS. - unsigned ValInst = RHS.getInstForValNum(VN); - RHSValsDefinedFromLHS[VN] = LHS.getLiveRangeContaining(ValInst-1)->ValId; - } - - // Now that we know the value mapping, compute the final value assignment, - // assuming that the live ranges can be coallesced. + // Compute the final value assignment, assuming that the live ranges can be + // coallesced. SmallVector LHSValNoAssignments; SmallVector RHSValNoAssignments; SmallVector, 16> ValueNumberInfo; @@ -933,17 +895,111 @@ RHSValNoAssignments.resize(RHS.getNumValNums(), -1); // Compute ultimate value numbers for the LHS and RHS values. - for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { - if (LHS.getInstForValNum(VN) == ~2U) continue; - ComputeUltimateVN(VN, ValueNumberInfo, - LHSValsDefinedFromRHS, RHSValsDefinedFromLHS, - LHSValNoAssignments, RHSValNoAssignments, LHS, RHS); - } - for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { - if (RHS.getInstForValNum(VN) == ~2U) continue; - ComputeUltimateVN(VN, ValueNumberInfo, - RHSValsDefinedFromLHS, LHSValsDefinedFromRHS, - RHSValNoAssignments, LHSValNoAssignments, RHS, LHS); + if (RHS.containsOneValue()) { + // Copies from a liveinterval with a single value are simple to handle and + // very common, handle the special case here. This is important, because + // often RHS is small and LHS is large (e.g. a physreg). + + // Find out if the RHS is defined as a copy from some value in the LHS. + int RHSValID = -1; + std::pair RHSValNoInfo; + if (unsigned RHSSrcReg = RHS.getSrcRegForValNum(0)) { + if (rep(RHSSrcReg) != LHS.reg) { + RHSValNoInfo = RHS.getValNumInfo(0); + } else { + // It was defined as a copy from the LHS, find out what value # it is. + unsigned ValInst = RHS.getInstForValNum(0); + RHSValID = LHS.getLiveRangeContaining(ValInst-1)->ValId; + RHSValNoInfo = LHS.getValNumInfo(RHSValID); + } + } else { + RHSValNoInfo = RHS.getValNumInfo(0); + } + + ValueNumberInfo.resize(LHS.getNumValNums()); + + // Okay, *all* of the values in LHS that are defined as a copy from RHS + // should now get updated. + for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { + if (unsigned LHSSrcReg = LHS.getSrcRegForValNum(VN)) { + if (rep(LHSSrcReg) != RHS.reg) { + // If this is not a copy from the RHS, its value number will be + // unmodified by the coallescing. + ValueNumberInfo[VN] = LHS.getValNumInfo(VN); + LHSValNoAssignments[VN] = VN; + } else if (RHSValID == -1) { + // Otherwise, it is a copy from the RHS, and we don't already have a + // value# for it. Keep the current value number, but remember it. + LHSValNoAssignments[VN] = RHSValID = VN; + ValueNumberInfo[VN] = RHSValNoInfo; + } else { + // Otherwise, use the specified value #. + LHSValNoAssignments[VN] = RHSValID; + if (VN != (unsigned)RHSValID) + ValueNumberInfo[VN].first = ~1U; + else + ValueNumberInfo[VN] = RHSValNoInfo; + } + } else { + ValueNumberInfo[VN] = LHS.getValNumInfo(VN); + LHSValNoAssignments[VN] = VN; + } + } + + assert(RHSValID != -1 && "Didn't find value #?"); + RHSValNoAssignments[0] = RHSValID; + + } else { + // Loop over the value numbers of the LHS, seeing if any are defined from the + // RHS. + SmallVector LHSValsDefinedFromRHS; + LHSValsDefinedFromRHS.resize(LHS.getNumValNums(), -1); + for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { + unsigned ValSrcReg = LHS.getSrcRegForValNum(VN); + if (ValSrcReg == 0) // Src not defined by a copy? + continue; + + // DstReg is known to be a register in the LHS interval. If the src is from + // the RHS interval, we can use its value #. + if (rep(ValSrcReg) != RHS.reg) + continue; + + // Figure out the value # from the RHS. + unsigned ValInst = LHS.getInstForValNum(VN); + LHSValsDefinedFromRHS[VN] = RHS.getLiveRangeContaining(ValInst-1)->ValId; + } + + // Loop over the value numbers of the RHS, seeing if any are defined from the + // LHS. + SmallVector RHSValsDefinedFromLHS; + RHSValsDefinedFromLHS.resize(RHS.getNumValNums(), -1); + for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { + unsigned ValSrcReg = RHS.getSrcRegForValNum(VN); + if (ValSrcReg == 0) // Src not defined by a copy? + continue; + + // DstReg is known to be a register in the RHS interval. If the src is from + // the LHS interval, we can use its value #. + if (rep(ValSrcReg) != LHS.reg) + continue; + + // Figure out the value # from the LHS. + unsigned ValInst = RHS.getInstForValNum(VN); + RHSValsDefinedFromLHS[VN] = LHS.getLiveRangeContaining(ValInst-1)->ValId; + } + + for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { + if (LHS.getInstForValNum(VN) == ~2U) continue; + ComputeUltimateVN(VN, ValueNumberInfo, + LHSValsDefinedFromRHS, RHSValsDefinedFromLHS, + LHSValNoAssignments, RHSValNoAssignments, LHS, RHS); + } + for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { + if (RHS.getInstForValNum(VN) == ~2U) continue; + ComputeUltimateVN(VN, ValueNumberInfo, + RHSValsDefinedFromLHS, LHSValsDefinedFromRHS, + RHSValNoAssignments, LHSValNoAssignments, RHS, LHS); + } } // Armed with the mappings of LHS/RHS values to ultimate values, walk the From evan.cheng at apple.com Thu Aug 31 02:41:31 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 31 Aug 2006 02:41:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200608310741.k7V7fVdC031307@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.184 -> 1.185 --- Log message: DAG combiner fix for rotates. Previously the outer-most condition checks for ROTL availability. This prevents it from forming ROTR for targets that has ROTR only. --- Diffs of the changes: (+44 -27) DAGCombiner.cpp | 71 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 44 insertions(+), 27 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.184 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.185 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.184 Tue Aug 29 01:42:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Aug 31 02:41:12 2006 @@ -1160,35 +1160,52 @@ // check for rotl, rotr if (N0.getOpcode() == ISD::SHL && N1.getOpcode() == ISD::SRL && N0.getOperand(0) == N1.getOperand(0) && - TLI.isOperationLegal(ISD::ROTL, VT) && TLI.isTypeLegal(VT)) { - // fold (or (shl x, C1), (srl x, C2)) -> (rotl x, C1) - if (N0.getOperand(1).getOpcode() == ISD::Constant && - N1.getOperand(1).getOpcode() == ISD::Constant) { - uint64_t c1val = cast(N0.getOperand(1))->getValue(); - uint64_t c2val = cast(N1.getOperand(1))->getValue(); - if ((c1val + c2val) == OpSizeInBits) - return DAG.getNode(ISD::ROTL, VT, N0.getOperand(0), N0.getOperand(1)); - } - // fold (or (shl x, y), (srl x, (sub 32, y))) -> (rotl x, y) - if (N1.getOperand(1).getOpcode() == ISD::SUB && - N0.getOperand(1) == N1.getOperand(1).getOperand(1)) - if (ConstantSDNode *SUBC = - dyn_cast(N1.getOperand(1).getOperand(0))) - if (SUBC->getValue() == OpSizeInBits) - return DAG.getNode(ISD::ROTL, VT, N0.getOperand(0), N0.getOperand(1)); - // fold (or (shl x, (sub 32, y)), (srl x, r)) -> (rotr x, y) - if (N0.getOperand(1).getOpcode() == ISD::SUB && - N1.getOperand(1) == N0.getOperand(1).getOperand(1)) - if (ConstantSDNode *SUBC = - dyn_cast(N0.getOperand(1).getOperand(0))) - if (SUBC->getValue() == OpSizeInBits) { - if (TLI.isOperationLegal(ISD::ROTR, VT) && TLI.isTypeLegal(VT)) - return DAG.getNode(ISD::ROTR, VT, N0.getOperand(0), - N1.getOperand(1)); - else + TLI.isTypeLegal(VT)) { + bool HasROTL = TLI.isOperationLegal(ISD::ROTL, VT); + bool HasROTR = TLI.isOperationLegal(ISD::ROTR, VT); + if (HasROTL || HasROTR) { + // fold (or (shl x, C1), (srl x, C2)) -> (rotl x, C1) + // fold (or (shl x, C1), (srl x, C2)) -> (rotr x, C2) + if (N0.getOperand(1).getOpcode() == ISD::Constant && + N1.getOperand(1).getOpcode() == ISD::Constant) { + uint64_t c1val = cast(N0.getOperand(1))->getValue(); + uint64_t c2val = cast(N1.getOperand(1))->getValue(); + if ((c1val + c2val) == OpSizeInBits) + if (HasROTL) return DAG.getNode(ISD::ROTL, VT, N0.getOperand(0), N0.getOperand(1)); - } + else + return DAG.getNode(ISD::ROTR, VT, N0.getOperand(0), + N1.getOperand(1)); + + } + // fold (or (shl x, y), (srl x, (sub 32, y))) -> (rotl x, y) + // fold (or (shl x, y), (srl x, (sub 32, y))) -> (rotr x, (sub 32, y)) + if (N1.getOperand(1).getOpcode() == ISD::SUB && + N0.getOperand(1) == N1.getOperand(1).getOperand(1)) + if (ConstantSDNode *SUBC = + dyn_cast(N1.getOperand(1).getOperand(0))) + if (SUBC->getValue() == OpSizeInBits) + if (HasROTL) + return DAG.getNode(ISD::ROTL, VT, N0.getOperand(0), + N0.getOperand(1)); + else + return DAG.getNode(ISD::ROTR, VT, N0.getOperand(0), + N1.getOperand(1)); + // fold (or (shl x, (sub 32, y)), (srl x, r)) -> (rotr x, y) + // fold (or (shl x, (sub 32, y)), (srl x, r)) -> (rotl x, (sub 32, y)) + if (N0.getOperand(1).getOpcode() == ISD::SUB && + N1.getOperand(1) == N0.getOperand(1).getOperand(1)) + if (ConstantSDNode *SUBC = + dyn_cast(N0.getOperand(1).getOperand(0))) + if (SUBC->getValue() == OpSizeInBits) + if (HasROTR) + return DAG.getNode(ISD::ROTR, VT, N0.getOperand(0), + N1.getOperand(1)); + else + return DAG.getNode(ISD::ROTL, VT, N0.getOperand(0), + N0.getOperand(1)); + } } return SDOperand(); } From jlaskey at apple.com Thu Aug 31 10:40:50 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 10:40:50 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608311540.k7VFeoEq014865@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.23 -> 1.24 --- Log message: Refactor New/Drop test code. --- Diffs of the changes: (+56 -81) ProgramResults.php | 137 +++++++++++++++++++++-------------------------------- 1 files changed, 56 insertions(+), 81 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.23 nightlytest-serverside/ProgramResults.php:1.24 --- nightlytest-serverside/ProgramResults.php:1.23 Wed Aug 30 17:08:42 2006 +++ nightlytest-serverside/ProgramResults.php Thu Aug 31 10:40:30 2006 @@ -29,6 +29,8 @@ $large_decrease="#90FF90"; $crazy_decrease="#20FF20"; +$new_schema_id = 684; + $category_match=array("GCCAS","Bytecode","LLC\compile", "LLC-BETA\compile","JIT\codegen","GCC", "CBE","LLC","LLC-BETA","JIT","GCC\/\CBE", @@ -393,7 +395,7 @@ */ function getFailures($night_id, $mysql_link){ $result=""; - if($night_id>=684){ + if($night_id>=$new_schema_id){ $query = "SELECT * FROM tests WHERE night=$night_id AND result=\"FAIL\" AND measure!=\"dejagnu\""; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ @@ -412,7 +414,7 @@ */ function getUnexpectedFailures($night_id, $mysql_link){ $result=""; - if($night_id<684){ + if($night_id<$new_schema_id){ $query = "SELECT unexpfail_tests FROM night WHERE id = $night_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); @@ -432,61 +434,65 @@ } /* + * Get set Of tests + * + * Returns a hash of tests for a given night. + */ +function getTestSet($id, $table){ + $test_hash = array(); + $query = "SELECT * FROM $table WHERE night=$id"; + $program_query = mysql_query($query) or die (mysql_error()); + while ($row = mysql_fetch_array($program_query)) { + $test_hash[$row['program']]=1; + } + mysql_free_result($program_query); + return $test_hash; +} + +/* + * Get list of excluded tests + * + * Returns a hash of tests for a given night. + */ +function getExcludedTests($id, $table, $test_hash){ + $result = ""; + $query = "SELECT * FROM $table WHERE night=$id ORDER BY program ASC"; + $program_query = mysql_query($query) or die (mysql_error()); + while ($row = mysql_fetch_array($program_query)) { + $test_key = $row['program']; + if (!isset($test_hash[$test_key])) { + $result .= $test_key . "
\n"; + } + } + mysql_free_result($program_query); + return $result; +} + +/* * Get New Tests * * This is somewhat of a hack because from night 684 forward we now store the test * in their own table as opposed in the night table. */ function getNewTests($cur_id, $prev_id, $mysql_link){ - if(strcmp($prev_id, "")===0 || strcmp($cur_id, "")===0){ + if (strcmp($prev_id, "") === 0 || strcmp($cur_id, "") === 0) { return ""; } $result=""; - if($cur_id<684){ + if($cur_id<$new_schema_id){ $query = "SELECT new_tests FROM night WHERE id = $cur_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); $result= $row['new_tests']; $result=preg_replace("/\n/","
\n",$result); mysql_free_result($program_query); - } - else{ - $test_hash=array(); - $query = "SELECT * FROM tests WHERE night=$prev_id"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_hash["{$row['measure']} - {$row['program']}"]=1; - } - mysql_free_result($program_query); - - $query = "SELECT * FROM tests WHERE night=$cur_id ORDER BY program ASC"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_key = "{$row['measure']} - {$row['program']}"; - if(!isset($test_hash[$test_key])){ - $result .= $test_key . "
\n"; - } - } - mysql_free_result($program_query); - - $test_hash=array(); - $query = "SELECT * FROM program WHERE night=$prev_id"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_hash[$row['program']]=1; - } - mysql_free_result($program_query); - - $query = "SELECT * FROM program WHERE night=$cur_id ORDER BY program ASC"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_key = $row['program']; - if(!isset($test_hash[$test_key])){ - $result .= $test_key . "
\n"; - } - } - mysql_free_result($program_query); + } else { + $test_hash = getTestSet($prev_id, "tests"); + $result .= getExcludedTests($cur_id, "tests", $test_hash); + + $test_hash = getTestSet($prev_id, "program"); + $result .= getExcludedTests($cur_id, "program", $test_hash); } return $result; } @@ -503,50 +509,19 @@ } $result=""; - if($cur_id<684){ + if($cur_id<$new_schema_id){ $query = "SELECT removed_tests FROM night WHERE id = $cur_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); $result= $row['removed_tests']; $result=preg_replace("/\n/","
\n",$result); mysql_free_result($program_query); - } - else{ - $test_hash=array(); - $query = "SELECT * FROM tests WHERE night=$cur_id"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_hash["{$row['measure']} - {$row['program']}"]=1; - } - mysql_free_result($program_query); - - $query = "SELECT * FROM tests WHERE night=$prev_id ORDER BY program ASC"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_key = "{$row['measure']} - {$row['program']}"; - if(!isset($test_hash[$test_key])){ - $result .= $test_key . "
\n"; - } - } - mysql_free_result($program_query); - - $test_hash=array(); - $query = "SELECT * FROM program WHERE night=$cur_id"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_hash[$row['program']]=1; - } - mysql_free_result($program_query); - - $query = "SELECT * FROM program WHERE night=$prev_id ORDER BY program ASC"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_key = $row['program']; - if(!isset($test_hash[$test_key])){ - $result .= $test_key . "
\n"; - } - } - mysql_free_result($program_query); + } else { + $test_hash = getTestSet($cur_id, "tests"); + $result .= getExcludedTests($prev_id, "tests", $test_hash); + + $test_hash = getTestSet($cur_id, "program"); + $result .= getExcludedTests($prev_id, "program", $test_hash); } return $result; } @@ -563,7 +538,7 @@ } $result=""; - if($cur_id<684){ + if($cur_id<$new_schema_id){ $query = "SELECT newly_passing_tests FROM night WHERE id = $cur_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); @@ -628,7 +603,7 @@ } $result=""; - if($cur_id<684){ + if($cur_id<$new_schema_id){ $query = "SELECT newly_failing_tests FROM night WHERE id = $cur_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); From jlaskey at apple.com Thu Aug 31 11:33:52 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 11:33:52 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608311633.k7VGXqjr015884@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.24 -> 1.25 --- Log message: Refactor newly passing/failing tests. --- Diffs of the changes: (+75 -97) ProgramResults.php | 172 +++++++++++++++++++++++------------------------------ 1 files changed, 75 insertions(+), 97 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.24 nightlytest-serverside/ProgramResults.php:1.25 --- nightlytest-serverside/ProgramResults.php:1.24 Thu Aug 31 10:40:30 2006 +++ nightlytest-serverside/ProgramResults.php Thu Aug 31 11:33:37 2006 @@ -434,7 +434,7 @@ } /* - * Get set Of tests + * Get set of tests * * Returns a hash of tests for a given night. */ @@ -452,7 +452,8 @@ /* * Get list of excluded tests * - * Returns a hash of tests for a given night. + * Returns a list of tests for a given night that were excluded from the + * hash. */ function getExcludedTests($id, $table, $test_hash){ $result = ""; @@ -478,14 +479,14 @@ if (strcmp($prev_id, "") === 0 || strcmp($cur_id, "") === 0) { return ""; } - + $result=""; if($cur_id<$new_schema_id){ $query = "SELECT new_tests FROM night WHERE id = $cur_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); - $result= $row['new_tests']; - $result=preg_replace("/\n/","
\n",$result); + $result = $row['new_tests']; + $result = preg_replace("/\n/","
\n", $result); mysql_free_result($program_query); } else { $test_hash = getTestSet($prev_id, "tests"); @@ -504,17 +505,17 @@ * in their own table as opposed in the night table. */ function getRemovedTests($cur_id, $prev_id, $mysql_link){ - if(strcmp($prev_id, "")===0 || strcmp($cur_id, "")===0){ + if (strcmp($prev_id, "") === 0 || strcmp($cur_id, "") === 0) { return ""; } - + $result=""; if($cur_id<$new_schema_id){ $query = "SELECT removed_tests FROM night WHERE id = $cur_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); - $result= $row['removed_tests']; - $result=preg_replace("/\n/","
\n",$result); + $result = $row['removed_tests']; + $result = preg_replace("/\n/","
\n", $result); mysql_free_result($program_query); } else { $test_hash = getTestSet($cur_id, "tests"); @@ -527,13 +528,61 @@ } /* + * Does the test pass + * + * Return true if the test result indicates a pass. + */ +function isTestPass($test_result) { + return strcmp($test_result, "PASS") === 0 || + strpos($test_result, "*") === false; +} + +/* + * Get set of tests that fail + * + * Returns a hash of tests that fail for a given night. + */ +function getTestFailSet($id, $table){ + $test_hash = array(); + $query = "SELECT * FROM $table WHERE night=$id"; + $program_query = mysql_query($query) or die (mysql_error()); + while ($row = mysql_fetch_array($program_query)) { + if (!isTestPass($row['result']) { + $test_hash[$row['program']]=1; + } + } + mysql_free_result($program_query); + return $test_hash; +} + +/* + * Get list of newly passing tests + * + * Returns a list of tests for a given night that were excluded from the + * hash and now pass. + */ +function getPassingTests($id, $table, $test_hash){ + $result = ""; + $query = "SELECT * FROM $table WHERE night=$id ORDER BY program ASC"; + $program_query = mysql_query($query) or die (mysql_error()); + while ($row = mysql_fetch_array($program_query)) { + $test_key = $row['program']; + if (isset($test_hash[$test_key]) && isTestPass($row['result']) { + $result .= $test_key . "
\n"; + } + } + mysql_free_result($program_query); + return $result; +} + +/* * Get Fixed Tests * * This is somewhat of a hack because from night 684 forward we now store the test * in their own table as opposed in the night table. */ function getFixedTests($cur_id, $prev_id, $mysql_link){ - if(strcmp($prev_id, "")===0 || strcmp($cur_id, "")===0){ + if (strcmp($prev_id, "") === 0 || strcmp($cur_id, "") === 0) { return ""; } @@ -542,51 +591,15 @@ $query = "SELECT newly_passing_tests FROM night WHERE id = $cur_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); - $result= $row['newly_passing_tests']; - $result=preg_replace("/\n/","
\n",$result); - mysql_free_result($program_query); - } - else{ - $test_hash=array(); - $query = "SELECT * FROM tests WHERE night=$prev_id"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - if(strcmp("{$row['result']}", "PASS")!==0){ - $test_hash["{$row['measure']} - {$row['program']}"]=$row['result']; - } - } - mysql_free_result($program_query); - - $query = "SELECT * FROM tests WHERE night=$cur_id ORDER BY program ASC" ; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_key = "{$row['measure']} - {$row['program']}"; - if(isset($test_hash[$test_key]) && - strcmp($test_hash[$test_key], $row['result'])!==0){ - $result .= $test_key . "
\n"; - } - } - mysql_free_result($program_query); - - $test_hash=array(); - $query = "SELECT * FROM program WHERE night=$prev_id"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - if(!(strpos($row['result'], "*") === false)) { - $test_hash[$row['program']]=$row['result']; - } - } - mysql_free_result($program_query); - - $query = "SELECT * FROM program WHERE night=$cur_id ORDER BY program ASC"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_key = $row['program']; - if(isset($test_hash[$test_key]) && strpos($row['result'], "*") === false){ - $result .= $test_key . "
\n"; - } - } + $result = $row['newly_passing_tests']; + $result = preg_replace("/\n/","
\n", $result); mysql_free_result($program_query); + } else { + $test_hash = getTestFailSet($prev_id, "tests"); + $result .= getPassingTests($cur_id, "tests", $test_hash); + + $test_hash = getTestFailSet($prev_id, "program"); + $result .= getPassingTests($cur_id, "program", $test_hash); } return $result; } @@ -598,7 +611,7 @@ * in their own table as oppoesd in the night table. */ function getBrokenTests($cur_id, $prev_id, $mysql_link){ - if(strcmp($prev_id, "")===0 || strcmp($cur_id, "")===0){ + if (strcmp($prev_id, "") === 0 || strcmp($cur_id, "") === 0) { return ""; } @@ -607,51 +620,16 @@ $query = "SELECT newly_failing_tests FROM night WHERE id = $cur_id"; $program_query = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($program_query); - $result= $row['newly_failing_tests']; - $result=preg_replace("/\n/","
\n",$result); + $result = $row['newly_failing_tests']; + $result = preg_replace("/\n/","
\n", $result); mysql_free_result($program_query); } else{ - $test_hash=array(); - $query = "SELECT * FROM tests WHERE night=$cur_id"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - if(strcmp("{$row['result']}", "PASS")!==0){ - $test_hash["{$row['measure']} - {$row['program']}"]=$row['result']; - } - } - mysql_free_result($program_query); - - $query = "SELECT * FROM tests WHERE night=$prev_id ORDER BY program ASC"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_key = "{$row['measure']} - {$row['program']}"; - if(isset($test_hash[$test_key]) && - strcmp($test_hash[$test_key], $row['result'])!==0){ - $result .= $test_key . "
\n"; - } - } - mysql_free_result($program_query); - - $test_hash=array(); - $query = "SELECT * FROM program WHERE night=$cur_id"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - if(!(strpos($row['result'], "*") === false)) { - $test_hash[$row['program']]=1; - } - } - mysql_free_result($program_query); - - $query = "SELECT * FROM program WHERE night=$prev_id ORDER BY program ASC"; - $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $test_key = $row['program']; - if(isset($test_hash[$test_key]) && strpos($row['result'], "*") === false){ - $result .= $test_key . "
\n"; - } - } - mysql_free_result($program_query); + $test_hash = getTestFailSet($cur_id, "tests"); + $result .= getPassingTests($prev_id, "tests", $test_hash); + + $test_hash = getTestFailSet($cur_id, "program"); + $result .= getPassingTests($prev_id, "program", $test_hash); } return $result; } From jlaskey at apple.com Thu Aug 31 11:35:21 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 11:35:21 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608311635.k7VGZLYS015967@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.25 -> 1.26 --- Log message: Syntax errors. --- Diffs of the changes: (+3 -4) ProgramResults.php | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.25 nightlytest-serverside/ProgramResults.php:1.26 --- nightlytest-serverside/ProgramResults.php:1.25 Thu Aug 31 11:33:37 2006 +++ nightlytest-serverside/ProgramResults.php Thu Aug 31 11:35:07 2006 @@ -547,7 +547,7 @@ $query = "SELECT * FROM $table WHERE night=$id"; $program_query = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($program_query)) { - if (!isTestPass($row['result']) { + if (!isTestPass($row['result'])) { $test_hash[$row['program']]=1; } } @@ -567,7 +567,7 @@ $program_query = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($program_query)) { $test_key = $row['program']; - if (isset($test_hash[$test_key]) && isTestPass($row['result']) { + if (isset($test_hash[$test_key]) && isTestPass($row['result'])) { $result .= $test_key . "
\n"; } } @@ -623,8 +623,7 @@ $result = $row['newly_failing_tests']; $result = preg_replace("/\n/","
\n", $result); mysql_free_result($program_query); - } - else{ + } else { $test_hash = getTestFailSet($cur_id, "tests"); $result .= getPassingTests($prev_id, "tests", $test_hash); From jlaskey at apple.com Thu Aug 31 12:33:06 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 12:33:06 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608311733.k7VHX6Ag016844@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.26 -> 1.27 --- Log message: Add llvm-tests to fail report. --- Diffs of the changes: (+16 -7) ProgramResults.php | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.26 nightlytest-serverside/ProgramResults.php:1.27 --- nightlytest-serverside/ProgramResults.php:1.26 Thu Aug 31 11:35:07 2006 +++ nightlytest-serverside/ProgramResults.php Thu Aug 31 12:32:51 2006 @@ -393,13 +393,22 @@ * This is somewhat of a hack because from night 684 forward we now store the test * in their own table as oppoesd in the night table. */ -function getFailures($night_id, $mysql_link){ +function getFailures($night_id) { $result=""; - if($night_id>=$new_schema_id){ - $query = "SELECT * FROM tests WHERE night=$night_id AND result=\"FAIL\" AND measure!=\"dejagnu\""; + if ($night_id >= $new_schema_id) { + $query = "SELECT * FROM tests WHERE night=$night_id AND result=\"FAIL\""; $program_query = mysql_query($query) or die (mysql_error()); - while($row = mysql_fetch_array($program_query)){ - $result.="{$row['measure']} - {$row['program']}
\n"; + while($row = mysql_fetch_array($program_query)) { + $result .= $row['program'] . "
\n"; + } + mysql_free_result($program_query); + + $query = "SELECT * FROM program WHERE night=$night_id "; + $program_query = mysql_query($query) or die (mysql_error()); + while($row = mysql_fetch_array($program_query)) { + if (!isTestPass($row['result'])) { + $result .= $row['program'] . "
\n"; + } } mysql_free_result($program_query); } @@ -423,10 +432,10 @@ mysql_free_result($program_query); } else{ - $query = "SELECT * FROM tests WHERE night=$night_id AND result=\"FAIL\" AND measure=\"dejagnu\""; + $query = "SELECT * FROM tests WHERE night=$night_id AND result=\"FAIL\""; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)){ - $result.="{$row['measure']} - {$row['program']}
\n"; + $result .= $row['program'] . "
\n"; } mysql_free_result($program_query); } From jlaskey at apple.com Thu Aug 31 12:34:30 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 12:34:30 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608311734.k7VHYU6m016922@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.27 -> 1.28 --- Log message: Sort failures. --- Diffs of the changes: (+2 -2) ProgramResults.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.27 nightlytest-serverside/ProgramResults.php:1.28 --- nightlytest-serverside/ProgramResults.php:1.27 Thu Aug 31 12:32:51 2006 +++ nightlytest-serverside/ProgramResults.php Thu Aug 31 12:34:16 2006 @@ -396,14 +396,14 @@ function getFailures($night_id) { $result=""; if ($night_id >= $new_schema_id) { - $query = "SELECT * FROM tests WHERE night=$night_id AND result=\"FAIL\""; + $query = "SELECT * FROM tests WHERE night=$night_id AND result=\"FAIL\" ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)) { $result .= $row['program'] . "
\n"; } mysql_free_result($program_query); - $query = "SELECT * FROM program WHERE night=$night_id "; + $query = "SELECT * FROM program WHERE night=$night_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)) { if (!isTestPass($row['result'])) { From jlaskey at apple.com Thu Aug 31 13:11:04 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 13:11:04 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/fulltest.php Message-ID: <200608311811.k7VIB4i3017693@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: fulltest.php updated: 1.15 -> 1.16 --- Log message: Reflect the change in arguments. --- Diffs of the changes: (+1 -1) fulltest.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/fulltest.php diff -u nightlytest-serverside/fulltest.php:1.15 nightlytest-serverside/fulltest.php:1.16 --- nightlytest-serverside/fulltest.php:1.15 Mon Aug 21 15:21:55 2006 +++ nightlytest-serverside/fulltest.php Thu Aug 31 13:10:50 2006 @@ -179,7 +179,7 @@ * Printing failures in test suite * ******************************************************/ -$failing_tests=getFailures($night_id, $previous_succesful_id, $mysql_link); +$failing_tests=getFailures($night_id); if(strcmp($failing_tests,"")===0){ $newly_failing_tests="None"; } From jlaskey at apple.com Thu Aug 31 13:11:47 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 13:11:47 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608311811.k7VIBlGW017761@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.28 -> 1.29 --- Log message: Inspect the fail results. --- Diffs of the changes: (+1 -1) ProgramResults.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.28 nightlytest-serverside/ProgramResults.php:1.29 --- nightlytest-serverside/ProgramResults.php:1.28 Thu Aug 31 12:34:16 2006 +++ nightlytest-serverside/ProgramResults.php Thu Aug 31 13:11:33 2006 @@ -407,7 +407,7 @@ $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)) { if (!isTestPass($row['result'])) { - $result .= $row['program'] . "
\n"; + $result .= "{$row['program']} [{$row['result']}]
\n"; } } mysql_free_result($program_query); From jlaskey at apple.com Thu Aug 31 13:45:01 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 13:45:01 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608311845.k7VIj1Vt018357@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.30 -> 1.31 --- Log message: Oops - reverse logic. --- Diffs of the changes: (+1 -1) ProgramResults.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.30 nightlytest-serverside/ProgramResults.php:1.31 --- nightlytest-serverside/ProgramResults.php:1.30 Thu Aug 31 13:42:11 2006 +++ nightlytest-serverside/ProgramResults.php Thu Aug 31 13:44:47 2006 @@ -415,7 +415,7 @@ $phase = $phases[$i]; if (!isTestPass($phase)) { list($tool, $tool_result) = split(": ", $phase); - if (strcmp($failing_tools, "") == 0) { + if (strcmp($failing_tools, "") != 0) { $failing_tools .= ", "; } $failing_tools .= $tool; From isanbard at gmail.com Thu Aug 31 14:27:09 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:09 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/458.sjeng/Makefile Message-ID: <200608311927.k7VJR9R0019082@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/458.sjeng: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+17 -0) Makefile | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm-test/External/SPEC/CINT2006/458.sjeng/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/458.sjeng/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/458.sjeng/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,17 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 sjeng test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS = test.txt + STDOUT_FILENAME := test.out + else + RUN_OPTIONS = train.txt + STDOUT_FILENAME := train.out + endif From isanbard at gmail.com Thu Aug 31 14:27:07 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:07 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/429.mcf/Makefile Message-ID: <200608311927.k7VJR7am019042@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/429.mcf: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+20 -0) Makefile | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: llvm-test/External/SPEC/CINT2006/429.mcf/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/429.mcf/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/429.mcf/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,20 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 mcf test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + + RUN_OPTIONS = inp.in + + CPPFLAGS += -DWANT_STDC_PROTO + LDFLAGS += -lm + + ifeq ($(RUN_TYPE),test) + STDOUT_FILENAME := test.out + else + STDOUT_FILENAME := train.out + endif From isanbard at gmail.com Thu Aug 31 14:27:07 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:07 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile Message-ID: <200608311927.k7VJR7Cw019045@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/401.bzip2: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+17 -0) Makefile | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:45 2006 --- llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile Thu Aug 31 14:26:35 2006 *************** *** 0 **** --- 1,17 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 bzip2 test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + RUN_OPTIONS = `head -n 1 $(REF_IN_DIR)control` + + ifeq ($(RUN_TYPE),test) + STDOUT_FILENAME := input.compressed.out + else + STDOUT_FILENAME := input.combined.out + endif + + include ../../Makefile.spec2006 From isanbard at gmail.com Thu Aug 31 14:27:06 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:06 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile Message-ID: <200608311927.k7VJR6p4019037@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/445.gobmk: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+19 -0) Makefile | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,19 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 gobmk test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + + CPPFLAGS += -DHAVE_CONFIG_H + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := --quiet --mode gtp capture.tst + STDOUT_FILENAME := capture.out + else + RUN_OPTIONS := --quiet --mode gtp arb.tst + STDOUT_FILENAME := arb.out + endif From isanbard at gmail.com Thu Aug 31 14:27:07 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:07 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/403.gcc/Makefile Message-ID: <200608311927.k7VJR7c2019060@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/403.gcc: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+23 -0) Makefile | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm-test/External/SPEC/CINT2006/403.gcc/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/403.gcc/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/403.gcc/Makefile Thu Aug 31 14:26:35 2006 *************** *** 0 **** --- 1,23 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 gcc test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + + ifeq ($(OS),Darwin) + CPPFLAGS += -DSPEC_CPU_MACOSX + endif + + ifeq ($(ENDIAN),big) + CPPFLAGS += -DHOST_WORDS_BIG_ENDIAN + endif + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS = cccp.i -o cccp.s + else + RUN_OPTIONS = integrate.i -o integrate.s + endif From isanbard at gmail.com Thu Aug 31 14:27:08 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:08 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/462.libquantum/Makefile Message-ID: <200608311927.k7VJR851019077@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/462.libquantum: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+21 -0) Makefile | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm-test/External/SPEC/CINT2006/462.libquantum/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/462.libquantum/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/462.libquantum/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,21 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 libquantum test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + + ifeq ($(OS),Darwin) + CPPFLAGS += -DSPEC_CPU_MACOSX + endif + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := 33 5 + STDOUT_FILENAME := test.out + else + RUN_OPTIONS := 143 25 + STDOUT_FILENAME := train.out + endif From isanbard at gmail.com Thu Aug 31 14:27:09 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:09 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile Message-ID: <200608311927.k7VJR9aX019090@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/456.hmmer: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+20 -0) Makefile | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,20 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 hmmr test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_ABSTOLERANCE = 0.00001 + FP_TOLERANCE = 0.002 + + include ../../Makefile.spec2006 + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS = --fixed 0 --mean 325 --num 45000 --sd 200 --seed 0 bombesin.hmm + STDOUT_FILENAME := bombesin.out + else + RUN_OPTIONS = --fixed 0 --mean 425 --num 85000 --sd 300 --seed 0 leng100.hmm + STDOUT_FILENAME := leng100.out + endif From isanbard at gmail.com Thu Aug 31 14:27:07 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:07 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/464.h264ref/Makefile Message-ID: <200608311927.k7VJR7Tk019053@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/464.h264ref: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+17 -0) Makefile | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm-test/External/SPEC/CINT2006/464.h264ref/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/464.h264ref/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/464.h264ref/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,17 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 h264ref test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := -d foreman_test_encoder_baseline.cfg + STDOUT_FILENAME := foreman_test_baseline_encodelog.out + else + RUN_OPTIONS := -d foreman_train_encoder_baseline.cfg + STDOUT_FILENAME := foreman_train_baseline_encodelog.out + endif From isanbard at gmail.com Thu Aug 31 14:27:07 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:07 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile Message-ID: <200608311927.k7VJR73A019067@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/471.omnetpp: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+24 -0) Makefile | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,24 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 omnetpp test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_ABSTOLERANCE = 0.000001 + FP_TOLERANCE = 0.00001 + + CPPFLAGS += -DNDEBUG=1 \ + -I$(SPEC_BENCH_DIR)/src/omnet_include \ + -I$(SPEC_BENCH_DIR)/src/libs/envir + + include ../../Makefile.spec2006 + + RUN_OPTIONS = omnetpp.ini + + ifeq ($(RUN_TYPE),test) + STDOUT_FILENAME := test.out + else + STDOUT_FILENAME := train.out + endif From isanbard at gmail.com Thu Aug 31 14:27:07 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:07 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/Makefile Message-ID: <200608311927.k7VJR7u8019054@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+26 -0) Makefile | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+) Index: llvm-test/External/SPEC/CINT2006/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:45 2006 --- llvm-test/External/SPEC/CINT2006/Makefile Thu Aug 31 14:26:35 2006 *************** *** 0 **** --- 1,26 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building SPEC2006 integer tests. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../.. + PARALLEL_DIRS := \ + 401.bzip2 \ + 403.gcc \ + 429.mcf \ + 456.hmmer \ + 458.sjeng \ + 462.libquantum \ + 464.h264ref \ + 473.astar + + # 400.perlbench -- Need Makefile Help + # 445.gobmk -- Multiple Dirs + # 471.omnetpp -- Multiple Dirs + # 483.xalancbmk -- Needs C++ Exceptions + + # Get the $(ARCH) setting + include $(LEVEL)/Makefile.config + + include $(LEVEL)/Makefile.programs From isanbard at gmail.com Thu Aug 31 14:27:09 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:09 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/473.astar/Makefile Message-ID: <200608311927.k7VJR9D8019088@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/473.astar: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+28 -0) Makefile | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+) Index: llvm-test/External/SPEC/CINT2006/473.astar/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/473.astar/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/473.astar/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,28 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 astar test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.001 + + include ../../Makefile.spec2006 + + ifeq ($(ENDIAN),big) + CPPFLAGS += -DSPEC_CPU_BIG_ENDIAN + else + CPPFLAGS += -DSPEC_CPU_LITTLE_ENDIAN + endif + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS = lake.cfg + STDOUT_FILENAME := lake.out + else + RUN_OPTIONS = rivers1.cfg + STDOUT_FILENAME := rivers1.out + endif + + LDFLAGS = -lstdc++ -lm + LIBS = -lstdc++ -lm From isanbard at gmail.com Thu Aug 31 14:29:38 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:29:38 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/Makefile.spec2006 Message-ID: <200608311929.k7VJTcHF019142@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC: Makefile.spec2006 added (r1.1) --- Log message: Initial commit of the top level Makefile for the SPEC 2006 benchmarks. --- Diffs of the changes: (+28 -0) Makefile.spec2006 | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+) Index: llvm-test/External/SPEC/Makefile.spec2006 diff -c /dev/null llvm-test/External/SPEC/Makefile.spec2006:1.1 *** /dev/null Thu Aug 31 14:29:34 2006 --- llvm-test/External/SPEC/Makefile.spec2006 Thu Aug 31 14:29:24 2006 *************** *** 0 **** --- 1,28 ---- + ##===- Makefile.spec2006 -----------------------------------*- Makefile -*-===## + # + # This makefile contains information for building SPEC2006 as an external test. + # + ##===----------------------------------------------------------------------===## + + include $(LEVEL)/Makefile.config + + SPEC_ROOT := $(SPEC2006_ROOT) + CPPFLAGS += -DSPEC_CPU2006 + + # RUN_TYPE - Either ref, test, or train. May be specified on the command line. + # Individual tests may override this to provide better input sizes. + ifndef RUN_TYPE + ifdef LARGE_PROBLEM_SIZE + RUN_TYPE := train + else + RUN_TYPE := test + endif + endif + + # Don't use CINT2006/CFP2006, always use CPU2006. + SPEC_SUITEDIR := CPU2006 + + include $(LEVEL)/External/SPEC/Makefile.spec + + CPPFLAGS += -DSPEC_CPU + FPPFLAGS += -DSPEC_CPU From jlaskey at apple.com Thu Aug 31 13:42:26 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 31 Aug 2006 13:42:26 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200608311842.k7VIgQjR018266@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.29 -> 1.30 --- Log message: Break down results into finer detail. --- Diffs of the changes: (+17 -2) ProgramResults.php | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.29 nightlytest-serverside/ProgramResults.php:1.30 --- nightlytest-serverside/ProgramResults.php:1.29 Thu Aug 31 13:11:33 2006 +++ nightlytest-serverside/ProgramResults.php Thu Aug 31 13:42:11 2006 @@ -406,8 +406,23 @@ $query = "SELECT * FROM program WHERE night=$night_id ORDER BY program ASC"; $program_query = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($program_query)) { - if (!isTestPass($row['result'])) { - $result .= "{$row['program']} [{$row['result']}]
\n"; + $test_result = $row['result']; + if (!isTestPass($test_result)) { + $failing_tools = ""; + $phases = split(", ", $test_result); + + for ($i = 0; $i < count($phases); $i++) { + $phase = $phases[$i]; + if (!isTestPass($phase)) { + list($tool, $tool_result) = split(": ", $phase); + if (strcmp($failing_tools, "") == 0) { + $failing_tools .= ", "; + } + $failing_tools .= $tool; + } + } + + $result .= "{$row['program']} [{$failing_tools}]
\n"; } } mysql_free_result($program_query); From isanbard at gmail.com Thu Aug 31 14:27:08 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 31 Aug 2006 14:27:08 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile Message-ID: <200608311927.k7VJR8qD019072@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/483.xalancbmk: Makefile added (r1.1) --- Log message: Initial commit of the Makefiles for the SPEC2006 integer benchmarks. --- Diffs of the changes: (+37 -0) Makefile | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+) Index: llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile:1.1 *** /dev/null Thu Aug 31 14:26:46 2006 --- llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile Thu Aug 31 14:26:36 2006 *************** *** 0 **** --- 1,37 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 xalancbmk test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + CPPFLAGS += -DNDEBUG -DAPP_NO_THREADS -DXALAN_INMEM_MSG_LOADER \ + -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS \ + -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_VALIDATORS \ + -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER \ + -DXML_USE_PTHREADS \ + -I$(SPEC_BENCH_DIR)/src/xercesc \ + -I$(SPEC_BENCH_DIR)/src/xercesc/dom \ + -I$(SPEC_BENCH_DIR)/src/xercesc/dom/impl \ + -I$(SPEC_BENCH_DIR)/src/xercesc/sax \ + -I$(SPEC_BENCH_DIR)/src/xercesc/util/MsgLoaders/InMemory \ + -I$(SPEC_BENCH_DIR)/src/xercesc/util/Transcoders/Iconv \ + -I$(SPEC_BENCH_DIR)/src/xalanc/include + + include ../../Makefile.spec2006 + + ifeq ($(OS),Darwin) + CPPFLAGS += -DSPEC_CPU_MACOSX + endif + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS = -v test.xml xalanc.xsl + STDOUT_FILENAME := test.out + else + RUN_OPTIONS = -v allbooks.xml xalanc.xsl + STDOUT_FILENAME := train.out + endif + + LDFLAGS = -lstdc++ -lm + LIBS = -lstdc++ -lm From nicholas at mxc.ca Thu Aug 31 22:26:49 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 31 Aug 2006 22:26:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200609010326.k813QnI2026677@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.3 -> 1.4 --- Log message: Don't confuse canonicalize and lookup. Fixes predsimplify.reg4.ll. Also corrects missing optimization opportunity removing cases from a switch. --- Diffs of the changes: (+20 -21) PredicateSimplifier.cpp | 41 ++++++++++++++++++++--------------------- 1 files changed, 20 insertions(+), 21 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.3 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.4 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.3 Wed Aug 30 19:39:16 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Thu Aug 31 22:26:35 2006 @@ -576,30 +576,29 @@ void PredicateSimplifier::visit(SwitchInst *SI, DominatorTree::Node *DTNode, PropertySet KP) { Value *Condition = SI->getCondition(); + DEBUG(assert(Condition == KP.canonicalize(Condition) && + "Instruction wasn't already canonicalized?")); // If there's an NEProperty covering this SwitchInst, we may be able to // eliminate one of the cases. - if (Value *C = KP.lookup(Condition)) { - Condition = C; - for (PropertySet::ConstPropertyIterator I = KP.Properties.begin(), - E = KP.Properties.end(); I != E; ++I) { - if (I->Opcode != PropertySet::NE) continue; - Value *V1 = KP.lookup(I->V1), - *V2 = KP.lookup(I->V2); - if (V1 != C && V2 != C) continue; - - // Is one side a number? - ConstantInt *CI = dyn_cast(KP.lookup(I->V1)); - if (!CI) CI = dyn_cast(KP.lookup(I->V2)); - - if (CI) { - unsigned i = SI->findCaseValue(CI); - if (i != 0) { - SI->getSuccessor(i)->removePredecessor(SI->getParent()); - SI->removeCase(i); - modified = true; - ++NumSwitchCases; - } + for (PropertySet::ConstPropertyIterator I = KP.Properties.begin(), + E = KP.Properties.end(); I != E; ++I) { + if (I->Opcode != PropertySet::NE) continue; + Value *V1 = KP.canonicalize(I->V1), + *V2 = KP.canonicalize(I->V2); + if (V1 != Condition && V2 != Condition) continue; + + // Is one side a number? + ConstantInt *CI = dyn_cast(KP.canonicalize(I->V1)); + if (!CI) CI = dyn_cast(KP.canonicalize(I->V2)); + + if (CI) { + unsigned i = SI->findCaseValue(CI); + if (i != 0) { + SI->getSuccessor(i)->removePredecessor(SI->getParent()); + SI->removeCase(i); + modified = true; + ++NumSwitchCases; } } } From lattner at cs.uiuc.edu Thu Aug 31 23:02:59 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 31 Aug 2006 23:02:59 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200609010402.k8142x4o027307@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.56 -> 1.57 --- Log message: Iterative coallescing doesn't buy us anything (we get identical results on crafty with and without it). Removing it speeds up live intervals 6%. --- Diffs of the changes: (+2 -15) LiveIntervalAnalysis.h | 17 ++--------------- 1 files changed, 2 insertions(+), 15 deletions(-) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.56 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.57 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.56 Thu Aug 31 00:54:43 2006 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Thu Aug 31 23:02:42 2006 @@ -53,17 +53,6 @@ std::vector allocatableRegs_; public: - struct CopyRec { - MachineInstr *MI; - unsigned SrcReg, DstReg; - }; - CopyRec getCopyRec(MachineInstr *MI, unsigned SrcReg, unsigned DstReg) { - CopyRec R; - R.MI = MI; - R.SrcReg = SrcReg; - R.DstReg = DstReg; - return R; - } struct InstrSlots { enum { LOAD = 0, @@ -161,10 +150,8 @@ /// joinIntervals - join compatible live intervals void joinIntervals(); - /// CopyCoallesceInMBB - Coallsece copies in the specified MBB, putting - /// copies that cannot yet be coallesced into the "TryAgain" list. - void CopyCoallesceInMBB(MachineBasicBlock *MBB, - std::vector &TryAgain); + /// CopyCoallesceInMBB - Coallsece copies in the specified MBB. + void CopyCoallesceInMBB(MachineBasicBlock *MBB); /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true From lattner at cs.uiuc.edu Thu Aug 31 23:02:59 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 31 Aug 2006 23:02:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200609010402.k8142xNw027312@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.176 -> 1.177 --- Log message: Iterative coallescing doesn't buy us anything (we get identical results on crafty with and without it). Removing it speeds up live intervals 6%. --- Diffs of the changes: (+4 -24) LiveIntervalAnalysis.cpp | 28 ++++------------------------ 1 files changed, 4 insertions(+), 24 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.176 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.177 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.176 Thu Aug 31 01:48:26 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Aug 31 23:02:42 2006 @@ -1066,8 +1066,7 @@ } -void LiveIntervals::CopyCoallesceInMBB(MachineBasicBlock *MBB, - std::vector &TryAgain) { +void LiveIntervals::CopyCoallesceInMBB(MachineBasicBlock *MBB) { DEBUG(std::cerr << ((Value*)MBB->getBasicBlock())->getName() << ":\n"); for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end(); @@ -1078,8 +1077,7 @@ unsigned SrcReg, DstReg; if (!tii_->isMoveInstr(*Inst, SrcReg, DstReg)) continue; - if (!JoinCopy(Inst, SrcReg, DstReg)) - TryAgain.push_back(getCopyRec(Inst, SrcReg, DstReg)); + JoinCopy(Inst, SrcReg, DstReg); } } @@ -1087,14 +1085,12 @@ void LiveIntervals::joinIntervals() { DEBUG(std::cerr << "********** JOINING INTERVALS ***********\n"); - std::vector TryAgainList; - const LoopInfo &LI = getAnalysis(); if (LI.begin() == LI.end()) { // If there are no loops in the function, join intervals in function order. for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E; ++I) - CopyCoallesceInMBB(I, TryAgainList); + CopyCoallesceInMBB(I); } else { // Otherwise, join intervals in inner loops before other intervals. // Unfortunately we can't just iterate over loop hierarchy here because @@ -1109,23 +1105,7 @@ // Finally, join intervals in loop nest order. for (unsigned i = 0, e = MBBs.size(); i != e; ++i) - CopyCoallesceInMBB(MBBs[i].second, TryAgainList); - } - - // Joining intervals can allow other intervals to be joined. Iteratively join - // until we make no progress. - bool ProgressMade = true; - while (ProgressMade) { - ProgressMade = false; - - for (unsigned i = 0, e = TryAgainList.size(); i != e; ++i) { - CopyRec &TheCopy = TryAgainList[i]; - if (TheCopy.MI && - JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) { - TheCopy.MI = 0; // Mark this one as done. - ProgressMade = true; - } - } + CopyCoallesceInMBB(MBBs[i].second); } DEBUG(std::cerr << "*** Register mapping ***\n"); From lattner at cs.uiuc.edu Fri Sep 1 01:08:30 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 01:08:30 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/SmallVector.h Message-ID: <200609010608.k8168U7m029321@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: SmallVector.h updated: 1.17 -> 1.18 --- Log message: add a simple reserve method. --- Diffs of the changes: (+5 -0) SmallVector.h | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/include/llvm/ADT/SmallVector.h diff -u llvm/include/llvm/ADT/SmallVector.h:1.17 llvm/include/llvm/ADT/SmallVector.h:1.18 --- llvm/include/llvm/ADT/SmallVector.h:1.17 Mon Aug 28 16:52:08 2006 +++ llvm/include/llvm/ADT/SmallVector.h Fri Sep 1 01:08:16 2006 @@ -136,6 +136,11 @@ } } + void reserve(unsigned N) { + if (unsigned(Capacity-Begin) < N) + grow(N); + } + void swap(SmallVectorImpl &RHS); /// append - Add the specified range to the end of the SmallVector. From lattner at cs.uiuc.edu Fri Sep 1 01:10:32 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 01:10:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200609010610.k816AWMX029383@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.177 -> 1.178 --- Log message: Reserve space in the ValueNumberInfo vector. This speeds up live interval analysis 16% on crafty. Wrap long lines. --- Diffs of the changes: (+10 -10) LiveIntervalAnalysis.cpp | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.177 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.178 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.177 Thu Aug 31 23:02:42 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Sep 1 01:10:18 2006 @@ -879,7 +879,6 @@ return ThisValNoAssignments[VN] = UltimateVN; } - /// JoinIntervals - Attempt to join these two intervals. On failure, this /// returns false. Otherwise, if one of the intervals being joined is a /// physreg, this method always canonicalizes LHS to be it. The output @@ -893,7 +892,8 @@ SmallVector, 16> ValueNumberInfo; LHSValNoAssignments.resize(LHS.getNumValNums(), -1); RHSValNoAssignments.resize(RHS.getNumValNums(), -1); - + ValueNumberInfo.reserve(LHS.getNumValNums() + RHS.getNumValNums()); + // Compute ultimate value numbers for the LHS and RHS values. if (RHS.containsOneValue()) { // Copies from a liveinterval with a single value are simple to handle and @@ -950,8 +950,8 @@ RHSValNoAssignments[0] = RHSValID; } else { - // Loop over the value numbers of the LHS, seeing if any are defined from the - // RHS. + // Loop over the value numbers of the LHS, seeing if any are defined from + // the RHS. SmallVector LHSValsDefinedFromRHS; LHSValsDefinedFromRHS.resize(LHS.getNumValNums(), -1); for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { @@ -959,8 +959,8 @@ if (ValSrcReg == 0) // Src not defined by a copy? continue; - // DstReg is known to be a register in the LHS interval. If the src is from - // the RHS interval, we can use its value #. + // DstReg is known to be a register in the LHS interval. If the src is + // from the RHS interval, we can use its value #. if (rep(ValSrcReg) != RHS.reg) continue; @@ -969,8 +969,8 @@ LHSValsDefinedFromRHS[VN] = RHS.getLiveRangeContaining(ValInst-1)->ValId; } - // Loop over the value numbers of the RHS, seeing if any are defined from the - // LHS. + // Loop over the value numbers of the RHS, seeing if any are defined from + // the LHS. SmallVector RHSValsDefinedFromLHS; RHSValsDefinedFromLHS.resize(RHS.getNumValNums(), -1); for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { @@ -978,8 +978,8 @@ if (ValSrcReg == 0) // Src not defined by a copy? continue; - // DstReg is known to be a register in the RHS interval. If the src is from - // the LHS interval, we can use its value #. + // DstReg is known to be a register in the RHS interval. If the src is + // from the LHS interval, we can use its value #. if (rep(ValSrcReg) != LHS.reg) continue; From evan.cheng at apple.com Fri Sep 1 01:29:08 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 01:29:08 -0500 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh Message-ID: <200609010629.k816T8Fx029672@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean: constants.hh updated: 1.2 -> 1.3 --- Log message: Reduce problem size. It was causing troubles for low memory systems. --- Diffs of the changes: (+2 -2) constants.hh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh:1.2 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh:1.3 --- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh:1.2 Mon Oct 4 22:35:13 2004 +++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh Fri Sep 1 01:28:54 2006 @@ -1,8 +1,8 @@ #ifndef Constants #define Constants -#define MaxRows 2500 -#define MaxCols 5000 +#define MaxRows 500 +#define MaxCols 1000 #define DefaultNumObstacles 750 #define DefaultNumPredators 200 From lattner at cs.uiuc.edu Fri Sep 1 01:57:49 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 01:57:49 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveInterval.h Message-ID: <200609010657.k816vnrv030146@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveInterval.h updated: 1.23 -> 1.24 --- Log message: remove some particularly expensive assertions --- Diffs of the changes: (+3 -3) LiveInterval.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.23 llvm/include/llvm/CodeGen/LiveInterval.h:1.24 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.23 Thu Aug 31 00:54:43 2006 +++ llvm/include/llvm/CodeGen/LiveInterval.h Fri Sep 1 01:57:35 2006 @@ -132,19 +132,19 @@ /// getInstForValNum - Return the machine instruction index that defines the /// specified value number. unsigned getInstForValNum(unsigned ValNo) const { - assert(ValNo < ValueNumberInfo.size()); + //assert(ValNo < ValueNumberInfo.size()); return ValueNumberInfo[ValNo].first; } unsigned getSrcRegForValNum(unsigned ValNo) const { - assert(ValNo < ValueNumberInfo.size()); + //assert(ValNo < ValueNumberInfo.size()); if (ValueNumberInfo[ValNo].first < ~2U) return ValueNumberInfo[ValNo].second; return 0; } std::pair getValNumInfo(unsigned ValNo) const { - assert(ValNo < ValueNumberInfo.size()); + //assert(ValNo < ValueNumberInfo.size()); return ValueNumberInfo[ValNo]; } From lattner at cs.uiuc.edu Fri Sep 1 02:00:37 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 02:00:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200609010700.k8170bLZ030238@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.178 -> 1.179 --- Log message: Pull some code out of a hot recursive function because the common case doesn't need recursion. --- Diffs of the changes: (+19 -6) LiveIntervalAnalysis.cpp | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.178 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.179 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.178 Fri Sep 1 01:10:18 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Sep 1 02:00:23 2006 @@ -857,7 +857,7 @@ // If the VN has already been computed, just return it. if (ThisValNoAssignments[VN] >= 0) return ThisValNoAssignments[VN]; - assert(ThisValNoAssignments[VN] != -2 && "FIXME: Cyclic case, handle it!"); +// assert(ThisValNoAssignments[VN] != -2 && "Cyclic case?"); // If this val is not a copy from the other val, then it must be a new value // number in the destination. @@ -867,9 +867,13 @@ return ThisValNoAssignments[VN] = ValueNumberInfo.size()-1; } - // Otherwise, this *is* a copy from the RHS. Mark this value number as - // currently being computed, then ask what the ultimate value # of the other - // value is. + // Otherwise, this *is* a copy from the RHS. If the other side has already + // been computed, return it. + if (OtherValNoAssignments[OtherValNo] >= 0) + return ThisValNoAssignments[VN] = OtherValNoAssignments[OtherValNo]; + + // Mark this value number as currently being computed, then ask what the + // ultimate value # of the other value is. ThisValNoAssignments[VN] = -2; unsigned UltimateVN = ComputeUltimateVN(OtherValNo, ValueNumberInfo, @@ -989,13 +993,22 @@ } for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { - if (LHS.getInstForValNum(VN) == ~2U) continue; + if (LHSValNoAssignments[VN] >= 0 || LHS.getInstForValNum(VN) == ~2U) + continue; ComputeUltimateVN(VN, ValueNumberInfo, LHSValsDefinedFromRHS, RHSValsDefinedFromLHS, LHSValNoAssignments, RHSValNoAssignments, LHS, RHS); } for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) { - if (RHS.getInstForValNum(VN) == ~2U) continue; + if (RHSValNoAssignments[VN] >= 0 || RHS.getInstForValNum(VN) == ~2U) + continue; + // If this value number isn't a copy from the LHS, it's a new number. + if (RHSValsDefinedFromLHS[VN] == -1) { + ValueNumberInfo.push_back(RHS.getValNumInfo(VN)); + RHSValNoAssignments[VN] = ValueNumberInfo.size()-1; + continue; + } + ComputeUltimateVN(VN, ValueNumberInfo, RHSValsDefinedFromLHS, LHSValsDefinedFromRHS, RHSValNoAssignments, LHSValNoAssignments, RHS, LHS); From evan.cheng at apple.com Fri Sep 1 02:01:00 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 02:01:00 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200609010701.k81710Pe030257@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.73 -> 1.74 --- Log message: Yikes. This requires checking apple gcc version. --- Diffs of the changes: (+4 -2) JIT.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.73 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.74 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.73 Tue Aug 15 20:24:12 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Fri Sep 1 02:00:46 2006 @@ -32,7 +32,8 @@ #ifdef __APPLE__ #include -#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 && \ + __APPLE_CC__ >= 5330 // __dso_handle is resolved by Mac OS X dynamic linker. extern void *__dso_handle __attribute__ ((__visibility__ ("hidden"))); #endif @@ -309,7 +310,8 @@ // If the global is external, just remember the address. if (GV->isExternal()) { #ifdef __APPLE__ -#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 && \ + __APPLE_CC__ >= 5330 // __dso_handle is resolved by the Mac OS X dynamic linker. if (GV->getName() == "__dso_handle") return (void*)&__dso_handle; From evan.cheng at apple.com Fri Sep 1 02:10:12 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 02:10:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200609010710.k817ACgg032703@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.74 -> 1.75 --- Log message: Better comments. --- Diffs of the changes: (+4 -1) JIT.cpp | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.74 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.75 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.74 Fri Sep 1 02:00:46 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Fri Sep 1 02:09:56 2006 @@ -312,7 +312,10 @@ #ifdef __APPLE__ #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 && \ __APPLE_CC__ >= 5330 - // __dso_handle is resolved by the Mac OS X dynamic linker. + // Apple gcc defaults to -fuse-cxa-atexit (i.e. calls __cxa_atexit instead + // of atexit). It passes the address of linker generated symbol __dso_handle + // to the function. + // This configuration change happened at version 5330. if (GV->getName() == "__dso_handle") return (void*)&__dso_handle; #endif From jlaskey at apple.com Fri Sep 1 05:48:24 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 1 Sep 2006 05:48:24 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php fulltest.php test.php Message-ID: <200609011048.k81AmOur000832@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.31 -> 1.32 fulltest.php updated: 1.16 -> 1.17 test.php updated: 1.18 -> 1.19 --- Log message: Clean up. --- Diffs of the changes: (+8 -6) ProgramResults.php | 8 +++++--- fulltest.php | 2 +- test.php | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.31 nightlytest-serverside/ProgramResults.php:1.32 --- nightlytest-serverside/ProgramResults.php:1.31 Thu Aug 31 13:44:47 2006 +++ nightlytest-serverside/ProgramResults.php Fri Sep 1 05:48:04 2006 @@ -436,7 +436,7 @@ * This is somewhat of a hack because from night 684 forward we now store the test * in their own table as oppoesd in the night table. */ -function getUnexpectedFailures($night_id, $mysql_link){ +function getUnexpectedFailures($night_id){ $result=""; if($night_id<$new_schema_id){ $query = "SELECT unexpfail_tests FROM night WHERE id = $night_id"; @@ -554,10 +554,12 @@ /* * Does the test pass * - * Return true if the test result indicates a pass. + * Return true if the test result indicates a pass. For "tests" the possible + * conditions are "PASS", "FAIL" and "XFAIL" (expected to fail.) For programs + * an asterix appears by each tool that has failed. */ function isTestPass($test_result) { - return strcmp($test_result, "PASS") === 0 || + return strcmp($test_result, "FAIL") != 0 || strpos($test_result, "*") === false; } Index: nightlytest-serverside/fulltest.php diff -u nightlytest-serverside/fulltest.php:1.16 nightlytest-serverside/fulltest.php:1.17 --- nightlytest-serverside/fulltest.php:1.16 Thu Aug 31 13:10:50 2006 +++ nightlytest-serverside/fulltest.php Fri Sep 1 05:48:04 2006 @@ -200,7 +200,7 @@ $delta_exppass = $today_row['teststats_exppass']-$yesterday_row['teststats_exppass']; $delta_expfail = $today_row['teststats_expfail']-$yesterday_row['teststats_expfail']; $delta_unexpfail = $today_row['teststats_unexpfail']-$yesterday_row['teststats_unexpfail']; -$unexpected_failures = getUnexpectedFailures($night_id, $mysql_link); +$unexpected_failures = getUnexpectedFailures($night_id); if($delta_exppass==0 && $delta_expfail==0 && $delta_unexpfail==0 && strcmp($unexpected_failures, "")===0){ Index: nightlytest-serverside/test.php diff -u nightlytest-serverside/test.php:1.18 nightlytest-serverside/test.php:1.19 --- nightlytest-serverside/test.php:1.18 Mon Aug 21 16:56:57 2006 +++ nightlytest-serverside/test.php Fri Sep 1 05:48:04 2006 @@ -191,7 +191,7 @@ * Printing failures in test suite * ******************************************************/ -$failing_tests=getFailures($night_id, $previous_succesful_id, $mysql_link); +$failing_tests=getFailures($night_id); if(strcmp($failing_tests,"")===0){ $newly_failing_tests="None"; } @@ -212,7 +212,7 @@ $delta_exppass = $today_row['teststats_exppass']-$yesterday_row['teststats_exppass']; $delta_expfail = $today_row['teststats_expfail']-$yesterday_row['teststats_expfail']; $delta_unexpfail = $today_row['teststats_unexpfail']-$yesterday_row['teststats_unexpfail']; -$unexpected_failures = getUnexpectedFailures($night_id, $mysql_link); +$unexpected_failures = getUnexpectedFailures($night_id); if($delta_exppass==0 && $delta_expfail==0 && $delta_unexpfail==0 && strcmp($unexpected_failures,"")===0){ From jlaskey at apple.com Fri Sep 1 05:51:42 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 1 Sep 2006 05:51:42 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200609011051.k81Apgfk001119@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.32 -> 1.33 --- Log message: Not working correctly. --- Diffs of the changes: (+1 -1) ProgramResults.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.32 nightlytest-serverside/ProgramResults.php:1.33 --- nightlytest-serverside/ProgramResults.php:1.32 Fri Sep 1 05:48:04 2006 +++ nightlytest-serverside/ProgramResults.php Fri Sep 1 05:51:27 2006 @@ -559,7 +559,7 @@ * an asterix appears by each tool that has failed. */ function isTestPass($test_result) { - return strcmp($test_result, "FAIL") != 0 || + return strcmp($test_result, "PASS") == 0 || strpos($test_result, "*") === false; } From jlaskey at apple.com Fri Sep 1 05:53:50 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 1 Sep 2006 05:53:50 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200609011053.k81AroIq001314@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.33 -> 1.34 --- Log message: Different approach. --- Diffs of the changes: (+1 -0) ProgramResults.php | 1 + 1 files changed, 1 insertion(+) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.33 nightlytest-serverside/ProgramResults.php:1.34 --- nightlytest-serverside/ProgramResults.php:1.33 Fri Sep 1 05:51:27 2006 +++ nightlytest-serverside/ProgramResults.php Fri Sep 1 05:53:35 2006 @@ -560,6 +560,7 @@ */ function isTestPass($test_result) { return strcmp($test_result, "PASS") == 0 || + strcmp($test_result, "XFAIL") == 0 || strpos($test_result, "*") === false; } From jlaskey at apple.com Fri Sep 1 07:55:25 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 1 Sep 2006 07:55:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200609011255.k81CtPM6019870@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.72 -> 1.73 --- Log message: Corrections. --- Diffs of the changes: (+4 -4) DwarfWriter.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.72 llvm/lib/CodeGen/DwarfWriter.cpp:1.73 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.72 Tue Aug 29 11:24:26 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Fri Sep 1 07:55:05 2006 @@ -942,7 +942,7 @@ //===----------------------------------------------------------------------===// -/// DWContext +/// DwarfWriter //===----------------------------------------------------------------------===// @@ -1103,9 +1103,9 @@ case '\t': O << "\\t"; break; default: O << '\\'; - O << char('0' + (C >> 6)); - O << char('0' + (C >> 3)); - O << char('0' + (C >> 0)); + O << char('0' + ((C >> 6) & 7)); + O << char('0' + ((C >> 3) & 7)); + O << char('0' + ((C >> 0) & 7)); break; } } else if (C == '\"') { From dpatel at apple.com Fri Sep 1 11:24:34 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 1 Sep 2006 09:24:34 -0700 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp In-Reply-To: <200609010701.k81710Pe030257@zion.cs.uiuc.edu> References: <200609010701.k81710Pe030257@zion.cs.uiuc.edu> Message-ID: On Sep 1, 2006, at 12:01 AM, Evan Cheng wrote: > Yikes. This requires checking apple gcc version. > That's risky, because apple gcc version number are not guaranteed to increase monotonically. It means, higher number does not guarantee newer compiler. - Devang From evan.cheng at apple.com Fri Sep 1 13:18:12 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 13:18:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200609011818.k81IICV6027946@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.389 -> 1.390 --- Log message: Allow legalizer to expand ISD::MUL using only MULHS in the rare case that is possible and the target only supports MULHS. --- Diffs of the changes: (+13 -6) LegalizeDAG.cpp | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.389 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.390 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.389 Sun Aug 27 07:54:01 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Sep 1 13:17:58 2006 @@ -4656,7 +4656,10 @@ break; } case ISD::MUL: { - if (TLI.isOperationLegal(ISD::MULHU, NVT)) { + bool HasMULHS = TLI.isOperationLegal(ISD::MULHS, NVT); + bool HasMULHU = TLI.isOperationLegal(ISD::MULHU, NVT); + bool UseLibCall = true; + if (HasMULHS || HasMULHU) { SDOperand LL, LH, RL, RH; ExpandOp(Node->getOperand(0), LL, LH); ExpandOp(Node->getOperand(1), RL, RH); @@ -4665,7 +4668,7 @@ // extended the sign bit of the low half through the upper half, and if so // emit a MULHS instead of the alternate sequence that is valid for any // i64 x i64 multiply. - if (TLI.isOperationLegal(ISD::MULHS, NVT) && + if (HasMULHS && // is RH an extension of the sign bit of RL? RH.getOpcode() == ISD::SRA && RH.getOperand(0) == RL && RH.getOperand(1).getOpcode() == ISD::Constant && @@ -4675,17 +4678,21 @@ LH.getOperand(1).getOpcode() == ISD::Constant && cast(LH.getOperand(1))->getValue() == SH) { Hi = DAG.getNode(ISD::MULHS, NVT, LL, RL); - } else { + UseLibCall = false; + } else if (HasMULHU) { Hi = DAG.getNode(ISD::MULHU, NVT, LL, RL); RH = DAG.getNode(ISD::MUL, NVT, LL, RH); LH = DAG.getNode(ISD::MUL, NVT, LH, RL); Hi = DAG.getNode(ISD::ADD, NVT, Hi, RH); Hi = DAG.getNode(ISD::ADD, NVT, Hi, LH); + UseLibCall = false; } - Lo = DAG.getNode(ISD::MUL, NVT, LL, RL); - } else { - Lo = ExpandLibCall("__muldi3" , Node, Hi); + if (!UseLibCall) + Lo = DAG.getNode(ISD::MUL, NVT, LL, RL); } + + if (UseLibCall) + Lo = ExpandLibCall("__muldi3" , Node, Hi); break; } case ISD::SDIV: Lo = ExpandLibCall("__divdi3" , Node, Hi); break; From evan.cheng at apple.com Fri Sep 1 13:41:00 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 13:41:00 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200609011841.k81If0Xj028449@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.75 -> 1.76 --- Log message: --- Diffs of the changes: (+2 -2) JIT.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.75 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.76 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.75 Fri Sep 1 02:09:56 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Fri Sep 1 13:40:46 2006 @@ -32,7 +32,7 @@ #ifdef __APPLE__ #include -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 && \ +#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || \ __APPLE_CC__ >= 5330 // __dso_handle is resolved by Mac OS X dynamic linker. extern void *__dso_handle __attribute__ ((__visibility__ ("hidden"))); @@ -310,7 +310,7 @@ // If the global is external, just remember the address. if (GV->isExternal()) { #ifdef __APPLE__ -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 && \ +#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || \ __APPLE_CC__ >= 5330 // Apple gcc defaults to -fuse-cxa-atexit (i.e. calls __cxa_atexit instead // of atexit). It passes the address of linker generated symbol __dso_handle From evan.cheng at apple.com Fri Sep 1 13:43:14 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 13:43:14 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200609011843.k81IhEuM028492@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.76 -> 1.77 --- Log message: Last check-in was a mistake... I've been told apple gcc version number is not guaranteed to increase monotonically. Change the preprocess condition to make it less risky. The configuration change is done during the middle 10.4 life cycle so we have to check __APPLE_CC. For future OS X release, we should be able to assume -fenable-cxa-atexit is the default. --- Diffs of the changes: (+6 -4) JIT.cpp | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.76 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.77 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.76 Fri Sep 1 13:40:46 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Fri Sep 1 13:42:59 2006 @@ -32,8 +32,9 @@ #ifdef __APPLE__ #include -#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || \ - __APPLE_CC__ >= 5330 +#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \ + (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ + __APPLE_CC__ >= 5330) // __dso_handle is resolved by Mac OS X dynamic linker. extern void *__dso_handle __attribute__ ((__visibility__ ("hidden"))); #endif @@ -310,8 +311,9 @@ // If the global is external, just remember the address. if (GV->isExternal()) { #ifdef __APPLE__ -#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || \ - __APPLE_CC__ >= 5330 +#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \ + (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ + __APPLE_CC__ >= 5330) // Apple gcc defaults to -fuse-cxa-atexit (i.e. calls __cxa_atexit instead // of atexit). It passes the address of linker generated symbol __dso_handle // to the function. From evan.cheng at apple.com Fri Sep 1 13:45:36 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 13:45:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200609011845.k81Ijap5028546@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.77 -> 1.78 --- Log message: Remove extra spaces. --- Diffs of the changes: (+2 -2) JIT.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.77 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.78 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.77 Fri Sep 1 13:42:59 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Fri Sep 1 13:45:22 2006 @@ -33,7 +33,7 @@ #ifdef __APPLE__ #include #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \ - (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ + (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ __APPLE_CC__ >= 5330) // __dso_handle is resolved by Mac OS X dynamic linker. extern void *__dso_handle __attribute__ ((__visibility__ ("hidden"))); @@ -312,7 +312,7 @@ if (GV->isExternal()) { #ifdef __APPLE__ #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \ - (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ + (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ __APPLE_CC__ >= 5330) // Apple gcc defaults to -fuse-cxa-atexit (i.e. calls __cxa_atexit instead // of atexit). It passes the address of linker generated symbol __dso_handle From asl at math.spbu.ru Fri Sep 1 15:35:33 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 1 Sep 2006 15:35:33 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccld/gccld.cpp Message-ID: <200609012035.k81KZX55030404@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: gccld.cpp updated: 1.110 -> 1.111 --- Log message: - Fixed broken Win32 build - Removed warning about clobbered parameter in Bytecode/Reader --- Diffs of the changes: (+10 -5) gccld.cpp | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) Index: llvm/tools/gccld/gccld.cpp diff -u llvm/tools/gccld/gccld.cpp:1.110 llvm/tools/gccld/gccld.cpp:1.111 --- llvm/tools/gccld/gccld.cpp:1.110 Tue Aug 22 18:27:22 2006 +++ llvm/tools/gccld/gccld.cpp Fri Sep 1 15:35:17 2006 @@ -133,17 +133,22 @@ /// EmitShellScript - Output the wrapper file that invokes the JIT on the LLVM /// bytecode file for the program. static void EmitShellScript(char **argv) { -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) // Windows doesn't support #!/bin/sh style shell scripts in .exe files. To // support windows systems, we copy the llvm-stub.exe executable from the // build tree to the destination file. - std::string llvmstub = FindExecutable("llvm-stub.exe", argv[0]).toString(); - if (llvmstub.empty()) { + std::string ErrMsg; + sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]); + if (llvmstub.isEmpty()) { std::cerr << "Could not find llvm-stub.exe executable!\n"; exit(1); } - sys::CopyFile(sys::Path(OutputFilename), sys::Path(llvmstub)); - return; + if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + exit(1); + } + + return; #endif // Output the script to start the program... From asl at math.spbu.ru Fri Sep 1 15:35:34 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 1 Sep 2006 15:35:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/MappedFile.inc Path.inc Program.inc Win32.h Message-ID: <200609012035.k81KZYWp030416@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: MappedFile.inc updated: 1.7 -> 1.8 Path.inc updated: 1.57 -> 1.58 Program.inc updated: 1.17 -> 1.18 Win32.h updated: 1.9 -> 1.10 --- Log message: - Fixed broken Win32 build - Removed warning about clobbered parameter in Bytecode/Reader --- Diffs of the changes: (+24 -20) MappedFile.inc | 2 ++ Path.inc | 32 +++++++++++++++++++------------- Program.inc | 4 ++-- Win32.h | 6 +----- 4 files changed, 24 insertions(+), 20 deletions(-) Index: llvm/lib/System/Win32/MappedFile.inc diff -u llvm/lib/System/Win32/MappedFile.inc:1.7 llvm/lib/System/Win32/MappedFile.inc:1.8 --- llvm/lib/System/Win32/MappedFile.inc:1.7 Fri Aug 25 16:37:17 2006 +++ llvm/lib/System/Win32/MappedFile.inc Fri Sep 1 15:35:17 2006 @@ -55,6 +55,8 @@ return MakeErrMsg(ErrMsg, std::string("Can't get size of file: ") + path_.toString()); } + + return false; } void MappedFile::terminate() { Index: llvm/lib/System/Win32/Path.inc diff -u llvm/lib/System/Win32/Path.inc:1.57 llvm/lib/System/Win32/Path.inc:1.58 --- llvm/lib/System/Win32/Path.inc:1.57 Fri Aug 25 16:37:17 2006 +++ llvm/lib/System/Win32/Path.inc Fri Sep 1 15:35:17 2006 @@ -315,12 +315,12 @@ return false; } -void Path::makeWriteableOnDisk(std::string* ErrMsg) { +bool Path::makeWriteableOnDisk(std::string* ErrMsg) { DWORD attr = GetFileAttributes(path.c_str()); // If it doesn't exist, we're done. if (attr == INVALID_FILE_ATTRIBUTES) - return; + return false; if (attr & FILE_ATTRIBUTE_READONLY) { if (!SetFileAttributes(path.c_str(), attr & ~FILE_ATTRIBUTE_READONLY)) { @@ -338,7 +338,11 @@ bool Path::getDirectoryContents(std::set& result, std::string* ErrMsg) const { - if (!isDirectory()) { + FileStatus Status; + if (getFileStatus(Status, ErrMsg)) + return true; + + if (!Status.isDir) { MakeErrMsg(ErrMsg, path + ": not a directory"); return true; } @@ -512,7 +516,7 @@ // Drop trailing slash. pathname[len-1] = 0; if (!CreateDirectory(pathname, NULL)) { - return MakeErrMsg(, std::string(pathname) + ": Can't create directory: "); + return MakeErrMsg(ErrMsg, std::string(pathname) + ": Can't create directory: "); } } return false; @@ -652,10 +656,12 @@ } bool -Path::setStatusInfoOnDisk(const FileStatus &si, std::string *ErrStr) const { +Path::setStatusInfoOnDisk(const FileStatus &si, std::string *ErrMsg) const { // FIXME: should work on directories also. - if (!isFile()) return true; - + if (!si.isFile) { + return true; + } + HANDLE h = CreateFile(path.c_str(), FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -671,7 +677,7 @@ DWORD err = GetLastError(); CloseHandle(h); SetLastError(err); - return MakeErrMsg(ErrStr, path + ": GetFileInformationByHandle: "); + return MakeErrMsg(ErrMsg, path + ": GetFileInformationByHandle: "); } FILETIME ft; @@ -681,7 +687,7 @@ CloseHandle(h); if (!ret) { SetLastError(err); - return MakeErrMsg(path + ": SetFileTime: "); + return MakeErrMsg(ErrMsg, path + ": SetFileTime: "); } // Best we can do with Unix permission bits is to interpret the owner @@ -690,13 +696,13 @@ if (bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY) { if (!SetFileAttributes(path.c_str(), bhfi.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY)) - return MakeErrMsg(ErrStr, path + ": SetFileAttributes: "); + return MakeErrMsg(ErrMsg, path + ": SetFileAttributes: "); } } else { if (!(bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) { if (!SetFileAttributes(path.c_str(), bhfi.dwFileAttributes | FILE_ATTRIBUTE_READONLY)) - return MakeErrMsg(ErrStr, path + ": SetFileAttributes: "); + return MakeErrMsg(ErrMsg, path + ": SetFileAttributes: "); } } @@ -739,13 +745,13 @@ bool Path::createTemporaryFileOnDisk(bool reuse_current, std::string* ErrMsg) { // Make this into a unique file name - makeUnique(reuse_current); + makeUnique(reuse_current, ErrMsg); // Now go and create it HANDLE h = CreateFile(path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) - return MakeErrMsg(ErrMsg, path.toString() + ": can't create file"); + return MakeErrMsg(ErrMsg, path + ": can't create file"); CloseHandle(h); return false; Index: llvm/lib/System/Win32/Program.inc diff -u llvm/lib/System/Win32/Program.inc:1.17 llvm/lib/System/Win32/Program.inc:1.18 --- llvm/lib/System/Win32/Program.inc:1.17 Mon Aug 21 01:02:44 2006 +++ llvm/lib/System/Win32/Program.inc Fri Sep 1 15:35:17 2006 @@ -158,14 +158,14 @@ MakeErrMsg(ErrMsg, "can't redirect stdin"); return -1; } - si.hStdOutput = RedirectIO(redirects[1], 1); + si.hStdOutput = RedirectIO(redirects[1], 1, ErrMsg); if (si.hStdOutput == INVALID_HANDLE_VALUE) { CloseHandle(si.hStdInput); MakeErrMsg(ErrMsg, "can't redirect stdout"); return -1; } if (redirects[1] && redirects[2] && *(redirects[1]) != *(redirects[2])) { - si.hStdError = RedirectIO(redirects[2], 2); + si.hStdError = RedirectIO(redirects[2], 2, ErrMsg); if (si.hStdError == INVALID_HANDLE_VALUE) { CloseHandle(si.hStdInput); CloseHandle(si.hStdOutput); Index: llvm/lib/System/Win32/Win32.h diff -u llvm/lib/System/Win32/Win32.h:1.9 llvm/lib/System/Win32/Win32.h:1.10 --- llvm/lib/System/Win32/Win32.h:1.9 Fri Aug 25 16:37:17 2006 +++ llvm/lib/System/Win32/Win32.h Fri Sep 1 15:35:17 2006 @@ -30,11 +30,7 @@ char *buffer = NULL; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, (LPSTR)&buffer, 1, NULL); - ErrMsg = prefix + buffer; + *ErrMsg = prefix + buffer; LocalFree(buffer); return true; } - -inline void MakeErrnoMsg(std::string* ErrMsg, const std::string & prefix) { - MakeErrorMsg(prefix + ": " + strerror(errno)); -} From asl at math.spbu.ru Fri Sep 1 15:35:36 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 1 Sep 2006 15:35:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Reader.h Message-ID: <200609012035.k81KZaiM030428@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.196 -> 1.197 Reader.h updated: 1.32 -> 1.33 --- Log message: - Fixed broken Win32 build - Removed warning about clobbered parameter in Bytecode/Reader --- Diffs of the changes: (+2 -2) Reader.cpp | 2 +- Reader.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.196 llvm/lib/Bytecode/Reader/Reader.cpp:1.197 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.196 Fri Aug 25 14:54:53 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Fri Sep 1 15:35:17 2006 @@ -2409,7 +2409,7 @@ /// This function completely parses a bytecode buffer given by the \p Buf /// and \p Length parameters. -bool BytecodeReader::ParseBytecode(BufPtr Buf, unsigned Length, +bool BytecodeReader::ParseBytecode(volatile BufPtr Buf, unsigned Length, const std::string &ModuleID, std::string* ErrMsg) { Index: llvm/lib/Bytecode/Reader/Reader.h diff -u llvm/lib/Bytecode/Reader/Reader.h:1.32 llvm/lib/Bytecode/Reader/Reader.h:1.33 --- llvm/lib/Bytecode/Reader/Reader.h:1.32 Fri Aug 25 14:54:53 2006 +++ llvm/lib/Bytecode/Reader/Reader.h Fri Sep 1 15:35:17 2006 @@ -140,7 +140,7 @@ /// @returns true if an error occurred /// @brief Main interface to parsing a bytecode buffer. bool ParseBytecode( - const unsigned char *Buf, ///< Beginning of the bytecode buffer + volatile BufPtr Buf, ///< Beginning of the bytecode buffer unsigned Length, ///< Length of the bytecode buffer const std::string &ModuleID, ///< An identifier for the module constructed. std::string* ErrMsg = 0 ///< Optional place for error message From asl at math.spbu.ru Fri Sep 1 15:35:36 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 1 Sep 2006 15:35:36 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp Message-ID: <200609012035.k81KZal3030421@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: llvm-ld.cpp updated: 1.37 -> 1.38 --- Log message: - Fixed broken Win32 build - Removed warning about clobbered parameter in Bytecode/Reader --- Diffs of the changes: (+7 -1) llvm-ld.cpp | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/tools/llvm-ld/llvm-ld.cpp diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.37 llvm/tools/llvm-ld/llvm-ld.cpp:1.38 --- llvm/tools/llvm-ld/llvm-ld.cpp:1.37 Wed Aug 23 02:30:48 2006 +++ llvm/tools/llvm-ld/llvm-ld.cpp Fri Sep 1 15:35:17 2006 @@ -345,12 +345,18 @@ // Windows doesn't support #!/bin/sh style shell scripts in .exe files. To // support windows systems, we copy the llvm-stub.exe executable from the // build tree to the destination file. + std::string ErrMsg; sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]); if (llvmstub.isEmpty()) { std::cerr << "Could not find llvm-stub.exe executable!\n"; exit(1); } - sys::CopyFile(sys::Path(OutputFilename), llvmstub); + + if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + exit(1); + } + return; #endif From lattner at cs.uiuc.edu Fri Sep 1 16:14:03 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 16:14:03 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/FileLexer.l FileParser.y Message-ID: <200609012114.k81LE36w031128@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: FileLexer.l updated: 1.29 -> 1.30 FileParser.y updated: 1.42 -> 1.43 --- Log message: Add often-requested support for defining "multiclasses" which can be instantiated. This allows you to define multiple definitions with one line, encouraging more .td file factoring. --- Diffs of the changes: (+202 -38) FileLexer.l | 2 FileParser.y | 238 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 202 insertions(+), 38 deletions(-) Index: llvm/utils/TableGen/FileLexer.l diff -u llvm/utils/TableGen/FileLexer.l:1.29 llvm/utils/TableGen/FileLexer.l:1.30 --- llvm/utils/TableGen/FileLexer.l:1.29 Fri Mar 31 15:53:49 2006 +++ llvm/utils/TableGen/FileLexer.l Fri Sep 1 16:13:49 2006 @@ -195,6 +195,8 @@ class { return CLASS; } def { return DEF; } +defm { return DEFM; } +multiclass { return MULTICLASS; } field { return FIELD; } let { return LET; } in { return IN; } Index: llvm/utils/TableGen/FileParser.y diff -u llvm/utils/TableGen/FileParser.y:1.42 llvm/utils/TableGen/FileParser.y:1.43 --- llvm/utils/TableGen/FileParser.y:1.42 Fri Mar 31 15:53:49 2006 +++ llvm/utils/TableGen/FileParser.y Fri Sep 1 16:13:49 2006 @@ -22,8 +22,19 @@ int yylex(); namespace llvm { + struct MultiClass { + Record Rec; // Placeholder for template args and Name. + std::vector DefPrototypes; + + MultiClass(const std::string &Name) : Rec(Name) {} + }; + +static std::map MultiClasses; + extern int Filelineno; +static MultiClass *CurMultiClass = 0; // Set while parsing a multiclass. +static std::string *CurDefmPrefix = 0; // Set while parsing defm. static Record *CurRec = 0; static bool ParsingTemplateArgs = false; @@ -45,8 +56,16 @@ extern std::ostream &err(); +/// getActiveRec - If inside a def/class definition, return the def/class. +/// Otherwise, if within a multidef, return it. +static Record *getActiveRec() { + return CurRec ? CurRec : &CurMultiClass->Rec; +} + static void addValue(const RecordVal &RV) { - if (RecordVal *ERV = CurRec->getValue(RV.getName())) { + Record *TheRec = getActiveRec(); + + if (RecordVal *ERV = TheRec->getValue(RV.getName())) { // The value already exists in the class, treat this as a set... if (ERV->setValue(RV.getValue())) { err() << "New definition of '" << RV.getName() << "' of type '" @@ -55,7 +74,7 @@ exit(1); } } else { - CurRec->addValue(RV); + TheRec->addValue(RV); } } @@ -148,33 +167,33 @@ if (TArgs.size() < TemplateArgs.size()) { err() << "ERROR: More template args specified than expected!\n"; exit(1); - } else { // This class expects template arguments... - // Loop over all of the template arguments, setting them to the specified - // value or leaving them as the default if necessary. - for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { - if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? - // Set it now. - setValue(TArgs[i], 0, TemplateArgs[i]); - - // Resolve it next. - CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); - - - // Now remove it. - CurRec->removeValue(TArgs[i]); - - } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { - err() << "ERROR: Value not specified for template argument #" - << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() - << "'!\n"; - exit(1); - } + } + + // Loop over all of the template arguments, setting them to the specified + // value or leaving them as the default if necessary. + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? + // Set it now. + setValue(TArgs[i], 0, TemplateArgs[i]); + + // Resolve it next. + CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); + + + // Now remove it. + CurRec->removeValue(TArgs[i]); + + } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { + err() << "ERROR: Value not specified for template argument #" + << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() + << "'!\n"; + exit(1); } } // Since everything went well, we can now set the "superclass" list for the // current record. - const std::vector &SCs = SC->getSuperClasses(); + const std::vector &SCs = SC->getSuperClasses(); for (unsigned i = 0, e = SCs.size(); i != e; ++i) addSuperClass(SCs[i]); addSuperClass(SC); @@ -194,18 +213,20 @@ std::vector* FieldList; std::vector* BitList; llvm::Record* Rec; + std::vector* RecList; SubClassRefTy* SubClassRef; std::vector* SubClassList; std::vector >* DagValueList; }; -%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD LET IN +%token INT BIT STRING BITS LIST CODE DAG CLASS DEF MULTICLASS DEFM FIELD LET IN %token SHLTOK SRATOK SRLTOK STRCONCATTOK %token INTVAL %token ID VARNAME STRVAL CODEFRAGMENT %type Type -%type ClassInst DefInst Object ObjectBody ClassID +%type ClassInst DefInst MultiClassDef ObjectBody ClassID +%type MultiClassBody %type SubClassRef %type ClassList ClassListNE @@ -221,7 +242,18 @@ %% ClassID : ID { - $$ = Records.getClass(*$1); + if (CurDefmPrefix) { + // If CurDefmPrefix is set, we're parsing a defm, which means that this is + // actually the name of a multiclass. + MultiClass *MC = MultiClasses[*$1]; + if (MC == 0) { + err() << "Couldn't find class '" << *$1 << "'!\n"; + exit(1); + } + $$ = &MC->Rec; + } else { + $$ = Records.getClass(*$1); + } if ($$ == 0) { err() << "Couldn't find class '" << *$1 << "'!\n"; exit(1); @@ -260,6 +292,12 @@ const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*$1); assert(RV && "Template arg doesn't exist??"); $$ = new VarInit(CurRec->getName()+":"+*$1, RV->getType()); + } else if (CurMultiClass && + CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*$1)) { + std::string Name = CurMultiClass->Rec.getName()+"::"+*$1; + const RecordVal *RV = CurMultiClass->Rec.getValue(Name); + assert(RV && "Template arg doesn't exist??"); + $$ = new VarInit(Name, RV->getType()); } else if (Record *D = Records.getDef(*$1)) { $$ = new DefInit(D); } else { @@ -467,8 +505,15 @@ Declaration : OptPrefix Type ID OptValue { std::string DecName = *$3; - if (ParsingTemplateArgs) - DecName = CurRec->getName() + ":" + DecName; + if (ParsingTemplateArgs) { + if (CurRec) { + DecName = CurRec->getName() + ":" + DecName; + } else { + assert(CurMultiClass); + } + if (CurMultiClass) + DecName = CurMultiClass->Rec.getName() + "::" + DecName; + } addValue(RecordVal(DecName, $2, $1)); setValue(DecName, 0, $4); @@ -510,10 +555,10 @@ }; DeclListNE : Declaration { - CurRec->addTemplateArg(*$1); + getActiveRec()->addTemplateArg(*$1); delete $1; } | DeclListNE ',' Declaration { - CurRec->addTemplateArg(*$3); + getActiveRec()->addTemplateArg(*$3); delete $3; }; @@ -551,12 +596,25 @@ CurRec = new Record(*$1); delete $1; - // Ensure redefinition doesn't happen. - if (Records.getDef(CurRec->getName())) { - err() << "Def '" << CurRec->getName() << "' already defined!\n"; - exit(1); + if (!CurMultiClass) { + // Top-level def definition. + + // Ensure redefinition doesn't happen. + if (Records.getDef(CurRec->getName())) { + err() << "def '" << CurRec->getName() << "' already defined!\n"; + exit(1); + } + Records.addDef(CurRec); + } else { + // Otherwise, a def inside a multiclass, add it to the multiclass. + for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); i != e; ++i) + if (CurMultiClass->DefPrototypes[i]->getName() == CurRec->getName()) { + err() << "def '" << CurRec->getName() + << "' already defined in this multiclass!\n"; + exit(1); + } + CurMultiClass->DefPrototypes.push_back(CurRec); } - Records.addDef(CurRec); }; ObjectBody : ClassList { @@ -594,8 +652,112 @@ $$ = $3; }; +// MultiClassDef - A def instance specified inside a multiclass. +MultiClassDef : DefInst { + $$ = $1; + // Copy the template arguments for the multiclass into the def. + const std::vector &TArgs = CurMultiClass->Rec.getTemplateArgs(); + + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + const RecordVal *RV = CurMultiClass->Rec.getValue(TArgs[i]); + assert(RV && "Template arg doesn't exist?"); + $$->addValue(*RV); + } +}; + +// MultiClassBody - Sequence of def's that are instantiated when a multiclass is +// used. +MultiClassBody : MultiClassDef { + $$ = new std::vector(); + $$->push_back($1); +} | MultiClassBody MultiClassDef { + $$->push_back($2); +}; + +MultiClassName : ID { + MultiClass *&MCE = MultiClasses[*$1]; + if (MCE) { + err() << "multiclass '" << *$1 << "' already defined!\n"; + exit(1); + } + MCE = CurMultiClass = new MultiClass(*$1); + delete $1; +}; + +// MultiClass - Multiple definitions. +MultiClassInst : MULTICLASS MultiClassName { + ParsingTemplateArgs = true; + } OptTemplateArgList { + ParsingTemplateArgs = false; + }'{' MultiClassBody '}' { + CurMultiClass = 0; +}; + +// DefMInst - Instantiate a multiclass. +DefMInst : DEFM ID { CurDefmPrefix = $2; } ':' SubClassRef ';' { + // To instantiate a multiclass, we need to first get the multiclass, then + // instantiate each def contained in the multiclass with the SubClassRef + // template parameters. + MultiClass *MC = MultiClasses[$5->first->getName()]; + assert(MC && "Didn't lookup multiclass correctly?"); + std::vector &TemplateVals = *$5->second; + delete $5; + + // Verify that the correct number of template arguments were specified. + const std::vector &TArgs = MC->Rec.getTemplateArgs(); + if (TArgs.size() < TemplateVals.size()) { + err() << "ERROR: More template args specified than multiclass expects!\n"; + exit(1); + } + + // Loop over all the def's in the multiclass, instantiating each one. + for (unsigned i = 0, e = MC->DefPrototypes.size(); i != e; ++i) { + Record *DefProto = MC->DefPrototypes[i]; + + // Add the suffix to the defm name to get the new name. + assert(CurRec == 0 && "A def is current?"); + CurRec = new Record(*$2 + DefProto->getName()); + + addSubClass(DefProto, std::vector()); + + // Loop over all of the template arguments, setting them to the specified + // value or leaving them as the default if necessary. + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + if (i < TemplateVals.size()) { // A value is specified for this temp-arg? + // Set it now. + setValue(TArgs[i], 0, TemplateVals[i]); + + // Resolve it next. + CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); + + // Now remove it. + CurRec->removeValue(TArgs[i]); + + } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { + err() << "ERROR: Value not specified for template argument #" + << i << " (" << TArgs[i] << ") of multiclassclass '" + << MC->Rec.getName() << "'!\n"; + exit(1); + } + } + + // Ensure redefinition doesn't happen. + if (Records.getDef(CurRec->getName())) { + err() << "def '" << CurRec->getName() << "' already defined, " + << "instantiating defm '" << *$2 << "' with subdef '" + << DefProto->getName() << "'!\n"; + exit(1); + } + Records.addDef(CurRec); + CurRec = 0; + } + + delete &TemplateVals; + delete $2; +}; -Object : ClassInst | DefInst; +Object : ClassInst {} | DefInst {}; +Object : MultiClassInst | DefMInst; LETItem : ID OptBitList '=' Value { LetStack.back().push_back(LetRecord(*$1, $2, $4)); @@ -617,7 +779,7 @@ ObjectList : Object {} | ObjectList Object {}; -File : ObjectList {}; +File : ObjectList; %% From lattner at cs.uiuc.edu Fri Sep 1 16:14:53 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 16:14:53 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/TableGen/MultiClass.td Message-ID: <200609012114.k81LEr9R031213@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/TableGen: MultiClass.td added (r1.1) --- Log message: simple multiclass example --- Diffs of the changes: (+17 -0) MultiClass.td | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm/test/Regression/TableGen/MultiClass.td diff -c /dev/null llvm/test/Regression/TableGen/MultiClass.td:1.1 *** /dev/null Fri Sep 1 16:14:47 2006 --- llvm/test/Regression/TableGen/MultiClass.td Fri Sep 1 16:14:37 2006 *************** *** 0 **** --- 1,17 ---- + // RUN: tblgen %s + class C1 { + int bar = A; + string thestr = B; + } + + def T : C1<4, "blah">; + + multiclass t { + def S1 : C1 { + int foo = 4; + let bar = 1; + } + def S2 : C1; + } + + defm FOO : t<42>; From lattner at cs.uiuc.edu Fri Sep 1 16:14:57 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 16:14:57 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/FileLexer.cpp.cvs FileLexer.l.cvs FileParser.cpp.cvs FileParser.h.cvs FileParser.y.cvs Message-ID: <200609012114.k81LEvjx031227@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: FileLexer.cpp.cvs updated: 1.5 -> 1.6 FileLexer.l.cvs updated: 1.4 -> 1.5 FileParser.cpp.cvs updated: 1.3 -> 1.4 FileParser.h.cvs updated: 1.3 -> 1.4 FileParser.y.cvs updated: 1.3 -> 1.4 --- Log message: regenerate --- Diffs of the changes: (+888 -489) FileLexer.cpp.cvs | 329 +++++++++++----------- FileLexer.l.cvs | 2 FileParser.cpp.cvs | 771 ++++++++++++++++++++++++++++++++++------------------- FileParser.h.cvs | 27 + FileParser.y.cvs | 238 +++++++++++++--- 5 files changed, 888 insertions(+), 479 deletions(-) Index: llvm/utils/TableGen/FileLexer.cpp.cvs diff -u llvm/utils/TableGen/FileLexer.cpp.cvs:1.5 llvm/utils/TableGen/FileLexer.cpp.cvs:1.6 --- llvm/utils/TableGen/FileLexer.cpp.cvs:1.5 Fri Mar 31 15:54:11 2006 +++ llvm/utils/TableGen/FileLexer.cpp.cvs Fri Sep 1 16:14:42 2006 @@ -21,7 +21,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /var/cvs/llvm/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.5 2006/03/31 21:54:11 lattner Exp $ + * $Header: /var/cvs/llvm/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.6 2006/09/01 21:14:42 lattner Exp $ */ #define FLEX_SCANNER @@ -306,40 +306,43 @@ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 32 -#define YY_END_OF_BUFFER 33 -static yyconst short int yy_acclist[130] = +#define YY_NUM_RULES 34 +#define YY_END_OF_BUFFER 35 +static yyconst short int yy_acclist[145] = { 0, - 26, 26, 33, 31, 32, 24, 31, 32, 24, 32, - 31, 32, 31, 32, 31, 32, 31, 32, 31, 32, - 23, 31, 32, 23, 31, 32, 20, 31, 32, 31, - 32, 20, 31, 32, 20, 31, 32, 20, 31, 32, - 20, 31, 32, 20, 31, 32, 20, 31, 32, 20, - 31, 32, 26, 32, 27, 32, 29, 32, 24, 22, - 21, 23, 25, 1, 20, 20, 20, 20, 20, 20, - 20, 15, 20, 20, 20, 20, 26, 27, 27, 30, - 29, 28, 29, 21, 1, 23, 23, 5, 20, 20, - 20, 10, 20, 12, 20, 20, 20, 4, 20, 14, - - 20, 20, 20, 18, 16, 17, 3, 6, 20, 20, - 9, 20, 20, 20, 8, 20, 20, 11, 20, 13, - 20, 20, 20, 20, 7, 20, 20, 19, 2 + 28, 28, 35, 33, 34, 26, 33, 34, 26, 34, + 33, 34, 33, 34, 33, 34, 33, 34, 33, 34, + 25, 33, 34, 25, 33, 34, 22, 33, 34, 33, + 34, 22, 33, 34, 22, 33, 34, 22, 33, 34, + 22, 33, 34, 22, 33, 34, 22, 33, 34, 22, + 33, 34, 22, 33, 34, 28, 34, 29, 34, 31, + 34, 26, 24, 23, 25, 27, 1, 22, 22, 22, + 22, 22, 22, 22, 17, 22, 22, 22, 22, 22, + 28, 29, 29, 32, 31, 30, 31, 23, 1, 25, + 25, 5, 22, 22, 22, 10, 22, 12, 22, 22, + + 22, 4, 22, 16, 22, 22, 22, 22, 20, 18, + 19, 3, 6, 22, 22, 9, 22, 13, 22, 22, + 22, 8, 22, 22, 22, 11, 22, 15, 22, 22, + 22, 22, 22, 22, 7, 22, 22, 22, 22, 22, + 21, 2, 14, 22 } ; -static yyconst short int yy_accept[109] = +static yyconst short int yy_accept[120] = { 0, 1, 1, 1, 2, 3, 4, 6, 9, 11, 13, 15, 17, 19, 21, 24, 27, 30, 32, 35, 38, - 41, 44, 47, 50, 53, 55, 57, 59, 60, 60, - 60, 61, 62, 63, 64, 65, 65, 65, 66, 66, - 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 84, 84, 84, - 85, 86, 87, 88, 88, 88, 90, 91, 92, 94, - 96, 97, 98, 100, 102, 103, 104, 105, 106, 107, - 107, 107, 108, 110, 111, 113, 114, 115, 117, 118, - 118, 120, 122, 123, 124, 124, 125, 127, 127, 128, + 41, 44, 47, 50, 53, 56, 58, 60, 62, 63, + 63, 63, 64, 65, 66, 67, 68, 68, 68, 69, + 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, + 88, 88, 89, 90, 91, 92, 92, 92, 94, 95, + 96, 98, 100, 101, 102, 104, 106, 107, 108, 109, + 110, 111, 112, 112, 112, 113, 115, 116, 118, 120, + 121, 122, 124, 125, 126, 126, 128, 130, 131, 132, - 128, 128, 128, 128, 129, 129, 130, 130 + 133, 133, 134, 135, 137, 137, 138, 139, 139, 139, + 140, 140, 140, 141, 142, 142, 143, 145, 145 } ; static yyconst int yy_ec[256] = @@ -355,9 +358,9 @@ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 1, 17, 1, 15, 1, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 15, 15, 27, 15, 28, - 29, 15, 15, 30, 31, 32, 33, 15, 15, 34, - 15, 15, 35, 1, 36, 1, 1, 1, 1, 1, + 22, 23, 24, 25, 26, 15, 15, 27, 28, 29, + 30, 15, 15, 31, 32, 33, 34, 15, 15, 35, + 15, 15, 36, 1, 37, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -374,108 +377,114 @@ 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[37] = +static yyconst int yy_meta[38] = { 0, 1, 1, 2, 1, 1, 1, 1, 3, 1, 3, 4, 4, 4, 5, 6, 1, 1, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 1, 1 + 6, 6, 6, 6, 6, 1, 1 } ; -static yyconst short int yy_base[121] = +static yyconst short int yy_base[132] = { 0, - 0, 0, 29, 30, 207, 208, 39, 42, 175, 199, - 0, 36, 42, 42, 45, 0, 169, 177, 33, 41, - 176, 173, 42, 168, 0, 57, 61, 70, 45, 193, - 208, 0, 67, 208, 0, 70, 0, 0, 162, 165, - 178, 174, 170, 170, 170, 63, 159, 159, 159, 0, - 76, 77, 208, 80, 208, 81, 161, 74, 157, 0, - 0, 82, 0, 150, 168, 153, 152, 160, 0, 0, - 154, 153, 0, 0, 147, 152, 208, 208, 208, 157, - 140, 208, 0, 144, 0, 153, 140, 0, 144, 142, - 0, 0, 149, 145, 140, 145, 0, 122, 94, 104, - - 96, 68, 60, 208, 45, 208, 208, 102, 108, 110, - 113, 119, 125, 131, 134, 140, 143, 148, 154, 160 + 0, 0, 30, 31, 218, 219, 40, 43, 185, 210, + 0, 37, 43, 43, 46, 0, 179, 188, 33, 43, + 187, 183, 42, 177, 177, 0, 59, 62, 71, 46, + 203, 219, 0, 69, 219, 0, 72, 0, 0, 171, + 174, 188, 184, 180, 180, 180, 56, 168, 168, 172, + 167, 0, 77, 78, 219, 82, 219, 83, 170, 76, + 165, 0, 0, 84, 0, 158, 177, 161, 160, 169, + 0, 162, 162, 161, 0, 0, 154, 153, 159, 219, + 219, 219, 164, 146, 219, 0, 150, 0, 0, 160, + 146, 0, 153, 149, 147, 0, 0, 155, 155, 150, + + 144, 150, 144, 0, 150, 95, 151, 126, 98, 92, + 69, 93, 34, 219, 46, 219, 0, 219, 104, 110, + 112, 115, 121, 127, 133, 136, 142, 145, 150, 156, + 162 } ; -static yyconst short int yy_def[121] = +static yyconst short int yy_def[132] = { 0, - 107, 1, 108, 108, 107, 107, 107, 107, 107, 109, - 110, 107, 107, 107, 107, 111, 107, 111, 111, 111, - 111, 111, 111, 111, 112, 113, 114, 107, 107, 109, - 107, 115, 107, 107, 116, 107, 117, 111, 118, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, - 113, 113, 107, 114, 107, 114, 107, 107, 107, 115, - 116, 107, 117, 118, 119, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 107, 107, 107, 107, - 118, 107, 111, 111, 111, 111, 111, 111, 111, 107, - 111, 111, 111, 111, 107, 111, 111, 107, 111, 107, - - 107, 107, 120, 107, 120, 107, 0, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107 + 118, 1, 119, 119, 118, 118, 118, 118, 118, 120, + 121, 118, 118, 118, 118, 122, 118, 122, 122, 122, + 122, 122, 122, 122, 122, 123, 124, 125, 118, 118, + 120, 118, 126, 118, 118, 127, 118, 128, 122, 129, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 123, 124, 124, 118, 125, 118, 125, 118, 118, + 118, 126, 127, 118, 128, 129, 130, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 118, + 118, 118, 118, 129, 118, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 118, 122, 122, 122, 122, 122, + + 118, 122, 122, 122, 118, 122, 122, 118, 118, 122, + 118, 131, 122, 118, 131, 118, 122, 0, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118 } ; -static yyconst short int yy_nxt[245] = +static yyconst short int yy_nxt[257] = { 0, 6, 7, 8, 7, 9, 10, 11, 6, 12, 13, 14, 15, 15, 16, 16, 17, 6, 16, 18, 19, - 20, 16, 21, 16, 16, 22, 23, 16, 16, 16, - 24, 16, 16, 16, 6, 6, 26, 26, 27, 27, - 28, 28, 28, 28, 28, 28, 33, 33, 33, 34, - 106, 35, 33, 33, 33, 33, 33, 33, 43, 41, - 36, 42, 44, 47, 52, 106, 53, 48, 55, 57, - 56, 28, 28, 28, 58, 37, 59, 33, 33, 33, - 62, 62, 72, 107, 52, 107, 53, 107, 107, 107, - 56, 78, 62, 62, 73, 101, 101, 101, 101, 104, - - 79, 103, 25, 25, 25, 25, 25, 25, 30, 30, - 30, 30, 30, 30, 32, 32, 38, 38, 38, 50, - 50, 102, 50, 50, 50, 51, 51, 51, 51, 51, - 51, 54, 54, 54, 54, 54, 54, 60, 60, 60, - 61, 100, 61, 61, 61, 61, 63, 63, 64, 64, - 64, 64, 64, 64, 81, 81, 81, 81, 81, 81, - 105, 105, 105, 105, 105, 105, 99, 98, 97, 96, - 95, 94, 93, 92, 91, 65, 90, 89, 88, 87, - 86, 85, 84, 83, 82, 65, 80, 77, 76, 75, - 74, 71, 70, 69, 68, 67, 66, 65, 31, 49, - - 46, 45, 40, 39, 31, 29, 107, 5, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107 + 20, 16, 21, 16, 16, 22, 23, 24, 16, 16, + 16, 25, 16, 16, 16, 6, 6, 27, 27, 28, + 28, 29, 29, 29, 29, 29, 29, 34, 34, 34, + 35, 116, 36, 34, 34, 34, 34, 34, 34, 42, + 44, 37, 43, 48, 45, 117, 54, 49, 55, 57, + 59, 58, 29, 29, 29, 74, 60, 38, 61, 34, + 34, 34, 64, 64, 118, 54, 118, 55, 75, 118, + 118, 118, 58, 81, 64, 64, 109, 109, 116, 109, + + 109, 114, 82, 112, 26, 26, 26, 26, 26, 26, + 31, 31, 31, 31, 31, 31, 33, 33, 39, 39, + 39, 52, 52, 113, 52, 52, 52, 53, 53, 53, + 53, 53, 53, 56, 56, 56, 56, 56, 56, 62, + 62, 62, 63, 111, 63, 63, 63, 63, 65, 65, + 66, 66, 66, 66, 66, 66, 84, 84, 84, 84, + 84, 84, 115, 115, 115, 115, 115, 115, 110, 108, + 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, + 97, 96, 67, 95, 94, 93, 92, 91, 90, 89, + 88, 87, 86, 85, 67, 83, 80, 79, 78, 77, + + 76, 73, 72, 71, 70, 69, 68, 67, 32, 51, + 50, 47, 46, 41, 40, 32, 30, 118, 5, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118 } ; -static yyconst short int yy_chk[245] = +static yyconst short int yy_chk[257] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 4, 3, 4, - 7, 7, 7, 8, 8, 8, 12, 12, 12, 13, - 105, 13, 14, 14, 14, 15, 15, 15, 20, 19, - 14, 19, 20, 23, 26, 103, 26, 23, 27, 29, - 27, 28, 28, 28, 29, 14, 29, 33, 33, 33, - 36, 36, 46, 51, 52, 51, 52, 54, 56, 54, - 56, 58, 62, 62, 46, 99, 99, 101, 101, 102, - - 58, 101, 108, 108, 108, 108, 108, 108, 109, 109, - 109, 109, 109, 109, 110, 110, 111, 111, 111, 112, - 112, 100, 112, 112, 112, 113, 113, 113, 113, 113, - 113, 114, 114, 114, 114, 114, 114, 115, 115, 115, - 116, 98, 116, 116, 116, 116, 117, 117, 118, 118, - 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, - 120, 120, 120, 120, 120, 120, 96, 95, 94, 93, - 90, 89, 87, 86, 84, 81, 80, 76, 75, 72, - 71, 68, 67, 66, 65, 64, 59, 57, 49, 48, - 47, 45, 44, 43, 42, 41, 40, 39, 30, 24, - - 22, 21, 18, 17, 10, 9, 5, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107 + 1, 1, 1, 1, 1, 1, 1, 3, 4, 3, + 4, 7, 7, 7, 8, 8, 8, 12, 12, 12, + 13, 115, 13, 14, 14, 14, 15, 15, 15, 19, + 20, 14, 19, 23, 20, 113, 27, 23, 27, 28, + 30, 28, 29, 29, 29, 47, 30, 14, 30, 34, + 34, 34, 37, 37, 53, 54, 53, 54, 47, 56, + 58, 56, 58, 60, 64, 64, 106, 106, 112, 109, + + 109, 111, 60, 109, 119, 119, 119, 119, 119, 119, + 120, 120, 120, 120, 120, 120, 121, 121, 122, 122, + 122, 123, 123, 110, 123, 123, 123, 124, 124, 124, + 124, 124, 124, 125, 125, 125, 125, 125, 125, 126, + 126, 126, 127, 108, 127, 127, 127, 127, 128, 128, + 129, 129, 129, 129, 129, 129, 130, 130, 130, 130, + 130, 130, 131, 131, 131, 131, 131, 131, 107, 105, + 103, 102, 101, 100, 99, 98, 95, 94, 93, 91, + 90, 87, 84, 83, 79, 78, 77, 74, 73, 72, + 70, 69, 68, 67, 66, 61, 59, 51, 50, 49, + + 48, 46, 45, 44, 43, 42, 41, 40, 31, 25, + 24, 22, 21, 18, 17, 10, 9, 5, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -651,7 +660,7 @@ using namespace llvm; -#line 655 "Lexer.cpp" +#line 664 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -805,7 +814,7 @@ #line 180 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -#line 809 "Lexer.cpp" +#line 818 "Lexer.cpp" if ( yy_init ) { @@ -853,14 +862,14 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 108 ) + if ( yy_current_state >= 119 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_current_state != 107 ); + while ( yy_current_state != 118 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -960,111 +969,121 @@ case 13: YY_RULE_SETUP #line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ return FIELD; } +{ return DEFM; } YY_BREAK case 14: YY_RULE_SETUP #line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ return LET; } +{ return MULTICLASS; } YY_BREAK case 15: YY_RULE_SETUP #line 200 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ return IN; } +{ return FIELD; } YY_BREAK case 16: YY_RULE_SETUP -#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ return SRATOK; } +#line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ return LET; } YY_BREAK case 17: YY_RULE_SETUP -#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ return SRLTOK; } +#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ return IN; } YY_BREAK case 18: YY_RULE_SETUP #line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ return SHLTOK; } +{ return SRATOK; } YY_BREAK case 19: YY_RULE_SETUP #line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ return STRCONCATTOK; } +{ return SRLTOK; } YY_BREAK case 20: YY_RULE_SETUP -#line 208 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ Filelval.StrVal = new std::string(yytext, yytext+yyleng); - return ID; } +#line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ return SHLTOK; } YY_BREAK case 21: YY_RULE_SETUP -#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); - return VARNAME; } +#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ return STRCONCATTOK; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); - return STRVAL; } +#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ Filelval.StrVal = new std::string(yytext, yytext+yyleng); + return ID; } YY_BREAK case 23: YY_RULE_SETUP -#line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ Filelval.IntVal = ParseInt(Filetext); return INTVAL; } +#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); + return VARNAME; } YY_BREAK case 24: YY_RULE_SETUP -#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ /* Ignore whitespace */ } +#line 215 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); + return STRVAL; } YY_BREAK case 25: YY_RULE_SETUP -#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ BEGIN(comment); CommentDepth++; } +#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ Filelval.IntVal = ParseInt(Filetext); return INTVAL; } YY_BREAK case 26: YY_RULE_SETUP -#line 222 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{} /* eat anything that's not a '*' or '/' */ +#line 220 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ /* Ignore whitespace */ } YY_BREAK case 27: YY_RULE_SETUP #line 223 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{} /* eat up '*'s not followed by '/'s */ +{ BEGIN(comment); CommentDepth++; } YY_BREAK case 28: YY_RULE_SETUP #line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ ++CommentDepth; } +{} /* eat anything that's not a '*' or '/' */ YY_BREAK case 29: YY_RULE_SETUP #line 225 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{} /* eat up /'s not followed by *'s */ +{} /* eat up '*'s not followed by '/'s */ YY_BREAK case 30: YY_RULE_SETUP #line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ ++CommentDepth; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 227 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{} /* eat up /'s not followed by *'s */ + YY_BREAK +case 32: +YY_RULE_SETUP +#line 228 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { if (!--CommentDepth) { BEGIN(INITIAL); } } YY_BREAK case YY_STATE_EOF(comment): -#line 227 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { err() << "Unterminated comment!\n"; exit(1); } YY_BREAK -case 31: +case 33: YY_RULE_SETUP -#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return Filetext[0]; } YY_BREAK -case 32: +case 34: YY_RULE_SETUP -#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1068 "Lexer.cpp" +#line 1087 "Lexer.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1353,7 +1372,7 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 108 ) + if ( yy_current_state >= 119 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1383,11 +1402,11 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 108 ) + if ( yy_current_state >= 119 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 107); + yy_is_jam = (yy_current_state == 118); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -1948,6 +1967,6 @@ return 0; } #endif -#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" Index: llvm/utils/TableGen/FileLexer.l.cvs diff -u llvm/utils/TableGen/FileLexer.l.cvs:1.4 llvm/utils/TableGen/FileLexer.l.cvs:1.5 --- llvm/utils/TableGen/FileLexer.l.cvs:1.4 Fri Mar 31 15:54:11 2006 +++ llvm/utils/TableGen/FileLexer.l.cvs Fri Sep 1 16:14:42 2006 @@ -195,6 +195,8 @@ class { return CLASS; } def { return DEF; } +defm { return DEFM; } +multiclass { return MULTICLASS; } field { return FIELD; } let { return LET; } in { return IN; } Index: llvm/utils/TableGen/FileParser.cpp.cvs diff -u llvm/utils/TableGen/FileParser.cpp.cvs:1.3 llvm/utils/TableGen/FileParser.cpp.cvs:1.4 --- llvm/utils/TableGen/FileParser.cpp.cvs:1.3 Fri Mar 31 15:54:11 2006 +++ llvm/utils/TableGen/FileParser.cpp.cvs Fri Sep 1 16:14:42 2006 @@ -20,18 +20,20 @@ #define DAG 263 #define CLASS 264 #define DEF 265 -#define FIELD 266 -#define LET 267 -#define IN 268 -#define SHLTOK 269 -#define SRATOK 270 -#define SRLTOK 271 -#define STRCONCATTOK 272 -#define INTVAL 273 -#define ID 274 -#define VARNAME 275 -#define STRVAL 276 -#define CODEFRAGMENT 277 +#define MULTICLASS 266 +#define DEFM 267 +#define FIELD 268 +#define LET 269 +#define IN 270 +#define SHLTOK 271 +#define SRATOK 272 +#define SRLTOK 273 +#define STRCONCATTOK 274 +#define INTVAL 275 +#define ID 276 +#define VARNAME 277 +#define STRVAL 278 +#define CODEFRAGMENT 279 #line 14 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" @@ -45,8 +47,19 @@ int yylex(); namespace llvm { + struct MultiClass { + Record Rec; // Placeholder for template args and Name. + std::vector DefPrototypes; + + MultiClass(const std::string &Name) : Rec(Name) {} + }; + +static std::map MultiClasses; + extern int Filelineno; +static MultiClass *CurMultiClass = 0; // Set while parsing a multiclass. +static std::string *CurDefmPrefix = 0; // Set while parsing defm. static Record *CurRec = 0; static bool ParsingTemplateArgs = false; @@ -68,8 +81,16 @@ extern std::ostream &err(); +/// getActiveRec - If inside a def/class definition, return the def/class. +/// Otherwise, if within a multidef, return it. +static Record *getActiveRec() { + return CurRec ? CurRec : &CurMultiClass->Rec; +} + static void addValue(const RecordVal &RV) { - if (RecordVal *ERV = CurRec->getValue(RV.getName())) { + Record *TheRec = getActiveRec(); + + if (RecordVal *ERV = TheRec->getValue(RV.getName())) { // The value already exists in the class, treat this as a set... if (ERV->setValue(RV.getValue())) { err() << "New definition of '" << RV.getName() << "' of type '" @@ -78,7 +99,7 @@ exit(1); } } else { - CurRec->addValue(RV); + TheRec->addValue(RV); } } @@ -171,33 +192,33 @@ if (TArgs.size() < TemplateArgs.size()) { err() << "ERROR: More template args specified than expected!\n"; exit(1); - } else { // This class expects template arguments... - // Loop over all of the template arguments, setting them to the specified - // value or leaving them as the default if necessary. - for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { - if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? - // Set it now. - setValue(TArgs[i], 0, TemplateArgs[i]); - - // Resolve it next. - CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); - - - // Now remove it. - CurRec->removeValue(TArgs[i]); - - } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { - err() << "ERROR: Value not specified for template argument #" - << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() - << "'!\n"; - exit(1); - } + } + + // Loop over all of the template arguments, setting them to the specified + // value or leaving them as the default if necessary. + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? + // Set it now. + setValue(TArgs[i], 0, TemplateArgs[i]); + + // Resolve it next. + CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); + + + // Now remove it. + CurRec->removeValue(TArgs[i]); + + } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { + err() << "ERROR: Value not specified for template argument #" + << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() + << "'!\n"; + exit(1); } } // Since everything went well, we can now set the "superclass" list for the // current record. - const std::vector &SCs = SC->getSuperClasses(); + const std::vector &SCs = SC->getSuperClasses(); for (unsigned i = 0, e = SCs.size(); i != e; ++i) addSuperClass(SCs[i]); addSuperClass(SC); @@ -208,7 +229,7 @@ using namespace llvm; -#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 208 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" typedef union { std::string* StrVal; int IntVal; @@ -217,6 +238,7 @@ std::vector* FieldList; std::vector* BitList; llvm::Record* Rec; + std::vector* RecList; SubClassRefTy* SubClassRef; std::vector* SubClassList; std::vector >* DagValueList; @@ -231,26 +253,26 @@ -#define YYFINAL 168 +#define YYFINAL 188 #define YYFLAG -32768 -#define YYNTBASE 39 +#define YYNTBASE 41 -#define YYTRANSLATE(x) ((unsigned)(x) <= 277 ? yytranslate[x] : 80) +#define YYTRANSLATE(x) ((unsigned)(x) <= 279 ? yytranslate[x] : 90) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 33, - 34, 2, 2, 35, 37, 32, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 36, 38, 24, - 26, 25, 27, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 35, + 36, 2, 2, 37, 39, 34, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 38, 40, 26, + 28, 27, 29, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 30, 2, 31, 2, 2, 2, 2, 2, 2, 2, + 32, 2, 33, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 28, 2, 29, 2, 2, 2, 2, 2, + 2, 2, 30, 2, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -265,7 +287,7 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23 + 17, 18, 19, 20, 21, 22, 23, 24, 25 }; #if YYDEBUG != 0 @@ -278,53 +300,60 @@ 163, 166, 173, 174, 177, 179, 183, 185, 190, 192, 196, 197, 200, 202, 206, 210, 211, 213, 215, 216, 218, 220, 222, 223, 227, 228, 229, 236, 240, 242, - 244, 249, 251, 255, 256, 261, 266, 269, 271, 274 + 244, 247, 249, 250, 251, 260, 261, 268, 270, 272, + 274, 276, 281, 283, 287, 288, 293, 298, 301, 303, + 306 }; -static const short yyrhs[] = { 20, - 0, 5, 0, 4, 0, 6, 24, 19, 25, 0, - 3, 0, 7, 24, 40, 25, 0, 8, 0, 9, - 0, 39, 0, 0, 12, 0, 0, 26, 44, 0, - 20, 0, 43, 0, 19, 0, 22, 0, 23, 0, - 27, 0, 28, 51, 29, 0, 20, 24, 52, 25, - 0, 44, 28, 49, 29, 0, 30, 51, 31, 0, - 44, 32, 20, 0, 33, 43, 47, 34, 0, 44, - 30, 49, 31, 0, 15, 33, 44, 35, 44, 34, - 0, 16, 33, 44, 35, 44, 34, 0, 17, 33, - 44, 35, 44, 34, 0, 18, 33, 44, 35, 44, - 34, 0, 0, 36, 21, 0, 44, 45, 0, 46, - 35, 44, 45, 0, 0, 46, 0, 19, 0, 19, - 37, 19, 0, 19, 19, 0, 48, 35, 19, 0, - 48, 35, 19, 37, 19, 0, 48, 35, 19, 19, - 0, 48, 0, 0, 28, 49, 29, 0, 0, 52, - 0, 44, 0, 52, 35, 44, 0, 41, 40, 20, - 42, 0, 53, 38, 0, 13, 20, 50, 26, 44, - 38, 0, 0, 55, 54, 0, 38, 0, 28, 55, - 29, 0, 39, 0, 39, 24, 52, 25, 0, 57, - 0, 58, 35, 57, 0, 0, 36, 58, 0, 53, - 0, 60, 35, 53, 0, 24, 60, 25, 0, 0, - 61, 0, 20, 0, 0, 63, 0, 64, 0, 64, - 0, 0, 59, 68, 56, 0, 0, 0, 10, 65, - 70, 62, 71, 67, 0, 11, 66, 67, 0, 69, - 0, 72, 0, 20, 50, 26, 44, 0, 74, 0, - 75, 35, 74, 0, 0, 13, 77, 75, 14, 0, - 76, 28, 78, 29, 0, 76, 73, 0, 73, 0, - 78, 73, 0, 78, 0 +static const short yyrhs[] = { 22, + 0, 5, 0, 4, 0, 6, 26, 21, 27, 0, + 3, 0, 7, 26, 42, 27, 0, 8, 0, 9, + 0, 41, 0, 0, 14, 0, 0, 28, 46, 0, + 22, 0, 45, 0, 21, 0, 24, 0, 25, 0, + 29, 0, 30, 53, 31, 0, 22, 26, 54, 27, + 0, 46, 30, 51, 31, 0, 32, 53, 33, 0, + 46, 34, 22, 0, 35, 45, 49, 36, 0, 46, + 32, 51, 33, 0, 17, 35, 46, 37, 46, 36, + 0, 18, 35, 46, 37, 46, 36, 0, 19, 35, + 46, 37, 46, 36, 0, 20, 35, 46, 37, 46, + 36, 0, 0, 38, 23, 0, 46, 47, 0, 48, + 37, 46, 47, 0, 0, 48, 0, 21, 0, 21, + 39, 21, 0, 21, 21, 0, 50, 37, 21, 0, + 50, 37, 21, 39, 21, 0, 50, 37, 21, 21, + 0, 50, 0, 0, 30, 51, 31, 0, 0, 54, + 0, 46, 0, 54, 37, 46, 0, 43, 42, 22, + 44, 0, 55, 40, 0, 15, 22, 52, 28, 46, + 40, 0, 0, 57, 56, 0, 40, 0, 30, 57, + 31, 0, 41, 0, 41, 26, 54, 27, 0, 59, + 0, 60, 37, 59, 0, 0, 38, 60, 0, 55, + 0, 62, 37, 55, 0, 26, 62, 27, 0, 0, + 63, 0, 22, 0, 0, 65, 0, 66, 0, 66, + 0, 0, 61, 70, 58, 0, 0, 0, 10, 67, + 72, 64, 73, 69, 0, 11, 68, 69, 0, 74, + 0, 75, 0, 76, 75, 0, 22, 0, 0, 0, + 12, 77, 79, 64, 80, 30, 76, 31, 0, 0, + 13, 22, 82, 38, 59, 40, 0, 71, 0, 74, + 0, 78, 0, 81, 0, 22, 52, 28, 46, 0, + 84, 0, 85, 37, 84, 0, 0, 15, 87, 85, + 16, 0, 86, 30, 88, 31, 0, 86, 83, 0, + 83, 0, 88, 83, 0, 88, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 223, 234, 236, 238, 240, 242, 244, 246, 248, 252, - 252, 254, 254, 256, 273, 275, 277, 280, 283, 285, - 298, 326, 333, 336, 343, 346, 354, 356, 358, 360, - 364, 367, 371, 376, 382, 385, 388, 391, 404, 418, - 420, 433, 449, 451, 451, 455, 457, 461, 464, 468, - 478, 480, 486, 486, 487, 487, 489, 491, 495, 500, - 505, 508, 512, 515, 520, 521, 521, 523, 523, 525, - 532, 550, 562, 576, 581, 583, 585, 589, 598, 598, - 600, 605, 605, 608, 608, 611, 614, 618, 618, 620 + 244, 266, 268, 270, 272, 274, 276, 278, 280, 284, + 284, 286, 286, 288, 311, 313, 315, 318, 321, 323, + 336, 364, 371, 374, 381, 384, 392, 394, 396, 398, + 402, 405, 409, 414, 420, 423, 426, 429, 442, 456, + 458, 471, 487, 489, 489, 493, 495, 499, 502, 506, + 523, 525, 531, 531, 532, 532, 534, 536, 540, 545, + 550, 553, 557, 560, 565, 566, 566, 568, 568, 570, + 577, 595, 620, 634, 639, 641, 643, 647, 656, 670, + 673, 677, 688, 690, 692, 697, 697, 759, 759, 760, + 760, 762, 767, 767, 770, 770, 773, 776, 780, 780, + 782 }; #endif @@ -332,28 +361,32 @@ #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","INT","BIT", -"STRING","BITS","LIST","CODE","DAG","CLASS","DEF","FIELD","LET","IN","SHLTOK", -"SRATOK","SRLTOK","STRCONCATTOK","INTVAL","ID","VARNAME","STRVAL","CODEFRAGMENT", -"'<'","'>'","'='","'?'","'{'","'}'","'['","']'","'.'","'('","')'","','","':'", -"'-'","';'","ClassID","Type","OptPrefix","OptValue","IDValue","Value","OptVarName", -"DagArgListNE","DagArgList","RBitList","BitList","OptBitList","ValueList","ValueListNE", -"Declaration","BodyItem","BodyList","Body","SubClassRef","ClassListNE","ClassList", -"DeclListNE","TemplateArgList","OptTemplateArgList","OptID","ObjectName","ClassName", -"DefName","ObjectBody","@1","ClassInst","@2","@3","DefInst","Object","LETItem", -"LETList","LETCommand","@4","ObjectList","File", NULL +"STRING","BITS","LIST","CODE","DAG","CLASS","DEF","MULTICLASS","DEFM","FIELD", +"LET","IN","SHLTOK","SRATOK","SRLTOK","STRCONCATTOK","INTVAL","ID","VARNAME", +"STRVAL","CODEFRAGMENT","'<'","'>'","'='","'?'","'{'","'}'","'['","']'","'.'", +"'('","')'","','","':'","'-'","';'","ClassID","Type","OptPrefix","OptValue", +"IDValue","Value","OptVarName","DagArgListNE","DagArgList","RBitList","BitList", +"OptBitList","ValueList","ValueListNE","Declaration","BodyItem","BodyList","Body", +"SubClassRef","ClassListNE","ClassList","DeclListNE","TemplateArgList","OptTemplateArgList", +"OptID","ObjectName","ClassName","DefName","ObjectBody","@1","ClassInst","@2", +"@3","DefInst","MultiClassDef","MultiClassBody","MultiClassName","MultiClassInst", +"@4","@5","DefMInst","@6","Object","LETItem","LETList","LETCommand","@7","ObjectList", +"File", NULL }; #endif static const short yyr1[] = { 0, - 39, 40, 40, 40, 40, 40, 40, 40, 40, 41, - 41, 42, 42, 43, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 45, 45, 46, 46, 47, 47, 48, 48, 48, 48, - 48, 48, 49, 50, 50, 51, 51, 52, 52, 53, - 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, - 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, - 65, 66, 68, 67, 70, 71, 69, 72, 73, 73, - 74, 75, 75, 77, 76, 73, 73, 78, 78, 79 + 41, 42, 42, 42, 42, 42, 42, 42, 42, 43, + 43, 44, 44, 45, 46, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, + 47, 47, 48, 48, 49, 49, 50, 50, 50, 50, + 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, + 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, + 61, 61, 62, 62, 63, 64, 64, 65, 65, 66, + 67, 68, 70, 69, 72, 73, 71, 74, 75, 76, + 76, 77, 79, 80, 78, 82, 81, 83, 83, 83, + 83, 84, 85, 85, 87, 86, 83, 83, 88, 88, + 89 }; static const short yyr2[] = { 0, @@ -365,107 +398,121 @@ 2, 6, 0, 2, 1, 3, 1, 4, 1, 3, 0, 2, 1, 3, 3, 0, 1, 1, 0, 1, 1, 1, 0, 3, 0, 0, 6, 3, 1, 1, - 4, 1, 3, 0, 4, 4, 2, 1, 2, 1 + 2, 1, 0, 0, 8, 0, 6, 1, 1, 1, + 1, 4, 1, 3, 0, 4, 4, 2, 1, 2, + 1 }; static const short yydefact[] = { 0, - 69, 69, 84, 79, 80, 88, 0, 90, 68, 70, - 71, 75, 72, 61, 0, 0, 87, 89, 66, 0, - 73, 78, 44, 82, 0, 0, 10, 67, 76, 1, - 57, 59, 62, 0, 0, 0, 85, 0, 86, 11, - 0, 63, 0, 61, 0, 0, 53, 55, 74, 37, - 43, 0, 0, 83, 5, 3, 2, 0, 0, 7, - 8, 9, 0, 65, 10, 77, 0, 0, 0, 0, - 16, 14, 17, 18, 19, 46, 46, 0, 15, 48, - 0, 60, 10, 39, 0, 0, 45, 81, 0, 0, - 12, 64, 0, 0, 0, 0, 0, 0, 47, 0, - 14, 35, 0, 0, 0, 58, 0, 0, 56, 0, - 54, 38, 40, 0, 0, 0, 50, 0, 0, 0, - 0, 0, 20, 23, 31, 36, 0, 0, 0, 24, - 49, 44, 51, 42, 0, 4, 6, 13, 0, 0, + 69, 69, 0, 0, 95, 88, 89, 90, 91, 99, + 0, 101, 68, 70, 71, 75, 72, 61, 82, 83, + 86, 0, 0, 98, 100, 66, 0, 73, 78, 66, + 0, 44, 93, 0, 0, 10, 67, 76, 1, 57, + 59, 62, 0, 84, 0, 0, 0, 96, 0, 97, + 11, 0, 63, 0, 61, 0, 0, 53, 55, 74, + 0, 0, 37, 43, 0, 0, 94, 5, 3, 2, + 0, 0, 7, 8, 9, 0, 65, 10, 77, 0, + 0, 0, 0, 16, 14, 17, 18, 19, 46, 46, + 0, 15, 48, 0, 60, 10, 0, 87, 39, 0, + 0, 45, 92, 0, 0, 12, 64, 0, 0, 0, + 0, 0, 0, 47, 0, 14, 35, 0, 0, 0, + 58, 0, 0, 56, 0, 54, 79, 80, 0, 38, + 40, 0, 0, 0, 50, 0, 0, 0, 0, 0, + 20, 23, 31, 36, 0, 0, 0, 24, 49, 44, + 51, 85, 81, 42, 0, 4, 6, 13, 0, 0, 0, 0, 21, 0, 33, 0, 25, 22, 26, 0, 41, 0, 0, 0, 0, 32, 31, 0, 27, 28, 29, 30, 34, 0, 52, 0, 0, 0 }; -static const short yydefgoto[] = { 31, - 63, 41, 117, 79, 80, 145, 126, 127, 51, 52, - 36, 98, 99, 42, 111, 83, 49, 32, 33, 21, - 43, 28, 29, 10, 11, 12, 14, 22, 34, 4, - 19, 44, 5, 6, 24, 25, 7, 15, 8, 166 +static const short yydefgoto[] = { 40, + 76, 52, 135, 92, 93, 165, 144, 145, 64, 65, + 47, 113, 114, 53, 126, 96, 60, 41, 42, 28, + 54, 37, 38, 14, 15, 16, 18, 29, 43, 6, + 26, 55, 7, 128, 129, 20, 8, 30, 61, 9, + 31, 10, 33, 34, 11, 22, 12, 186 }; -static const short yypact[] = { 67, - -14, -14,-32768,-32768,-32768,-32768, 19, 67,-32768,-32768, --32768,-32768,-32768, -3, 63, 67,-32768,-32768, 60, 65, --32768,-32768, 7,-32768, -11, -6, 79,-32768,-32768,-32768, - 71,-32768, 4, -16, 82, 73,-32768, 63,-32768,-32768, - 61,-32768, 11, -3, -2, 65,-32768,-32768,-32768, 0, - 72, 98, -2,-32768,-32768,-32768,-32768, 105, 106,-32768, --32768,-32768, 111,-32768, 79,-32768, 99, 100, 101, 102, --32768, 112,-32768,-32768,-32768, -2, -2, 117,-32768, 96, - 23,-32768, 32,-32768, 119, 120,-32768, 96, 121, 61, - 115,-32768, -2, -2, -2, -2, -2, 113, 108, 114, --32768, -2, 82, 82, 124,-32768, -2, 126,-32768, 109, --32768,-32768, 15, 123, 125, -2,-32768, 27, 62, 68, - 74, 25,-32768,-32768, 43, 116, 118, 127, 122,-32768, - 96, 7,-32768,-32768, 130,-32768,-32768, 96, -2, -2, - -2, -2,-32768, 133,-32768, -2,-32768,-32768,-32768, 129, --32768, 80, 83, 88, 91,-32768, 43, -2,-32768,-32768, --32768,-32768,-32768, 44,-32768, 157, 158,-32768 +static const short yypact[] = { 129, + 3, 3, 11, 19,-32768,-32768,-32768,-32768,-32768,-32768, + 2, 129,-32768,-32768,-32768,-32768,-32768, 29,-32768,-32768, +-32768, 24, 129,-32768,-32768, 43, 31,-32768,-32768, 43, + 40, 50,-32768, -6, -4, 69,-32768,-32768,-32768, 59, +-32768, 61, 10,-32768, 31, 81, 78,-32768, 24,-32768, +-32768, 15,-32768, 12, 29, 41, 31,-32768,-32768,-32768, + 84, 68, 8, 83, 87, 41,-32768,-32768,-32768,-32768, + 111, 120,-32768,-32768,-32768, 126,-32768, 69,-32768, 114, + 115, 116, 117,-32768, 127,-32768,-32768,-32768, 41, 41, + 132,-32768, 113, 27,-32768, 60, 144,-32768,-32768, 135, + 136,-32768, 113, 137, 15, 131,-32768, 41, 41, 41, + 41, 41, 130, 123, 133,-32768, 41, 81, 81, 140, +-32768, 41, 141,-32768, 124,-32768,-32768,-32768, 5,-32768, + 9, 138, 142, 41,-32768, 67, 73, 79, 85, 45, +-32768,-32768, 54, 134, 139, 143, 145,-32768, 113, 50, +-32768,-32768,-32768,-32768, 146,-32768,-32768, 113, 41, 41, + 41, 41,-32768, 147,-32768, 41,-32768,-32768,-32768, 148, +-32768, 91, 94, 99, 102,-32768, 54, 41,-32768,-32768, +-32768,-32768,-32768, 47,-32768, 168, 172,-32768 }; -static const short yypgoto[] = { -39, - 69,-32768,-32768, 84, -53, 3,-32768,-32768,-32768, -93, - 29, 86, -44, -27,-32768,-32768,-32768, 128,-32768,-32768, --32768,-32768,-32768,-32768, 162,-32768,-32768, 131,-32768,-32768, --32768,-32768,-32768, 1, 132,-32768,-32768,-32768, 149,-32768 +static const short yypgoto[] = { -50, + 72,-32768,-32768, 82, -66, 4,-32768,-32768,-32768, -29, + 30, 89, -55, -44,-32768,-32768,-32768, -19,-32768,-32768, +-32768,-32768, 152,-32768, 181,-32768,-32768, 149,-32768,-32768, +-32768,-32768, -94, 55,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -7, 150,-32768,-32768,-32768, 162,-32768 }; -#define YYLAST 175 +#define YYLAST 204 -static const short yytable[] = { 88, - 81, 62, 37, 1, 2, 9, 3, 17, 18, 128, - 129, 47, 67, 68, 69, 70, 71, 72, 84, 73, - 74, 48, 39, 38, 75, 76, 18, 77, 1, 2, - 78, 3, 20, 134, 35, 64, 85, 92, 46, 118, - 119, 120, 121, 40, 108, 65, 16, 106, 125, 143, - 62, 135, 122, 131, 103, 110, 104, 107, 105, 107, - 109, 139, 138, 55, 56, 57, 58, 59, 60, 61, - 103, 103, 104, 104, 105, 105, 1, 2, 144, 3, - 30, 165, 23, 27, 30, 152, 153, 154, 155, 103, - 40, 104, 157, 105, 45, 103, 140, 104, 53, 105, - 50, 103, 141, 104, 164, 105, 86, 103, 142, 104, - 103, 105, 104, 159, 105, 103, 160, 104, 103, 105, - 104, 161, 105, 103, 162, 104, 87, 105, 89, 90, - 91, 93, 94, 95, 96, 97, 101, 112, 113, 114, - 116, 123, 107, 130, 124, 132, 133, 136, 151, 137, - 146, 147, 149, 156, 158, 148, 167, 168, 115, 163, - 150, 102, 100, 13, 26, 0, 0, 0, 0, 54, - 0, 0, 0, 82, 66 +static const short yytable[] = { 103, + 94, 75, 127, 24, 25, 1, 2, 3, 4, 48, + 5, 1, 2, 3, 4, 2, 5, 68, 69, 70, + 71, 72, 73, 74, 13, 62, 50, 25, 99, 154, + 49, 23, 19, 107, 127, 152, 39, 95, 77, 58, + 21, 136, 137, 138, 139, 32, 100, 155, 78, 59, + 143, 125, 39, 121, 75, 149, 140, 80, 81, 82, + 83, 84, 85, 122, 86, 87, 27, 158, 36, 88, + 89, 163, 90, 51, 123, 91, 118, 45, 119, 46, + 120, 122, 51, 118, 56, 119, 185, 120, 146, 147, + 124, 164, 172, 173, 174, 175, 118, 57, 119, 177, + 120, 63, 118, 159, 119, 66, 120, 98, 118, 160, + 119, 184, 120, 97, 118, 161, 119, 102, 120, 101, + 118, 162, 119, 118, 120, 119, 179, 120, 118, 180, + 119, 118, 120, 119, 181, 120, 104, 182, 1, 2, + 3, 4, 118, 5, 119, 105, 120, 106, 108, 109, + 110, 111, 112, 116, 2, 130, 131, 132, 134, 122, + 141, 148, 150, 151, 156, 142, 171, 187, 157, 176, + 166, 188, 117, 168, 167, 178, 133, 169, 115, 170, + 183, 44, 17, 153, 35, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, + 0, 0, 0, 79 }; -static const short yycheck[] = { 53, - 45, 41, 14, 10, 11, 20, 13, 7, 8, 103, - 104, 28, 15, 16, 17, 18, 19, 20, 19, 22, - 23, 38, 29, 35, 27, 28, 26, 30, 10, 11, - 33, 13, 36, 19, 28, 25, 37, 65, 35, 93, - 94, 95, 96, 12, 13, 35, 28, 25, 102, 25, - 90, 37, 97, 107, 28, 83, 30, 35, 32, 35, - 29, 35, 116, 3, 4, 5, 6, 7, 8, 9, - 28, 28, 30, 30, 32, 32, 10, 11, 36, 13, - 20, 38, 20, 24, 20, 139, 140, 141, 142, 28, - 12, 30, 146, 32, 24, 28, 35, 30, 26, 32, - 19, 28, 35, 30, 158, 32, 35, 28, 35, 30, - 28, 32, 30, 34, 32, 28, 34, 30, 28, 32, - 30, 34, 32, 28, 34, 30, 29, 32, 24, 24, - 20, 33, 33, 33, 33, 24, 20, 19, 19, 19, - 26, 29, 35, 20, 31, 20, 38, 25, 19, 25, - 35, 34, 31, 21, 26, 29, 0, 0, 90, 157, - 132, 78, 77, 2, 16, -1, -1, -1, -1, 38, - -1, -1, -1, 46, 44 +static const short yycheck[] = { 66, + 56, 52, 97, 11, 12, 10, 11, 12, 13, 16, + 15, 10, 11, 12, 13, 11, 15, 3, 4, 5, + 6, 7, 8, 9, 22, 45, 31, 35, 21, 21, + 37, 30, 22, 78, 129, 31, 22, 57, 27, 30, + 22, 108, 109, 110, 111, 22, 39, 39, 37, 40, + 117, 96, 22, 27, 105, 122, 112, 17, 18, 19, + 20, 21, 22, 37, 24, 25, 38, 134, 26, 29, + 30, 27, 32, 14, 15, 35, 30, 38, 32, 30, + 34, 37, 14, 30, 26, 32, 40, 34, 118, 119, + 31, 38, 159, 160, 161, 162, 30, 37, 32, 166, + 34, 21, 30, 37, 32, 28, 34, 40, 30, 37, + 32, 178, 34, 30, 30, 37, 32, 31, 34, 37, + 30, 37, 32, 30, 34, 32, 36, 34, 30, 36, + 32, 30, 34, 32, 36, 34, 26, 36, 10, 11, + 12, 13, 30, 15, 32, 26, 34, 22, 35, 35, + 35, 35, 26, 22, 11, 21, 21, 21, 28, 37, + 31, 22, 22, 40, 27, 33, 21, 0, 27, 23, + 37, 0, 91, 31, 36, 28, 105, 33, 90, 150, + 177, 30, 2, 129, 23, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, + -1, -1, -1, 55 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison.simple" @@ -1011,9 +1058,20 @@ switch (yyn) { case 1: -#line 223 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 244 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { - yyval.Rec = Records.getClass(*yyvsp[0].StrVal); + if (CurDefmPrefix) { + // If CurDefmPrefix is set, we're parsing a defm, which means that this is + // actually the name of a multiclass. + MultiClass *MC = MultiClasses[*yyvsp[0].StrVal]; + if (MC == 0) { + err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n"; + exit(1); + } + yyval.Rec = &MC->Rec; + } else { + yyval.Rec = Records.getClass(*yyvsp[0].StrVal); + } if (yyval.Rec == 0) { err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n"; exit(1); @@ -1022,71 +1080,71 @@ ; break;} case 2: -#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 266 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // string type yyval.Ty = new StringRecTy(); ; break;} case 3: -#line 236 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 268 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // bit type yyval.Ty = new BitRecTy(); ; break;} case 4: -#line 238 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 270 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // bits type yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal); ; break;} case 5: -#line 240 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 272 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // int type yyval.Ty = new IntRecTy(); ; break;} case 6: -#line 242 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 274 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // list type yyval.Ty = new ListRecTy(yyvsp[-1].Ty); ; break;} case 7: -#line 244 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 276 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // code type yyval.Ty = new CodeRecTy(); ; break;} case 8: -#line 246 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 278 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // dag type yyval.Ty = new DagRecTy(); ; break;} case 9: -#line 248 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 280 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // Record Type yyval.Ty = new RecordRecTy(yyvsp[0].Rec); ; break;} case 10: -#line 252 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 284 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.IntVal = 0; ; break;} case 11: -#line 252 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 284 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.IntVal = 1; ; break;} case 12: -#line 254 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 286 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = 0; ; break;} case 13: -#line 254 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 286 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = yyvsp[0].Initializer; ; break;} case 14: -#line 256 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 288 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) { yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType()); @@ -1094,6 +1152,12 @@ const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal); assert(RV && "Template arg doesn't exist??"); yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType()); + } else if (CurMultiClass && + CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*yyvsp[0].StrVal)) { + std::string Name = CurMultiClass->Rec.getName()+"::"+*yyvsp[0].StrVal; + const RecordVal *RV = CurMultiClass->Rec.getValue(Name); + assert(RV && "Template arg doesn't exist??"); + yyval.Initializer = new VarInit(Name, RV->getType()); } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) { yyval.Initializer = new DefInit(D); } else { @@ -1105,39 +1169,39 @@ ; break;} case 15: -#line 273 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 311 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = yyvsp[0].Initializer; ; break;} case 16: -#line 275 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 313 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = new IntInit(yyvsp[0].IntVal); ; break;} case 17: -#line 277 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 315 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = new StringInit(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} case 18: -#line 280 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 318 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = new CodeInit(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} case 19: -#line 283 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 321 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = new UnsetInit(); ; break;} case 20: -#line 285 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 323 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size()); for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) { @@ -1154,7 +1218,7 @@ ; break;} case 21: -#line 298 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 336 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // This is a CLASS expression. This is supposed to synthesize // a new anonymous definition, deriving from CLASS with no @@ -1186,7 +1250,7 @@ ; break;} case 22: -#line 326 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 364 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList); if (yyval.Initializer == 0) { @@ -1197,14 +1261,14 @@ ; break;} case 23: -#line 333 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 371 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = new ListInit(*yyvsp[-1].FieldList); delete yyvsp[-1].FieldList; ; break;} case 24: -#line 336 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 374 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) { err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n"; @@ -1215,14 +1279,14 @@ ; break;} case 25: -#line 343 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 381 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = new DagInit(yyvsp[-2].Initializer, *yyvsp[-1].DagValueList); delete yyvsp[-1].DagValueList; ; break;} case 26: -#line 346 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 384 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end()); yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList); @@ -1234,43 +1298,43 @@ ; break;} case 27: -#line 354 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 392 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = (new BinOpInit(BinOpInit::SHL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); ; break;} case 28: -#line 356 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 394 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = (new BinOpInit(BinOpInit::SRA, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); ; break;} case 29: -#line 358 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 396 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = (new BinOpInit(BinOpInit::SRL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); ; break;} case 30: -#line 360 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 398 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Initializer = (new BinOpInit(BinOpInit::STRCONCAT, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); ; break;} case 31: -#line 364 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 402 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.StrVal = new std::string(); ; break;} case 32: -#line 367 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 405 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.StrVal = yyvsp[0].StrVal; ; break;} case 33: -#line 371 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 409 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.DagValueList = new std::vector >(); yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); @@ -1278,7 +1342,7 @@ ; break;} case 34: -#line 376 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 414 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); delete yyvsp[0].StrVal; @@ -1286,24 +1350,24 @@ ; break;} case 35: -#line 382 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 420 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.DagValueList = new std::vector >(); ; break;} case 36: -#line 385 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 423 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.DagValueList = yyvsp[0].DagValueList; ; break;} case 37: -#line 388 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 426 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.BitList = new std::vector(); yyval.BitList->push_back(yyvsp[0].IntVal); ; break;} case 38: -#line 391 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 429 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; @@ -1320,7 +1384,7 @@ ; break;} case 39: -#line 404 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 442 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyvsp[0].IntVal = -yyvsp[0].IntVal; if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { @@ -1338,13 +1402,13 @@ ; break;} case 40: -#line 418 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 456 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal); ; break;} case 41: -#line 420 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 458 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; @@ -1361,7 +1425,7 @@ ; break;} case 42: -#line 433 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 471 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyvsp[0].IntVal = -yyvsp[0].IntVal; if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { @@ -1379,48 +1443,55 @@ ; break;} case 43: -#line 449 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 487 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ; break;} case 44: -#line 451 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 489 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.BitList = 0; ; break;} case 45: -#line 451 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 489 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.BitList = yyvsp[-1].BitList; ; break;} case 46: -#line 455 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 493 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.FieldList = new std::vector(); ; break;} case 47: -#line 457 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 495 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.FieldList = yyvsp[0].FieldList; ; break;} case 48: -#line 461 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 499 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.FieldList = new std::vector(); yyval.FieldList->push_back(yyvsp[0].Initializer); ; break;} case 49: -#line 464 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 502 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer); ; break;} case 50: -#line 468 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 506 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { std::string DecName = *yyvsp[-1].StrVal; - if (ParsingTemplateArgs) - DecName = CurRec->getName() + ":" + DecName; + if (ParsingTemplateArgs) { + if (CurRec) { + DecName = CurRec->getName() + ":" + DecName; + } else { + assert(CurMultiClass); + } + if (CurMultiClass) + DecName = CurMultiClass->Rec.getName() + "::" + DecName; + } addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal)); setValue(DecName, 0, yyvsp[0].Initializer); @@ -1428,13 +1499,13 @@ ; break;} case 51: -#line 478 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 523 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { delete yyvsp[-1].StrVal; ; break;} case 52: -#line 480 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 525 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer); delete yyvsp[-4].StrVal; @@ -1442,19 +1513,19 @@ ; break;} case 57: -#line 489 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 534 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector()); ; break;} case 58: -#line 491 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 536 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList); ; break;} case 59: -#line 495 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 540 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.SubClassList = new std::vector(); yyval.SubClassList->push_back(*yyvsp[0].SubClassRef); @@ -1462,52 +1533,52 @@ ; break;} case 60: -#line 500 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 545 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef); delete yyvsp[0].SubClassRef; ; break;} case 61: -#line 505 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 550 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.SubClassList = new std::vector(); ; break;} case 62: -#line 508 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 553 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.SubClassList = yyvsp[0].SubClassList; ; break;} case 63: -#line 512 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 557 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { - CurRec->addTemplateArg(*yyvsp[0].StrVal); + getActiveRec()->addTemplateArg(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} case 64: -#line 515 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 560 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { - CurRec->addTemplateArg(*yyvsp[0].StrVal); + getActiveRec()->addTemplateArg(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} case 65: -#line 520 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 565 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} case 68: -#line 523 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 568 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.StrVal = yyvsp[0].StrVal; ; break;} case 69: -#line 523 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 568 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.StrVal = new std::string(); ; break;} case 70: -#line 525 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 570 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { static unsigned AnonCounter = 0; if (yyvsp[0].StrVal->empty()) @@ -1516,7 +1587,7 @@ ; break;} case 71: -#line 532 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 577 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // If a class of this name already exists, it must be a forward ref. if ((CurRec = Records.getClass(*yyvsp[0].StrVal))) { @@ -1536,21 +1607,34 @@ ; break;} case 72: -#line 550 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 595 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { CurRec = new Record(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; - // Ensure redefinition doesn't happen. - if (Records.getDef(CurRec->getName())) { - err() << "Def '" << CurRec->getName() << "' already defined!\n"; - exit(1); + if (!CurMultiClass) { + // Top-level def definition. + + // Ensure redefinition doesn't happen. + if (Records.getDef(CurRec->getName())) { + err() << "def '" << CurRec->getName() << "' already defined!\n"; + exit(1); + } + Records.addDef(CurRec); + } else { + // Otherwise, a def inside a multiclass, add it to the multiclass. + for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); i != e; ++i) + if (CurMultiClass->DefPrototypes[i]->getName() == CurRec->getName()) { + err() << "def '" << CurRec->getName() + << "' already defined in this multiclass!\n"; + exit(1); + } + CurMultiClass->DefPrototypes.push_back(CurRec); } - Records.addDef(CurRec); ; break;} case 73: -#line 562 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 620 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) { addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second); @@ -1568,32 +1652,32 @@ ; break;} case 74: -#line 576 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 634 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Rec = CurRec; CurRec = 0; ; break;} case 75: -#line 581 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 639 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { ParsingTemplateArgs = true; ; break;} case 76: -#line 583 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 641 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { ParsingTemplateArgs = false; ; break;} case 77: -#line 585 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 643 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Rec = yyvsp[0].Rec; ; break;} case 78: -#line 589 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 647 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyvsp[0].Rec->resolveReferences(); @@ -1602,39 +1686,168 @@ yyval.Rec = yyvsp[0].Rec; ; break;} +case 79: +#line 656 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Rec = yyvsp[0].Rec; + // Copy the template arguments for the multiclass into the def. + const std::vector &TArgs = CurMultiClass->Rec.getTemplateArgs(); + + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + const RecordVal *RV = CurMultiClass->Rec.getValue(TArgs[i]); + assert(RV && "Template arg doesn't exist?"); + yyval.Rec->addValue(*RV); + } +; + break;} +case 80: +#line 670 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.RecList = new std::vector(); + yyval.RecList->push_back(yyvsp[0].Rec); +; + break;} case 81: -#line 600 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 673 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.RecList->push_back(yyvsp[0].Rec); +; + break;} +case 82: +#line 677 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + MultiClass *&MCE = MultiClasses[*yyvsp[0].StrVal]; + if (MCE) { + err() << "multiclass '" << *yyvsp[0].StrVal << "' already defined!\n"; + exit(1); + } + MCE = CurMultiClass = new MultiClass(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 83: +#line 688 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + ParsingTemplateArgs = true; + ; + break;} +case 84: +#line 690 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + ParsingTemplateArgs = false; + ; + break;} +case 85: +#line 692 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + CurMultiClass = 0; +; + break;} +case 86: +#line 697 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ CurDefmPrefix = yyvsp[0].StrVal; ; + break;} +case 87: +#line 697 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + // To instantiate a multiclass, we need to first get the multiclass, then + // instantiate each def contained in the multiclass with the SubClassRef + // template parameters. + MultiClass *MC = MultiClasses[yyvsp[-1].SubClassRef->first->getName()]; + assert(MC && "Didn't lookup multiclass correctly?"); + std::vector &TemplateVals = *yyvsp[-1].SubClassRef->second; + delete yyvsp[-1].SubClassRef; + + // Verify that the correct number of template arguments were specified. + const std::vector &TArgs = MC->Rec.getTemplateArgs(); + if (TArgs.size() < TemplateVals.size()) { + err() << "ERROR: More template args specified than multiclass expects!\n"; + exit(1); + } + + // Loop over all the def's in the multiclass, instantiating each one. + for (unsigned i = 0, e = MC->DefPrototypes.size(); i != e; ++i) { + Record *DefProto = MC->DefPrototypes[i]; + + // Add the suffix to the defm name to get the new name. + assert(CurRec == 0 && "A def is current?"); + CurRec = new Record(*yyvsp[-4].StrVal + DefProto->getName()); + + addSubClass(DefProto, std::vector()); + + // Loop over all of the template arguments, setting them to the specified + // value or leaving them as the default if necessary. + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + if (i < TemplateVals.size()) { // A value is specified for this temp-arg? + // Set it now. + setValue(TArgs[i], 0, TemplateVals[i]); + + // Resolve it next. + CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); + + // Now remove it. + CurRec->removeValue(TArgs[i]); + + } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { + err() << "ERROR: Value not specified for template argument #" + << i << " (" << TArgs[i] << ") of multiclassclass '" + << MC->Rec.getName() << "'!\n"; + exit(1); + } + } + + // Ensure redefinition doesn't happen. + if (Records.getDef(CurRec->getName())) { + err() << "def '" << CurRec->getName() << "' already defined, " + << "instantiating defm '" << *yyvsp[-4].StrVal << "' with subdef '" + << DefProto->getName() << "'!\n"; + exit(1); + } + Records.addDef(CurRec); + CurRec = 0; + } + + delete &TemplateVals; + delete yyvsp[-4].StrVal; +; + break;} +case 88: +#line 759 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 89: +#line 759 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 92: +#line 762 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer)); delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList; ; break;} -case 84: -#line 608 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +case 95: +#line 770 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.push_back(std::vector()); ; break;} -case 86: -#line 611 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +case 97: +#line 773 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.pop_back(); ; break;} -case 87: -#line 614 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +case 98: +#line 776 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.pop_back(); ; break;} -case 88: -#line 618 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" -{; - break;} -case 89: -#line 618 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +case 99: +#line 780 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} -case 90: -#line 620 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +case 100: +#line 780 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} } @@ -1859,7 +2072,7 @@ } return 1; } -#line 622 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 784 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" int yyerror(const char *ErrorMsg) { Index: llvm/utils/TableGen/FileParser.h.cvs diff -u llvm/utils/TableGen/FileParser.h.cvs:1.3 llvm/utils/TableGen/FileParser.h.cvs:1.4 --- llvm/utils/TableGen/FileParser.h.cvs:1.3 Fri Mar 31 15:54:11 2006 +++ llvm/utils/TableGen/FileParser.h.cvs Fri Sep 1 16:14:42 2006 @@ -6,6 +6,7 @@ std::vector* FieldList; std::vector* BitList; llvm::Record* Rec; + std::vector* RecList; SubClassRefTy* SubClassRef; std::vector* SubClassList; std::vector >* DagValueList; @@ -19,18 +20,20 @@ #define DAG 263 #define CLASS 264 #define DEF 265 -#define FIELD 266 -#define LET 267 -#define IN 268 -#define SHLTOK 269 -#define SRATOK 270 -#define SRLTOK 271 -#define STRCONCATTOK 272 -#define INTVAL 273 -#define ID 274 -#define VARNAME 275 -#define STRVAL 276 -#define CODEFRAGMENT 277 +#define MULTICLASS 266 +#define DEFM 267 +#define FIELD 268 +#define LET 269 +#define IN 270 +#define SHLTOK 271 +#define SRATOK 272 +#define SRLTOK 273 +#define STRCONCATTOK 274 +#define INTVAL 275 +#define ID 276 +#define VARNAME 277 +#define STRVAL 278 +#define CODEFRAGMENT 279 extern YYSTYPE Filelval; Index: llvm/utils/TableGen/FileParser.y.cvs diff -u llvm/utils/TableGen/FileParser.y.cvs:1.3 llvm/utils/TableGen/FileParser.y.cvs:1.4 --- llvm/utils/TableGen/FileParser.y.cvs:1.3 Fri Mar 31 15:54:11 2006 +++ llvm/utils/TableGen/FileParser.y.cvs Fri Sep 1 16:14:42 2006 @@ -22,8 +22,19 @@ int yylex(); namespace llvm { + struct MultiClass { + Record Rec; // Placeholder for template args and Name. + std::vector DefPrototypes; + + MultiClass(const std::string &Name) : Rec(Name) {} + }; + +static std::map MultiClasses; + extern int Filelineno; +static MultiClass *CurMultiClass = 0; // Set while parsing a multiclass. +static std::string *CurDefmPrefix = 0; // Set while parsing defm. static Record *CurRec = 0; static bool ParsingTemplateArgs = false; @@ -45,8 +56,16 @@ extern std::ostream &err(); +/// getActiveRec - If inside a def/class definition, return the def/class. +/// Otherwise, if within a multidef, return it. +static Record *getActiveRec() { + return CurRec ? CurRec : &CurMultiClass->Rec; +} + static void addValue(const RecordVal &RV) { - if (RecordVal *ERV = CurRec->getValue(RV.getName())) { + Record *TheRec = getActiveRec(); + + if (RecordVal *ERV = TheRec->getValue(RV.getName())) { // The value already exists in the class, treat this as a set... if (ERV->setValue(RV.getValue())) { err() << "New definition of '" << RV.getName() << "' of type '" @@ -55,7 +74,7 @@ exit(1); } } else { - CurRec->addValue(RV); + TheRec->addValue(RV); } } @@ -148,33 +167,33 @@ if (TArgs.size() < TemplateArgs.size()) { err() << "ERROR: More template args specified than expected!\n"; exit(1); - } else { // This class expects template arguments... - // Loop over all of the template arguments, setting them to the specified - // value or leaving them as the default if necessary. - for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { - if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? - // Set it now. - setValue(TArgs[i], 0, TemplateArgs[i]); - - // Resolve it next. - CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); - - - // Now remove it. - CurRec->removeValue(TArgs[i]); - - } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { - err() << "ERROR: Value not specified for template argument #" - << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() - << "'!\n"; - exit(1); - } + } + + // Loop over all of the template arguments, setting them to the specified + // value or leaving them as the default if necessary. + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? + // Set it now. + setValue(TArgs[i], 0, TemplateArgs[i]); + + // Resolve it next. + CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); + + + // Now remove it. + CurRec->removeValue(TArgs[i]); + + } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { + err() << "ERROR: Value not specified for template argument #" + << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() + << "'!\n"; + exit(1); } } // Since everything went well, we can now set the "superclass" list for the // current record. - const std::vector &SCs = SC->getSuperClasses(); + const std::vector &SCs = SC->getSuperClasses(); for (unsigned i = 0, e = SCs.size(); i != e; ++i) addSuperClass(SCs[i]); addSuperClass(SC); @@ -194,18 +213,20 @@ std::vector* FieldList; std::vector* BitList; llvm::Record* Rec; + std::vector* RecList; SubClassRefTy* SubClassRef; std::vector* SubClassList; std::vector >* DagValueList; }; -%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD LET IN +%token INT BIT STRING BITS LIST CODE DAG CLASS DEF MULTICLASS DEFM FIELD LET IN %token SHLTOK SRATOK SRLTOK STRCONCATTOK %token INTVAL %token ID VARNAME STRVAL CODEFRAGMENT %type Type -%type ClassInst DefInst Object ObjectBody ClassID +%type ClassInst DefInst MultiClassDef ObjectBody ClassID +%type MultiClassBody %type SubClassRef %type ClassList ClassListNE @@ -221,7 +242,18 @@ %% ClassID : ID { - $$ = Records.getClass(*$1); + if (CurDefmPrefix) { + // If CurDefmPrefix is set, we're parsing a defm, which means that this is + // actually the name of a multiclass. + MultiClass *MC = MultiClasses[*$1]; + if (MC == 0) { + err() << "Couldn't find class '" << *$1 << "'!\n"; + exit(1); + } + $$ = &MC->Rec; + } else { + $$ = Records.getClass(*$1); + } if ($$ == 0) { err() << "Couldn't find class '" << *$1 << "'!\n"; exit(1); @@ -260,6 +292,12 @@ const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*$1); assert(RV && "Template arg doesn't exist??"); $$ = new VarInit(CurRec->getName()+":"+*$1, RV->getType()); + } else if (CurMultiClass && + CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*$1)) { + std::string Name = CurMultiClass->Rec.getName()+"::"+*$1; + const RecordVal *RV = CurMultiClass->Rec.getValue(Name); + assert(RV && "Template arg doesn't exist??"); + $$ = new VarInit(Name, RV->getType()); } else if (Record *D = Records.getDef(*$1)) { $$ = new DefInit(D); } else { @@ -467,8 +505,15 @@ Declaration : OptPrefix Type ID OptValue { std::string DecName = *$3; - if (ParsingTemplateArgs) - DecName = CurRec->getName() + ":" + DecName; + if (ParsingTemplateArgs) { + if (CurRec) { + DecName = CurRec->getName() + ":" + DecName; + } else { + assert(CurMultiClass); + } + if (CurMultiClass) + DecName = CurMultiClass->Rec.getName() + "::" + DecName; + } addValue(RecordVal(DecName, $2, $1)); setValue(DecName, 0, $4); @@ -510,10 +555,10 @@ }; DeclListNE : Declaration { - CurRec->addTemplateArg(*$1); + getActiveRec()->addTemplateArg(*$1); delete $1; } | DeclListNE ',' Declaration { - CurRec->addTemplateArg(*$3); + getActiveRec()->addTemplateArg(*$3); delete $3; }; @@ -551,12 +596,25 @@ CurRec = new Record(*$1); delete $1; - // Ensure redefinition doesn't happen. - if (Records.getDef(CurRec->getName())) { - err() << "Def '" << CurRec->getName() << "' already defined!\n"; - exit(1); + if (!CurMultiClass) { + // Top-level def definition. + + // Ensure redefinition doesn't happen. + if (Records.getDef(CurRec->getName())) { + err() << "def '" << CurRec->getName() << "' already defined!\n"; + exit(1); + } + Records.addDef(CurRec); + } else { + // Otherwise, a def inside a multiclass, add it to the multiclass. + for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); i != e; ++i) + if (CurMultiClass->DefPrototypes[i]->getName() == CurRec->getName()) { + err() << "def '" << CurRec->getName() + << "' already defined in this multiclass!\n"; + exit(1); + } + CurMultiClass->DefPrototypes.push_back(CurRec); } - Records.addDef(CurRec); }; ObjectBody : ClassList { @@ -594,8 +652,112 @@ $$ = $3; }; +// MultiClassDef - A def instance specified inside a multiclass. +MultiClassDef : DefInst { + $$ = $1; + // Copy the template arguments for the multiclass into the def. + const std::vector &TArgs = CurMultiClass->Rec.getTemplateArgs(); + + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + const RecordVal *RV = CurMultiClass->Rec.getValue(TArgs[i]); + assert(RV && "Template arg doesn't exist?"); + $$->addValue(*RV); + } +}; + +// MultiClassBody - Sequence of def's that are instantiated when a multiclass is +// used. +MultiClassBody : MultiClassDef { + $$ = new std::vector(); + $$->push_back($1); +} | MultiClassBody MultiClassDef { + $$->push_back($2); +}; + +MultiClassName : ID { + MultiClass *&MCE = MultiClasses[*$1]; + if (MCE) { + err() << "multiclass '" << *$1 << "' already defined!\n"; + exit(1); + } + MCE = CurMultiClass = new MultiClass(*$1); + delete $1; +}; + +// MultiClass - Multiple definitions. +MultiClassInst : MULTICLASS MultiClassName { + ParsingTemplateArgs = true; + } OptTemplateArgList { + ParsingTemplateArgs = false; + }'{' MultiClassBody '}' { + CurMultiClass = 0; +}; + +// DefMInst - Instantiate a multiclass. +DefMInst : DEFM ID { CurDefmPrefix = $2; } ':' SubClassRef ';' { + // To instantiate a multiclass, we need to first get the multiclass, then + // instantiate each def contained in the multiclass with the SubClassRef + // template parameters. + MultiClass *MC = MultiClasses[$5->first->getName()]; + assert(MC && "Didn't lookup multiclass correctly?"); + std::vector &TemplateVals = *$5->second; + delete $5; + + // Verify that the correct number of template arguments were specified. + const std::vector &TArgs = MC->Rec.getTemplateArgs(); + if (TArgs.size() < TemplateVals.size()) { + err() << "ERROR: More template args specified than multiclass expects!\n"; + exit(1); + } + + // Loop over all the def's in the multiclass, instantiating each one. + for (unsigned i = 0, e = MC->DefPrototypes.size(); i != e; ++i) { + Record *DefProto = MC->DefPrototypes[i]; + + // Add the suffix to the defm name to get the new name. + assert(CurRec == 0 && "A def is current?"); + CurRec = new Record(*$2 + DefProto->getName()); + + addSubClass(DefProto, std::vector()); + + // Loop over all of the template arguments, setting them to the specified + // value or leaving them as the default if necessary. + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + if (i < TemplateVals.size()) { // A value is specified for this temp-arg? + // Set it now. + setValue(TArgs[i], 0, TemplateVals[i]); + + // Resolve it next. + CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); + + // Now remove it. + CurRec->removeValue(TArgs[i]); + + } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { + err() << "ERROR: Value not specified for template argument #" + << i << " (" << TArgs[i] << ") of multiclassclass '" + << MC->Rec.getName() << "'!\n"; + exit(1); + } + } + + // Ensure redefinition doesn't happen. + if (Records.getDef(CurRec->getName())) { + err() << "def '" << CurRec->getName() << "' already defined, " + << "instantiating defm '" << *$2 << "' with subdef '" + << DefProto->getName() << "'!\n"; + exit(1); + } + Records.addDef(CurRec); + CurRec = 0; + } + + delete &TemplateVals; + delete $2; +}; -Object : ClassInst | DefInst; +Object : ClassInst {} | DefInst {}; +Object : MultiClassInst | DefMInst; LETItem : ID OptBitList '=' Value { LetStack.back().push_back(LetRecord(*$1, $2, $4)); @@ -617,7 +779,7 @@ ObjectList : Object {} | ObjectList Object {}; -File : ObjectList {}; +File : ObjectList; %% From lattner at cs.uiuc.edu Fri Sep 1 16:44:32 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 16:44:32 -0500 Subject: [llvm-commits] CVS: llvm/docs/TableGenFundamentals.html Message-ID: <200609012144.k81LiWoN032004@zion.cs.uiuc.edu> Changes in directory llvm/docs: TableGenFundamentals.html updated: 1.15 -> 1.16 --- Log message: Document multiclasses and defm's --- Diffs of the changes: (+84 -7) TableGenFundamentals.html | 91 ++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 84 insertions(+), 7 deletions(-) Index: llvm/docs/TableGenFundamentals.html diff -u llvm/docs/TableGenFundamentals.html:1.15 llvm/docs/TableGenFundamentals.html:1.16 --- llvm/docs/TableGenFundamentals.html:1.15 Mon Mar 13 23:39:39 2006 +++ llvm/docs/TableGenFundamentals.html Fri Sep 1 16:44:18 2006 @@ -30,6 +30,7 @@
  • Value definitions
  • 'let' expressions
  • Class template arguments
  • +
  • Multiclass definitions and instances
  • File scope entities
      @@ -102,6 +103,10 @@ definition, so the backend can find all definitions of a particular class, such as "Instruction".

      +

      TableGen multiclasses are groups of abstract records that are +instantiated all at once. Each instantiation can result in multiple TableGen +definitions.

      + @@ -463,16 +468,16 @@
       def bork {      // Value
      -  bit isMod = 1;
      -  bit isRef = 0;
      +  bit isMod = 1;
      +  bit isRef = 0;
       }
       def hork {      // Value
      -  bit isMod = 1;
      -  bit isRef = 1;
      +  bit isMod = 1;
      +  bit isRef = 1;
       }
       def zork {      // Value
      -  bit isMod = 0;
      -  bit isRef = 1;
      +  bit isMod = 0;
      +  bit isRef = 1;
       }
       
      @@ -483,6 +488,78 @@ + + + +
      + +

      +While classes with template arguments are a good way to factor commonality +between two instances of a definition, multiclasses allow a convenient notation +for defining multiple definitions at once (instances of implicitly constructed +classes). For example, consider an 3-address instruction set whose instructions +come in two forms: "reg = reg op reg" and "reg = reg op imm" (e.g. SPARC). In +this case, you'd like to specify in one place that this commonality exists, then +in a separate place indicate what all the ops are. +

      + +

      +Here is an example TableGen fragment that shows this idea: +

      + +
      +def ops;
      +def GPR;
      +def Imm;
      +class inst<int opc, string asmstr, dag operandlist>;
      +
      +multiclass ri_inst<int opc, string asmstr> {
      +  def _rr : inst<opc, !strconcat(asmstr, " $dst, $src1, $src2"),
      +                 (ops GPR:$dst, GPR:$src1, GPR:$src2)>;
      +  def _ri : inst<opc, !strconcat(asmstr, " $dst, $src1, $src2"),
      +                 (ops GPR:$dst, GPR:$src1, Imm:$src2)>;
      +}
      +
      +// Instantiations of the ri_inst multiclass.
      +defm ADD : ri_inst<0b111, "add">;
      +defm SUB : ri_inst<0b101, "sub">;
      +defm MUL : ri_inst<0b100, "mul">;
      +...
      +
      + +

      The name of the resuntant definitions has the multidef fragment names + appended to them, so this defines ADD_rr, ADD_ri, SUB_rr, etc. Using a + multiclass this way is exactly equivalent to instantiating the + classes multiple times yourself, e.g. by writing:

      + +
      +def ops;
      +def GPR;
      +def Imm;
      +class inst<int opc, string asmstr, dag operandlist>;
      +
      +class rrinst<int opc, string asmstr>
      +  : inst<opc, !strconcat(asmstr, " $dst, $src1, $src2"),
      +         (ops GPR:$dst, GPR:$src1, GPR:$src2)>;
      +
      +class riinst<int opc, string asmstr>
      +  : inst<opc, !strconcat(asmstr, " $dst, $src1, $src2"),
      +         (ops GPR:$dst, GPR:$src1, Imm:$src2)>;
      +
      +// Instantiations of the ri_inst multiclass.
      +def ADD_rr : rrinst<0b111, "add">;
      +def ADD_ri : riinst<0b111, "add">;
      +def SUB_rr : rrinst<0b101, "sub">;
      +def SUB_ri : riinst<0b101, "sub">;
      +def MUL_rr : rrinst<0b100, "mul">;
      +def MUL_ri : riinst<0b100, "mul">;
      +...
      +
      + +
      +
      File scope entities @@ -560,7 +637,7 @@ Chris Lattner
      LLVM Compiler Infrastructure
      - Last modified: $Date: 2006/03/14 05:39:39 $ + Last modified: $Date: 2006/09/01 21:44:18 $ From isanbard at gmail.com Fri Sep 1 16:46:16 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 16:46:16 -0500 Subject: [llvm-commits] CVS: llvm/docs/CodeGenerator.html Message-ID: <200609012146.k81LkGDS032150@zion.cs.uiuc.edu> Changes in directory llvm/docs: CodeGenerator.html updated: 1.33 -> 1.34 --- Log message: Added documentation Fernando Magno Quintao Pereira wrote for the register allocator. (First draft) --- Diffs of the changes: (+342 -4) CodeGenerator.html | 346 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 342 insertions(+), 4 deletions(-) Index: llvm/docs/CodeGenerator.html diff -u llvm/docs/CodeGenerator.html:1.33 llvm/docs/CodeGenerator.html:1.34 --- llvm/docs/CodeGenerator.html:1.33 Sun Aug 27 22:04:05 2006 +++ llvm/docs/CodeGenerator.html Fri Sep 1 16:46:00 2006 @@ -58,6 +58,18 @@
    1. Future directions for the SelectionDAG
    2. +
    @@ -1140,11 +1154,335 @@ SSA-based Machine Code Optimizations

    To Be Written

    + -

    To Be Written

    + +
    + +

    The Register Allocation problem consists in mapping a +program Pv, that can use an unbounded number of +virtual registers, to a program Pp that contains a +finite (possibly small) number of physical registers. Each target +architecture has a different number of physical registers. If the +number of physical registers is not enough to accommodate all the +virtual registers, some of them will have to be mapped into +memory. These virtuals are called spilled virtuals.

    + +
    + + + + + +
    + +

    In LLVM, physical registers are denoted by integer numbers that +normally range from 1 to 1023. To see how this numbering is defined +for a particular architecture, you can read the +GenRegisterNames.inc file for that architecture. For +instance, by inspecting +lib/Target/X86/X86GenRegisterNames.inc we see that the 32-bit +register EAX is denoted by 15, and the MMX register +MM0 is mapped to 48.

    + +

    Some architectures contain registers that share the same physical +location. A notable example is the X86 platform. For instance, in the +X86 architecture, the registers EAX, AX and +AL share the first eight bits. These physical registers are +marked as aliased in LLVM. Given a particular architecture, you +can check which registers are aliased by inspecting its +RegisterInfo.td file. Moreover, the method +MRegisterInfo::getAliasSet(p_reg) returns an array containing +all the physical registers aliased to the register p_reg.

    + +

    Physical registers, in LLVM, are grouped in Register Classes. +Elements in the same register class are functionally equivalent, and can +be interchangeably used. Each virtual register can only be mapped to +physical registers of a particular class. For instance, in the X86 +architecture, some virtuals can only be allocated to 8 bit registers. +A register class is described by TargetRegisterClass objects. +To discover if a virtual register is compatible with a given physical, +this code can be used: +

    + +
    +
    +bool RegMapping_Fer::compatible_class(MachineFunction &mf,
    +                                      unsigned v_reg,
    +                                      unsigned p_reg) {
    +  assert(MRegisterInfo::isPhysicalRegister(p_reg) &&
    +         "Target register must be physical");
    +  const TargetRegisterClass *trc = mf.getSSARegMap()->getRegClass(v_reg);
    +  return trc->contains(p_reg);
    +}
    +
    +
    + +

    Sometimes, mostly for debugging purposes, it is useful to change +the number of physical registers available in the target +architecture. This must be done statically, inside the +TargetRegsterInfo.td file. Just grep for +RegisterClass, the last parameter of which is a list of +registers. Just commenting some out is one simple way to avoid them +being used. A more polite way is to explicitly exclude some registers +from the allocation order. See the definition of the +GR register class in +lib/Target/IA64/IA64RegisterInfo.td for an example of this +(e.g., numReservedRegs registers are hidden.)

    + +

    Virtual registers are also denoted by integer numbers. Contrary to +physical registers, different virtual registers never share the same +number. The smallest virtual register is normally assigned the number +1024. This may change, so, in order to know which is the first virtual +register, you should access +MRegisterInfo::FirstVirtualRegister. Any register whose +number is greater than or equal to +MRegisterInfo::FirstVirtualRegister is considered a virtual +register. Whereas physical registers are statically defined in a +TargetRegisterInfo.td file and cannot be created by the +application developer, that is not the case with virtual registers. +In order to create new virtual registers, use the method +SSARegMap::createVirtualRegister(). This method will return a +virtual register with the highest code. +

    + +

    Before register allocation, the operands of an instruction are +mostly virtual registers, although physical registers may also be +used. In order to check if a given machine operand is a register, use +the boolean function MachineOperand::isRegister(). To obtain +the integer code of a register, use +MachineOperand::getReg(). An instruction may define or use a +register. For instance, ADD reg:1026 := reg:1025 reg:1024 +defines the registers 1024, and uses registers 1025 and 1026. Given a +register operand, the method MachineOperand::isUse() informs +if that register is being used by the instruction. The method +MachineOperand::isDef() informs if that registers is being +defined.

    + +

    We will call physical registers present in the LLVM bytecode before +register allocation pre-colored registers. Pre-colored +registers are used in many different situations, for instance, to pass +parameters of functions calls, and to store results of particular +instructions. There are two types of pre-colored registers: the ones +implicitly defined, and those explicitly +defined. Explicitly defined registers are normal operands, and can be +accessed with MachineInstr::getOperand(int)::getReg(). In +order to check which registers are implicitly defined by an +instruction, use the +TargetInstrInfo::get(opcode)::ImplicitDefs, where +opcode is the opcode of the target instruction. One important +difference between explicit and implicit physical registers is that +the latter are defined statically for each instruction, whereas the +former may vary depending on the program being compiled. For example, +an instruction that represents a function call will always implicitly +define or use the same set of physical registers. To read the +registers implicitly used by an instruction, use +TargetInstrInfo::get(opcode)::ImplicitUses. Pre-colored +registers impose constraints on any register allocation algorithm. The +register allocator must make sure that none of them is been +overwritten by the values of virtual registers while still alive.

    + +
    + + + + + +
    + +

    There are two ways to map virtual registers to physical registers (or to +memory slots). The first way, that we will call direct mapping, +is based on the use of methods of the classes MRegisterInfo, +and MachineOperand. The second way, that we will call +indirect mapping, relies on the VirtRegMap class in +order to insert loads and stores sending and getting values to and from +memory.

    + +

    The direct mapping provides more flexibility to the developer of +the register allocator; however, it is more error prone, and demands +more implementation work. Basically, the programmer will have to +specify where load and store instructions should be inserted in the +target function being compiled in order to get and store values in +memory. To assign a physical register to a virtual register present in +a given operand, use MachineOperand::setReg(p_reg). To insert +a store instruction, use +MRegisterInfo::storeRegToStackSlot(...), and to insert a load +instruction, use MRegisterInfo::loadRegFromStackSlot.

    + +

    The indirect mapping shields the application developer from the +complexities of inserting load and store instructions. In order to map +a virtual register to a physical one, use +VirtRegMap::assignVirt2Phys(vreg, preg). In order to map a +certain virtual register to memory, use +VirtRegMap::assignVirt2StackSlot(vreg). This method will +return the stack slot where vreg's value will be located. If +it is necessary to map another virtual register to the same stack +slot, use VirtRegMap::assignVirt2StackSlot(vreg, +stack_location). One important point to consider when using the +indirect mapping, is that even if a virtual register is mapped to +memory, it still needs to be mapped to a physical register. This +physical register is the location where the virtual register is +supposed to be found before being stored or after being reloaded.

    + +

    If the indirect strategy is used, after all the virtual registers +have been mapped to physical registers or stack slots, it is necessary +to use a spiller object to place load and store instructions in the +code. Every virtual that has been mapped to a stack slot will be +stored to memory after been defined and will be loaded before being +used. The implementation of the spiller tries to recycle load/store +instructions, avoiding unnecessary instructions. For an example of how +to invoke the spiller, see +RegAllocLinearScan::runOnMachineFunction in +lib/CodeGen/RegAllocLinearScan.cpp.

    + +
    + + + + +
    + +

    With very rare exceptions (e.g., function calls), the LLVM machine +code instructions are three address instructions. That is, each +instruction is expected to define at most one register, and to use at +most two registers. However, some architectures use two address +instructions. In this case, the defined register is also one of the +used register. For instance, an instruction such as ADD %EAX, +%EBX, in X86 is actually equivalent to %EAX = %EAX + +%EBX.

    + +

    In order to produce correct code, LLVM must convert three address +instructions that represent two address instructions into true two +address instructions. LLVM provides the pass +TwoAddressInstructionPass for this specific purpose. It must +be run before register allocation takes place. After its execution, +the resulting code may no longer be in SSA form. This happens, for +instance, in situations where an instruction such as %a = ADD %b +%c is converted to two instructions such as:

    + +
    +
    +%a = MOVE %b
    +%a = ADD %a %b
    +
    +
    + +

    Notice that, internally, the second instruction is represented as +ADD %a[def/use] %b. I.e., the register operand %a is +both used and defined by the instruction.

    + +
    + + + + +
    + +

    An important transformation that happens during register allocation is called +the SSA Deconstruction Phase. The SSA form simplifies many +analyses that are performed on the control flow graph of +programs. However, traditional instruction sets do not implement +PHI instructions. Thus, in order to generate executable code, compilers +must replace PHI instructions with other instructions that preserve their +semantics.

    + +

    There are many ways in which PHI instructions can safely be removed +from the target code. The most traditional PHI deconstruction +algorithm replaces PHI instructions with copy instructions. That is +the strategy adopted by LLVM. The SSA deconstruction algorithm is +implemented in nlib/CodeGen/>PHIElimination.cpp. In order to +invoke this pass, the identifier PHIEliminationID must be +marked as required in the code of the register allocator.

    + +
    + + + + +
    + +

    Instruction folding is an optimization performed during +register allocation that removes unnecessary copy instructions. For +instance, a sequence of instructions such as:

    + +
    +
    +%EBX = LOAD %mem_address
    +%EAX = COPY %EBX
    +
    +
    + +

    can be safely substituted by the single instruction: + +

    +
    +%EAX = LOAD %mem_address
    +
    +
    + +

    Instructions can be folded with the +MRegisterInfo::foldMemoryOperand(...) method. Care must be +taken when folding instructions; a folded instruction can be quite +different from the original instruction. See +LiveIntervals::addIntervalsForSpills in +lib/CodeGen/LiveIntervalAnalysis.cpp for an example of its use.

    + +
    + + + + + +
    + +

    The LLVM infrastructure provides the application developer with +three different register allocators:

    + +
      +
    • Simple - This is a very simple implementation that does + not keep values in registers across instructions. This register + allocator immediately spills every value right after it is + computed, and reloads all used operands from memory to temporary + registers before each instruction.
    • +
    • Local - This register allocator is an improvement on the + Simple implementation. It allocates registers on a basic + block level, attempting to keep values in registers and reusing + registers as appropriate.
    • +
    • Linear Scan - The default allocator. This is the + well-know linear scan register allocator. Whereas the + Simple and Local algorithms use a direct mapping + implementation technique, the Linear Scan implementation + uses a spiller in order to place load and stores.
    • +
    + +

    The type of register allocator used in llc can be chosen with the +command line option -regalloc=...:

    + +
    +
    +$ llc -f -regalloc=simple file.bc -o sp.s;
    +$ llc -f -regalloc=local file.bc -o lc.s;
    +$ llc -f -regalloc=linearscan file.bc -o ln.s;
    +
    +
    + +
    +
    Prolog/Epilog Code Insertion @@ -1287,7 +1625,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/08/28 03:04:05 $ + Last modified: $Date: 2006/09/01 21:46:00 $ From lattner at cs.uiuc.edu Fri Sep 1 16:46:16 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 16:46:16 -0500 Subject: [llvm-commits] CVS: llvm/docs/TableGenFundamentals.html Message-ID: <200609012146.k81LkGKZ032155@zion.cs.uiuc.edu> Changes in directory llvm/docs: TableGenFundamentals.html updated: 1.16 -> 1.17 --- Log message: document !strconcat --- Diffs of the changes: (+3 -1) TableGenFundamentals.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/docs/TableGenFundamentals.html diff -u llvm/docs/TableGenFundamentals.html:1.16 llvm/docs/TableGenFundamentals.html:1.17 --- llvm/docs/TableGenFundamentals.html:1.16 Fri Sep 1 16:44:18 2006 +++ llvm/docs/TableGenFundamentals.html Fri Sep 1 16:46:01 2006 @@ -322,6 +322,8 @@
  • (DEF a, b) - a dag value. The first element is required to be a record definition, the remaining elements in the list may be arbitrary other values, including nested `dag' values.
  • +
  • !strconcat(a, b) - A string value that is the result of + concatenating the 'a' and 'b' strings.
  • Note that all of the values have rules specifying how they convert to values @@ -637,7 +639,7 @@ Chris Lattner
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/09/01 21:44:18 $ + Last modified: $Date: 2006/09/01 21:46:01 $ From isanbard at gmail.com Fri Sep 1 16:47:25 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 16:47:25 -0500 Subject: [llvm-commits] CVS: llvm/docs/CodeGenerator.html Message-ID: <200609012147.k81LlPOS032230@zion.cs.uiuc.edu> Changes in directory llvm/docs: CodeGenerator.html updated: 1.34 -> 1.35 --- Log message: Fixed formatting problem. --- Diffs of the changes: (+1 -2) CodeGenerator.html | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/docs/CodeGenerator.html diff -u llvm/docs/CodeGenerator.html:1.34 llvm/docs/CodeGenerator.html:1.35 --- llvm/docs/CodeGenerator.html:1.34 Fri Sep 1 16:46:00 2006 +++ llvm/docs/CodeGenerator.html Fri Sep 1 16:47:10 2006 @@ -58,7 +58,6 @@

  • Future directions for the SelectionDAG
  • -
    • Register Allocation
      • How registers are represented in @@ -1625,7 +1624,7 @@ Chris Lattner
        The LLVM Compiler Infrastructure
        - Last modified: $Date: 2006/09/01 21:46:00 $ + Last modified: $Date: 2006/09/01 21:47:10 $ From lattner at cs.uiuc.edu Fri Sep 1 16:59:17 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 16:59:17 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/FileParser.cpp.cvs FileParser.y FileParser.y.cvs Message-ID: <200609012159.k81LxH4a032457@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: FileParser.cpp.cvs updated: 1.4 -> 1.5 FileParser.y updated: 1.43 -> 1.44 FileParser.y.cvs updated: 1.4 -> 1.5 --- Log message: fix an assertion with multidefs. Def inside of multiclasses don't need to be complete. --- Diffs of the changes: (+37 -25) FileParser.cpp.cvs | 50 +++++++++++++++++++++++++++----------------------- FileParser.y | 6 +++++- FileParser.y.cvs | 6 +++++- 3 files changed, 37 insertions(+), 25 deletions(-) Index: llvm/utils/TableGen/FileParser.cpp.cvs diff -u llvm/utils/TableGen/FileParser.cpp.cvs:1.4 llvm/utils/TableGen/FileParser.cpp.cvs:1.5 --- llvm/utils/TableGen/FileParser.cpp.cvs:1.4 Fri Sep 1 16:14:42 2006 +++ llvm/utils/TableGen/FileParser.cpp.cvs Fri Sep 1 16:59:03 2006 @@ -350,10 +350,10 @@ 458, 471, 487, 489, 489, 493, 495, 499, 502, 506, 523, 525, 531, 531, 532, 532, 534, 536, 540, 545, 550, 553, 557, 560, 565, 566, 566, 568, 568, 570, - 577, 595, 620, 634, 639, 641, 643, 647, 656, 670, - 673, 677, 688, 690, 692, 697, 697, 759, 759, 760, - 760, 762, 767, 767, 770, 770, 773, 776, 780, 780, - 782 + 577, 595, 620, 634, 639, 641, 643, 647, 657, 671, + 674, 678, 689, 691, 693, 698, 698, 763, 763, 764, + 764, 766, 771, 771, 774, 774, 777, 780, 784, 784, + 786 }; #endif @@ -1679,7 +1679,8 @@ case 78: #line 647 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { - yyvsp[0].Rec->resolveReferences(); + if (CurMultiClass == 0) // Def's in multiclasses aren't really defs. + yyvsp[0].Rec->resolveReferences(); // If ObjectBody has template arguments, it's an error. assert(yyvsp[0].Rec->getTemplateArgs().empty() && "How'd this get template args?"); @@ -1687,7 +1688,7 @@ ; break;} case 79: -#line 656 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 657 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.Rec = yyvsp[0].Rec; // Copy the template arguments for the multiclass into the def. @@ -1701,20 +1702,20 @@ ; break;} case 80: -#line 670 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 671 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.RecList = new std::vector(); yyval.RecList->push_back(yyvsp[0].Rec); ; break;} case 81: -#line 673 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 674 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { yyval.RecList->push_back(yyvsp[0].Rec); ; break;} case 82: -#line 677 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 678 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { MultiClass *&MCE = MultiClasses[*yyvsp[0].StrVal]; if (MCE) { @@ -1726,29 +1727,29 @@ ; break;} case 83: -#line 688 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 689 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { ParsingTemplateArgs = true; ; break;} case 84: -#line 690 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 691 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { ParsingTemplateArgs = false; ; break;} case 85: -#line 692 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 693 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { CurMultiClass = 0; ; break;} case 86: -#line 697 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 698 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { CurDefmPrefix = yyvsp[0].StrVal; ; break;} case 87: -#line 697 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 698 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { // To instantiate a multiclass, we need to first get the multiclass, then // instantiate each def contained in the multiclass with the SubClassRef @@ -1804,6 +1805,9 @@ exit(1); } Records.addDef(CurRec); + + CurRec->resolveReferences(); + CurRec = 0; } @@ -1812,42 +1816,42 @@ ; break;} case 88: -#line 759 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 763 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} case 89: -#line 759 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 763 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} case 92: -#line 762 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 766 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer)); delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList; ; break;} case 95: -#line 770 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 774 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.push_back(std::vector()); ; break;} case 97: -#line 773 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 777 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.pop_back(); ; break;} case 98: -#line 776 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 780 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.pop_back(); ; break;} case 99: -#line 780 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 784 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} case 100: -#line 780 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 784 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} } @@ -2072,7 +2076,7 @@ } return 1; } -#line 784 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 788 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" int yyerror(const char *ErrorMsg) { Index: llvm/utils/TableGen/FileParser.y diff -u llvm/utils/TableGen/FileParser.y:1.43 llvm/utils/TableGen/FileParser.y:1.44 --- llvm/utils/TableGen/FileParser.y:1.43 Fri Sep 1 16:13:49 2006 +++ llvm/utils/TableGen/FileParser.y Fri Sep 1 16:59:03 2006 @@ -645,7 +645,8 @@ }; DefInst : DEF DefName ObjectBody { - $3->resolveReferences(); + if (CurMultiClass == 0) // Def's in multiclasses aren't really defs. + $3->resolveReferences(); // If ObjectBody has template arguments, it's an error. assert($3->getTemplateArgs().empty() && "How'd this get template args?"); @@ -749,6 +750,9 @@ exit(1); } Records.addDef(CurRec); + + CurRec->resolveReferences(); + CurRec = 0; } Index: llvm/utils/TableGen/FileParser.y.cvs diff -u llvm/utils/TableGen/FileParser.y.cvs:1.4 llvm/utils/TableGen/FileParser.y.cvs:1.5 --- llvm/utils/TableGen/FileParser.y.cvs:1.4 Fri Sep 1 16:14:42 2006 +++ llvm/utils/TableGen/FileParser.y.cvs Fri Sep 1 16:59:03 2006 @@ -645,7 +645,8 @@ }; DefInst : DEF DefName ObjectBody { - $3->resolveReferences(); + if (CurMultiClass == 0) // Def's in multiclasses aren't really defs. + $3->resolveReferences(); // If ObjectBody has template arguments, it's an error. assert($3->getTemplateArgs().empty() && "How'd this get template args?"); @@ -749,6 +750,9 @@ exit(1); } Records.addDef(CurRec); + + CurRec->resolveReferences(); + CurRec = 0; } From lattner at cs.uiuc.edu Fri Sep 1 17:01:51 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 17:01:51 -0500 Subject: [llvm-commits] CVS: llvm/docs/TableGenFundamentals.html Message-ID: <200609012201.k81M1p9d032552@zion.cs.uiuc.edu> Changes in directory llvm/docs: TableGenFundamentals.html updated: 1.17 -> 1.18 --- Log message: Fix a typo Jim pointed out, thanks! --- Diffs of the changes: (+2 -2) TableGenFundamentals.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/docs/TableGenFundamentals.html diff -u llvm/docs/TableGenFundamentals.html:1.17 llvm/docs/TableGenFundamentals.html:1.18 --- llvm/docs/TableGenFundamentals.html:1.17 Fri Sep 1 16:46:01 2006 +++ llvm/docs/TableGenFundamentals.html Fri Sep 1 17:01:36 2006 @@ -531,7 +531,7 @@ ... -

        The name of the resuntant definitions has the multidef fragment names +

        The name of the resultant definitions has the multidef fragment names appended to them, so this defines ADD_rr, ADD_ri, SUB_rr, etc. Using a multiclass this way is exactly equivalent to instantiating the classes multiple times yourself, e.g. by writing:

        @@ -639,7 +639,7 @@ Chris Lattner
        LLVM Compiler Infrastructure
        - Last modified: $Date: 2006/09/01 21:46:01 $ + Last modified: $Date: 2006/09/01 22:01:36 $ From lattner at cs.uiuc.edu Fri Sep 1 17:07:14 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 17:07:14 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/TableGen/MultiClass.td Message-ID: <200609012207.k81M7E3g032671@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/TableGen: MultiClass.td updated: 1.1 -> 1.2 --- Log message: Make this harder --- Diffs of the changes: (+2 -0) MultiClass.td | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/test/Regression/TableGen/MultiClass.td diff -u llvm/test/Regression/TableGen/MultiClass.td:1.1 llvm/test/Regression/TableGen/MultiClass.td:1.2 --- llvm/test/Regression/TableGen/MultiClass.td:1.1 Fri Sep 1 16:14:37 2006 +++ llvm/test/Regression/TableGen/MultiClass.td Fri Sep 1 17:07:00 2006 @@ -15,3 +15,5 @@ } defm FOO : t<42>; + +def T4 : C1<6, "foo">; From lattner at cs.uiuc.edu Fri Sep 1 17:07:42 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 17:07:42 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/FileParser.cpp.cvs FileParser.y FileParser.y.cvs Message-ID: <200609012207.k81M7ggI032691@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: FileParser.cpp.cvs updated: 1.5 -> 1.6 FileParser.y updated: 1.44 -> 1.45 FileParser.y.cvs updated: 1.5 -> 1.6 --- Log message: Make sure to clear CurDefmPrefix = 0, otherwise stuff after a defm won't parse right. This fixes TableGen/MultiClass.td --- Diffs of the changes: (+15 -12) FileParser.cpp.cvs | 25 +++++++++++++------------ FileParser.y | 1 + FileParser.y.cvs | 1 + 3 files changed, 15 insertions(+), 12 deletions(-) Index: llvm/utils/TableGen/FileParser.cpp.cvs diff -u llvm/utils/TableGen/FileParser.cpp.cvs:1.5 llvm/utils/TableGen/FileParser.cpp.cvs:1.6 --- llvm/utils/TableGen/FileParser.cpp.cvs:1.5 Fri Sep 1 16:59:03 2006 +++ llvm/utils/TableGen/FileParser.cpp.cvs Fri Sep 1 17:07:27 2006 @@ -351,9 +351,9 @@ 523, 525, 531, 531, 532, 532, 534, 536, 540, 545, 550, 553, 557, 560, 565, 566, 566, 568, 568, 570, 577, 595, 620, 634, 639, 641, 643, 647, 657, 671, - 674, 678, 689, 691, 693, 698, 698, 763, 763, 764, - 764, 766, 771, 771, 774, 774, 777, 780, 784, 784, - 786 + 674, 678, 689, 691, 693, 698, 698, 764, 764, 765, + 765, 767, 772, 772, 775, 775, 778, 781, 785, 785, + 787 }; #endif @@ -1813,45 +1813,46 @@ delete &TemplateVals; delete yyvsp[-4].StrVal; + CurDefmPrefix = 0; ; break;} case 88: -#line 763 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 764 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} case 89: -#line 763 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 764 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} case 92: -#line 766 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 767 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer)); delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList; ; break;} case 95: -#line 774 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 775 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.push_back(std::vector()); ; break;} case 97: -#line 777 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 778 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.pop_back(); ; break;} case 98: -#line 780 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 781 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" { LetStack.pop_back(); ; break;} case 99: -#line 784 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 785 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} case 100: -#line 784 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 785 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" {; break;} } @@ -2076,7 +2077,7 @@ } return 1; } -#line 788 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +#line 789 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" int yyerror(const char *ErrorMsg) { Index: llvm/utils/TableGen/FileParser.y diff -u llvm/utils/TableGen/FileParser.y:1.44 llvm/utils/TableGen/FileParser.y:1.45 --- llvm/utils/TableGen/FileParser.y:1.44 Fri Sep 1 16:59:03 2006 +++ llvm/utils/TableGen/FileParser.y Fri Sep 1 17:07:27 2006 @@ -758,6 +758,7 @@ delete &TemplateVals; delete $2; + CurDefmPrefix = 0; }; Object : ClassInst {} | DefInst {}; Index: llvm/utils/TableGen/FileParser.y.cvs diff -u llvm/utils/TableGen/FileParser.y.cvs:1.5 llvm/utils/TableGen/FileParser.y.cvs:1.6 --- llvm/utils/TableGen/FileParser.y.cvs:1.5 Fri Sep 1 16:59:03 2006 +++ llvm/utils/TableGen/FileParser.y.cvs Fri Sep 1 17:07:27 2006 @@ -758,6 +758,7 @@ delete &TemplateVals; delete $2; + CurDefmPrefix = 0; }; Object : ClassInst {} | DefInst {}; From lattner at cs.uiuc.edu Fri Sep 1 17:16:36 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 17:16:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrInfo.td Message-ID: <200609012216.k81MGac5000550@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrInfo.td updated: 1.125 -> 1.126 --- Log message: remove a bunch of comments --- Diffs of the changes: (+0 -54) SparcInstrInfo.td | 54 ------------------------------------------------------ 1 files changed, 54 deletions(-) Index: llvm/lib/Target/Sparc/SparcInstrInfo.td diff -u llvm/lib/Target/Sparc/SparcInstrInfo.td:1.125 llvm/lib/Target/Sparc/SparcInstrInfo.td:1.126 --- llvm/lib/Target/Sparc/SparcInstrInfo.td:1.125 Fri Aug 11 04:03:00 2006 +++ llvm/lib/Target/Sparc/SparcInstrInfo.td Fri Sep 1 17:16:22 2006 @@ -515,60 +515,6 @@ "smul $b, $c, $dst", [(set IntRegs:$dst, (mul IntRegs:$b, simm13:$c))]>; -/* -//===------------------------- -// Sparc Example -defm intinst{OPC1, OPC2} { - def OPC1 : F3_1<2, Opc, asmstr, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - [(set IntRegs:$dst, (code IntRegs:$b, IntRegs:$c))]>; - def OPC2 : F3_2<2, Opc, asmstr, (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - [(set IntRegs:$dst, (code IntRegs:$b, simm13:$c))]>; -} -defm intinst_np{OPC1, OPC2} { - def OPC1 : F3_1<2, Opc, asmstr, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - []>; - def OPC2 : F3_2<2, Opc, asmstr, (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - []>; -} - -def { ADDXrr, ADDXri} : intinstnp<0b001000, "addx $b, $c, $dst">; -def { SUBrr, SUBri} : intinst <0b000100, "sub $b, $c, $dst", sub>; -def intinstnp{ SUBXrr, SUBXri}<0b001100, "subx $b, $c, $dst">; -def intinst {SUBCCrr, SUBCCri}<0b010100, "subcc $b, $c, $dst", SPcmpicc>; -def intinst { SMULrr, SMULri}<0b001011, "smul $b, $c, $dst", mul>; - -//===------------------------- -// X86 Example -defm cmov32 { - def OPC1 : I, TB; - def OPC2 : I, TB; -} - -def cmov; -def cmov; - -//===------------------------- -// PPC Example - -def fpunop { - def OPC1 : FORM; - def OPC2 : FORM; -} - -def fpunop< FABSS, FABSD, XForm_26, 63, 63, 264, "fabs", fabs>; -def fpunop; -def fpunop< FNEGS, FNEGD, XForm_26, 63, 63, 40, "fneg", fneg>; -*/ // Section B.19 - Divide Instructions, p. 115 def UDIVrr : F3_1<2, 0b001110, From lattner at cs.uiuc.edu Fri Sep 1 17:28:17 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 1 Sep 2006 17:28:17 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrFormats.td SparcInstrInfo.td Message-ID: <200609012228.k81MSHsX000846@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrFormats.td updated: 1.16 -> 1.17 SparcInstrInfo.td updated: 1.126 -> 1.127 --- Log message: Use a couple of multiclass patterns to factor some integer ops. --- Diffs of the changes: (+51 -135) SparcInstrFormats.td | 2 SparcInstrInfo.td | 184 +++++++++++++-------------------------------------- 2 files changed, 51 insertions(+), 135 deletions(-) Index: llvm/lib/Target/Sparc/SparcInstrFormats.td diff -u llvm/lib/Target/Sparc/SparcInstrFormats.td:1.16 llvm/lib/Target/Sparc/SparcInstrFormats.td:1.17 --- llvm/lib/Target/Sparc/SparcInstrFormats.td:1.16 Sat Feb 4 23:50:24 2006 +++ llvm/lib/Target/Sparc/SparcInstrFormats.td Fri Sep 1 17:28:02 2006 @@ -109,3 +109,5 @@ let Inst{13-5} = opfval; // fp opcode let Inst{4-0} = rs2; } + + Index: llvm/lib/Target/Sparc/SparcInstrInfo.td diff -u llvm/lib/Target/Sparc/SparcInstrInfo.td:1.126 llvm/lib/Target/Sparc/SparcInstrInfo.td:1.127 --- llvm/lib/Target/Sparc/SparcInstrInfo.td:1.126 Fri Sep 1 17:16:22 2006 +++ llvm/lib/Target/Sparc/SparcInstrInfo.td Fri Sep 1 17:28:02 2006 @@ -168,6 +168,32 @@ def FCC_ULE : FCC_VAL<28>; // Unordered or Less or Equal def FCC_O : FCC_VAL<29>; // Ordered +//===----------------------------------------------------------------------===// +// Instruction Class Templates +//===----------------------------------------------------------------------===// + +/// F3_12 multiclass - Define a normal F3_1/F3_2 pattern in one shot. +multiclass F3_12 Op3Val, SDNode OpNode> { + def rr : F3_1<2, Op3Val, + (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), + !strconcat(OpcStr, " $b, $c, $dst"), + [(set IntRegs:$dst, (OpNode IntRegs:$b, IntRegs:$c))]>; + def ri : F3_2<2, Op3Val, + (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), + !strconcat(OpcStr, " $b, $c, $dst"), + [(set IntRegs:$dst, (OpNode IntRegs:$b, simm13:$c))]>; +} + +/// F3_12np multiclass - Define a normal F3_1/F3_2 pattern in one shot, with no +/// pattern. +multiclass F3_12np Op3Val> { + def rr : F3_1<2, Op3Val, + (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), + !strconcat(OpcStr, " $b, $c, $dst"), []>; + def ri : F3_2<2, Op3Val, + (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), + !strconcat(OpcStr, " $b, $c, $dst"), []>; +} //===----------------------------------------------------------------------===// // Instructions @@ -364,14 +390,8 @@ def NOP : F2_1<0b100, (ops), "nop", []>; // Section B.11 - Logical Instructions, p. 106 -def ANDrr : F3_1<2, 0b000001, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "and $b, $c, $dst", - [(set IntRegs:$dst, (and IntRegs:$b, IntRegs:$c))]>; -def ANDri : F3_2<2, 0b000001, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "and $b, $c, $dst", - [(set IntRegs:$dst, (and IntRegs:$b, simm13:$c))]>; +defm AND : F3_12<"and", 0b000001, and>; + def ANDNrr : F3_1<2, 0b000101, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), "andn $b, $c, $dst", @@ -379,14 +399,9 @@ def ANDNri : F3_2<2, 0b000101, (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), "andn $b, $c, $dst", []>; -def ORrr : F3_1<2, 0b000010, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "or $b, $c, $dst", - [(set IntRegs:$dst, (or IntRegs:$b, IntRegs:$c))]>; -def ORri : F3_2<2, 0b000010, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "or $b, $c, $dst", - [(set IntRegs:$dst, (or IntRegs:$b, simm13:$c))]>; + +defm OR : F3_12<"or", 0b000010, or>; + def ORNrr : F3_1<2, 0b000110, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), "orn $b, $c, $dst", @@ -394,14 +409,8 @@ def ORNri : F3_2<2, 0b000110, (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), "orn $b, $c, $dst", []>; -def XORrr : F3_1<2, 0b000011, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "xor $b, $c, $dst", - [(set IntRegs:$dst, (xor IntRegs:$b, IntRegs:$c))]>; -def XORri : F3_2<2, 0b000011, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "xor $b, $c, $dst", - [(set IntRegs:$dst, (xor IntRegs:$b, simm13:$c))]>; +defm XOR : F3_12<"xor", 0b000011, xor>; + def XNORrr : F3_1<2, 0b000111, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), "xnor $b, $c, $dst", @@ -411,40 +420,12 @@ "xnor $b, $c, $dst", []>; // Section B.12 - Shift Instructions, p. 107 -def SLLrr : F3_1<2, 0b100101, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "sll $b, $c, $dst", - [(set IntRegs:$dst, (shl IntRegs:$b, IntRegs:$c))]>; -def SLLri : F3_2<2, 0b100101, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "sll $b, $c, $dst", - [(set IntRegs:$dst, (shl IntRegs:$b, simm13:$c))]>; -def SRLrr : F3_1<2, 0b100110, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "srl $b, $c, $dst", - [(set IntRegs:$dst, (srl IntRegs:$b, IntRegs:$c))]>; -def SRLri : F3_2<2, 0b100110, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "srl $b, $c, $dst", - [(set IntRegs:$dst, (srl IntRegs:$b, simm13:$c))]>; -def SRArr : F3_1<2, 0b100111, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "sra $b, $c, $dst", - [(set IntRegs:$dst, (sra IntRegs:$b, IntRegs:$c))]>; -def SRAri : F3_2<2, 0b100111, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "sra $b, $c, $dst", - [(set IntRegs:$dst, (sra IntRegs:$b, simm13:$c))]>; +defm SLL : F3_12<"sll", 0b100101, shl>; +defm SRL : F3_12<"srl", 0b100110, srl>; +defm SRA : F3_12<"sra", 0b100111, sra>; // Section B.13 - Add Instructions, p. 108 -def ADDrr : F3_1<2, 0b000000, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "add $b, $c, $dst", - [(set IntRegs:$dst, (add IntRegs:$b, IntRegs:$c))]>; -def ADDri : F3_2<2, 0b000000, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "add $b, $c, $dst", - [(set IntRegs:$dst, (add IntRegs:$b, simm13:$c))]>; +defm ADD : F3_12<"add", 0b000000, add>; // "LEA" forms of add (patterns to make tblgen happy) def LEA_ADDri : F3_2<2, 0b000000, @@ -452,97 +433,30 @@ "add ${addr:arith}, $dst", [(set IntRegs:$dst, ADDRri:$addr)]>; -def ADDCCrr : F3_1<2, 0b010000, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "addcc $b, $c, $dst", - [(set IntRegs:$dst, (addc IntRegs:$b, IntRegs:$c))]>; -def ADDCCri : F3_2<2, 0b010000, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "addcc $b, $c, $dst", - [(set IntRegs:$dst, (addc IntRegs:$b, simm13:$c))]>; -def ADDXrr : F3_1<2, 0b001000, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "addx $b, $c, $dst", - [(set IntRegs:$dst, (adde IntRegs:$b, IntRegs:$c))]>; -def ADDXri : F3_2<2, 0b001000, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "addx $b, $c, $dst", - [(set IntRegs:$dst, (adde IntRegs:$b, simm13:$c))]>; +defm ADDCC : F3_12<"addcc", 0b010000, addc>; +defm ADDX : F3_12<"addx", 0b001000, adde>; // Section B.15 - Subtract Instructions, p. 110 -def SUBrr : F3_1<2, 0b000100, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "sub $b, $c, $dst", - [(set IntRegs:$dst, (sub IntRegs:$b, IntRegs:$c))]>; -def SUBri : F3_2<2, 0b000100, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "sub $b, $c, $dst", - [(set IntRegs:$dst, (sub IntRegs:$b, simm13:$c))]>; -def SUBXrr : F3_1<2, 0b001100, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "subx $b, $c, $dst", - [(set IntRegs:$dst, (sube IntRegs:$b, IntRegs:$c))]>; -def SUBXri : F3_2<2, 0b001100, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "subx $b, $c, $dst", - [(set IntRegs:$dst, (sube IntRegs:$b, simm13:$c))]>; -def SUBCCrr : F3_1<2, 0b010100, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "subcc $b, $c, $dst", - [(set IntRegs:$dst, (SPcmpicc IntRegs:$b, IntRegs:$c))]>; -def SUBCCri : F3_2<2, 0b010100, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "subcc $b, $c, $dst", - [(set IntRegs:$dst, (SPcmpicc IntRegs:$b, simm13:$c))]>; +defm SUB : F3_12 <"sub" , 0b000100, sub>; +defm SUBX : F3_12 <"subx" , 0b001100, sube>; +defm SUBCC : F3_12 <"subcc", 0b010100, SPcmpicc>; + def SUBXCCrr: F3_1<2, 0b011100, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), "subxcc $b, $c, $dst", []>; // Section B.18 - Multiply Instructions, p. 113 -def UMULrr : F3_1<2, 0b001010, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "umul $b, $c, $dst", []>; -def UMULri : F3_2<2, 0b001010, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "umul $b, $c, $dst", []>; - -def SMULrr : F3_1<2, 0b001011, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "smul $b, $c, $dst", - [(set IntRegs:$dst, (mul IntRegs:$b, IntRegs:$c))]>; -def SMULri : F3_2<2, 0b001011, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "smul $b, $c, $dst", - [(set IntRegs:$dst, (mul IntRegs:$b, simm13:$c))]>; +defm UMUL : F3_12np<"umul", 0b001010>; +defm SMUL : F3_12 <"smul", 0b001011, mul>; // Section B.19 - Divide Instructions, p. 115 -def UDIVrr : F3_1<2, 0b001110, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "udiv $b, $c, $dst", []>; -def UDIVri : F3_2<2, 0b001110, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "udiv $b, $c, $dst", []>; -def SDIVrr : F3_1<2, 0b001111, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "sdiv $b, $c, $dst", []>; -def SDIVri : F3_2<2, 0b001111, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "sdiv $b, $c, $dst", []>; +defm UDIV : F3_12np<"udiv", 0b001110>; +defm SDIV : F3_12np<"sdiv", 0b001111>; // Section B.20 - SAVE and RESTORE, p. 117 -def SAVErr : F3_1<2, 0b111100, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "save $b, $c, $dst", []>; -def SAVEri : F3_2<2, 0b111100, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "save $b, $c, $dst", []>; -def RESTORErr : F3_1<2, 0b111101, - (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "restore $b, $c, $dst", []>; -def RESTOREri : F3_2<2, 0b111101, - (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "restore $b, $c, $dst", []>; +defm SAVE : F3_12np<"save" , 0b111100>; +defm RESTORE : F3_12np<"restore", 0b111101>; // Section B.21 - Branch on Integer Condition Codes Instructions, p. 119 From evan.cheng at apple.com Fri Sep 1 17:52:42 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 17:52:42 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200609012252.k81MqgCo001245@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.103 -> 1.104 --- Log message: Oops. Bad typo. Without the check of N1.hasOneUse() bad things can happen. Suppose the TokenFactor can reach the Op: [Load chain] ^ | [Load] ^ ^ | | / \- / | / [Op] / ^ ^ | .. | | / | [TokenFactor] | ^ | | | \ / \ / [Store] If we move the Load below the TokenFactor, we would have created a cycle in the DAG. --- Diffs of the changes: (+2 -2) X86ISelDAGToDAG.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.103 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.104 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.103 Tue Aug 29 16:42:58 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Sep 1 17:52:28 2006 @@ -308,8 +308,8 @@ SDOperand N1 = I->getOperand(1); SDOperand N2 = I->getOperand(2); - if (MVT::isFloatingPoint(N1.getValueType()) && - MVT::isVector(N1.getValueType()) && + if (MVT::isFloatingPoint(N1.getValueType()) || + MVT::isVector(N1.getValueType()) || !N1.hasOneUse()) continue; From isanbard at gmail.com Fri Sep 1 18:27:55 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:55 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/481.wrf/Makefile Message-ID: <200609012327.k81NRtHn001887@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/481.wrf: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+24 -0) Makefile | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm-test/External/SPEC/CFP2006/481.wrf/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/481.wrf/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:24 2006 --- llvm-test/External/SPEC/CFP2006/481.wrf/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,24 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 wrf test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 5e-2 + FP_ABSTOLERANCE = 1.0e-2 + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + FPPFLAGS += -w -m literal.pm \ + -DINTIO -DIWORDSIZE=4 -DDWORDSIZE=8 -DRWORDSIZE=4 -DLWORDSIZE=4 \ + -DNETCDF -DTRIEDNTRUE -DLIMIT_ARGS -DEM_CORE=1 -DNMM_CORE=0 \ + -DNMM_MAX_DIM=1000 -DCOAMPS_CORE=0 -DEXP_CORE=0 -DF90_STANDALONE \ + -DCONFIG_BUF_LEN=8192 -DMAX_DOMAINS_F=21 -DNO_NAMELIST_PRINT \ + -I$(SPEC_BENCH_DIR)/src + + CPPFLAGS += -I$(SPEC_BENCH_DIR)/src -I$(SPEC_BENCH_DIR)/src/netcdf/include + + STDOUT_FILENAME := rsl.out.0000 From isanbard at gmail.com Fri Sep 1 18:27:56 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:56 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/433.milc/Makefile Message-ID: <200609012327.k81NRuTV001892@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/433.milc: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+17 -0) Makefile | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm-test/External/SPEC/CFP2006/433.milc/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/433.milc/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/433.milc/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,17 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 milc test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.0001 + FP_ABSTOLERANCE = 0.0000002 + + include ../../Makefile.spec2006 + + CPPFLAGS += -DFN -DFAST -DCONGRAD_TMP_VECTORS -DDSLASH_TMP_LINKS + + STDIN_FILENAME := su3imp.in + STDOUT_FILENAME := su3imp.out From isanbard at gmail.com Fri Sep 1 18:27:56 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:56 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/459.GemsFDTD/Makefile Message-ID: <200609012327.k81NRuag001897@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/459.GemsFDTD: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+21 -0) Makefile | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm-test/External/SPEC/CFP2006/459.GemsFDTD/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/459.GemsFDTD/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/459.GemsFDTD/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,21 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 GemsFTDT test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 1e-10 + FP_ABSTOLERANCE = 1e-9 + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := test.in + STDOUT_FILENAME := test.log + else + RUN_OPTIONS := train.in + STDOUT_FILENAME := train.log + endif From isanbard at gmail.com Fri Sep 1 18:27:56 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:56 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/Makefile Message-ID: <200609012327.k81NRu4p001902@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+34 -0) Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+) Index: llvm-test/External/SPEC/CFP2006/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,34 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building SPEC2006 floating point tests. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../.. + + PARALLEL_DIRS := \ + 410.bwaves \ + 416.gamess \ + 433.milc \ + 434.zeusmp \ + 435.gromacs \ + 437.leslie3d \ + 444.namd \ + 459.GemsFDTD \ + 470.lbm + + # These compile but need other things to run: + # 450.soplex - enter.cc:535, works at -O0, not at -O2 + # 453.povray - c++ exceptions + # 465.tonto - infinite loop, works at -O0, not at -O2 + # 482.sphinx3 - generates control file at run time + # These don't compile + # 436.cactusADM - multiple dirs + # 447.dealII - multiple dirs + # 454.calculix - multiple dirs + # 481.wrf - multiple dirs + + # Get the $(ARCH) setting + include $(LEVEL)/Makefile.config + + include $(LEVEL)/Makefile.programs From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/434.zeusmp/Makefile Message-ID: <200609012327.k81NRvaG001907@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/434.zeusmp: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+15 -0) Makefile | 15 +++++++++++++++ 1 files changed, 15 insertions(+) Index: llvm-test/External/SPEC/CFP2006/434.zeusmp/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/434.zeusmp/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/434.zeusmp/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,15 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 zeusmp test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.001 + FP_ABSTOLERANCE = 0.001 + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + STDOUT_FILENAME := zeusmp.stdout From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/453.povray/Makefile Message-ID: <200609012327.k81NRvda001912@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/453.povray: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+22 -0) Makefile | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+) Index: llvm-test/External/SPEC/CFP2006/453.povray/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/453.povray/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/453.povray/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,22 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 povray test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + + ifeq ($(RUN_TYPE),test) + FP_TOLERANCE = 0.0002 + RUN_OPTIONS := SPEC-benchmark-test + STDOUT_FILENAME := test.out + else + FP_TOLERANCE = 0.00005 + RUN_OPTIONS := SPEC-benchmark-train + STDOUT_FILENAME := train.out + endif + + LDFLAGS = -lstdc++ -lm + LIBS = -lstdc++ -lm From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/444.namd/Makefile Message-ID: <200609012327.k81NRvpj001919@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/444.namd: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+22 -0) Makefile | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+) Index: llvm-test/External/SPEC/CFP2006/444.namd/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/444.namd/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/444.namd/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,22 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 namd test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_ABSTOLERANCE = 0.00001 + + include ../../Makefile.spec2006 + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := --input namd.input --iterations 1 --output namd.out + STDOUT_FILENAME := namd.stdout + else + RUN_OPTIONS := --input namd.input --iterations 1 --output namd.out + STDOUT_FILENAME := namd.stdout + endif + + LDFLAGS = -lstdc++ -lm + LIBS = -lstdc++ -lm From isanbard at gmail.com Fri Sep 1 18:27:58 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:58 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/435.gromacs/Makefile Message-ID: <200609012327.k81NRwdI001966@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/435.gromacs: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+18 -0) Makefile | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm-test/External/SPEC/CFP2006/435.gromacs/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/435.gromacs/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/435.gromacs/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,18 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 gromacs test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.0125 + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + CPPFLAGS += -I$(SPEC_BENCH_DIR)/src/ -DHAVE_CONFIG_H + NAGFORTRAN_FLAGS = -maxcontin=50 + + RUN_OPTIONS := -silent -deffnm gromacs -nice 0 + STDOUT_FILENAME := gromacs.err From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile Message-ID: <200609012327.k81NRvhR001917@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/436.cactusADM: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+14 -0) Makefile | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/436.cactusADM/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,14 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 cactusADM test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + CPPFLAGS += -DCCODE -I$(SPEC_BENCH_DIR)/src/include + + STDOUT_FILENAME := cactusADM.out From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/447.dealII/Makefile Message-ID: <200609012327.k81NRvsG001929@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/447.dealII: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+24 -0) Makefile | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm-test/External/SPEC/CFP2006/447.dealII/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/447.dealII/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/447.dealII/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,24 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 dealII test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_ABSTOLERANCE = 0.0000001; + + include ../../Makefile.spec2006 + + CPPFLAGS += -I$(SPEC_BENCH_DIR)/src/include -DBOOST_DISABLE_THREADS + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := 8 + else + RUN_OPTIONS := 10 + endif + + STDOUT_FILENAME := log + + LDFLAGS = -lstdc++ -lm + LIBS = -lstdc++ -lm From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/470.lbm/Makefile Message-ID: <200609012327.k81NRvYx001933@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/470.lbm: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+14 -0) Makefile | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm-test/External/SPEC/CFP2006/470.lbm/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/470.lbm/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:24 2006 --- llvm-test/External/SPEC/CFP2006/470.lbm/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,14 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 lbm test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_ABSTOLERANCE = 0.0000001 + + include ../../Makefile.spec2006 + + RUN_OPTIONS := `cat $(REF_IN_DIR)lbm.in` + STDOUT_FILENAME := lbm.out From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/416.gamess/Makefile Message-ID: <200609012327.k81NRvqn001932@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/416.gamess: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+24 -0) Makefile | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm-test/External/SPEC/CFP2006/416.gamess/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/416.gamess/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/416.gamess/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,24 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 gamess test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.0001 + FP_ABSTOLERANCE = 0.00001 + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + ifeq ($(RUN_TYPE),test) + STDIN_FILENAME := exam29.config + STDOUT_FILENAME := exam29.out + else + STDIN_FILENAME := h2ocu2+.energy.config + STDOUT_FILENAME := h2ocu2+.energy.out + endif + + NAGFORTRAN_FLAGS += -dusty -maxcontin=100 -dcfuns + FPPFLAGS += -DSPEC_CPU_NO_HOLLERITH From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/465.tonto/Makefile Message-ID: <200609012327.k81NRvUh001944@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/465.tonto: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+23 -0) Makefile | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm-test/External/SPEC/CFP2006/465.tonto/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/465.tonto/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/465.tonto/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,23 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 tonto test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.006 + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + FPPFLAGS += -w -DUSE_PRE_AND_POST_CONDITIONS -DUSE_ERROR_MANAGEMENT \ + -m literal.pm -m tonto.pm + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := stdin + STDOUT_FILENAME := test.out + else + RUN_OPTIONS := stdin + STDOUT_FILENAME := train.out + endif From isanbard at gmail.com Fri Sep 1 18:27:58 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:58 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile Message-ID: <200609012327.k81NRw1w001950@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/410.bwaves: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+13 -0) Makefile | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/410.bwaves/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,13 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 bwaves test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.015 + FP_ABSTOLERANCE = 1.0e-16 + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN From isanbard at gmail.com Fri Sep 1 18:27:57 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:57 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/482.sphinx3/Makefile Message-ID: <200609012327.k81NRvdV001946@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/482.sphinx3: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+24 -0) Makefile | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm-test/External/SPEC/CFP2006/482.sphinx3/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/482.sphinx3/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/482.sphinx3/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,24 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 sphinx3 test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.001 + + include ../../Makefile.spec2006 + + CPPFLAGS += -I$(SPEC_BENCH_DIR)/src/libutil -DHAVE_CONFIG_H -DSPEC_CPU + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := `cp an406-fcaw-b.be.raw an406-fcaw-b.raw` \ + `cp an407-fcaw-b.be.raw an407-fcaw-b.raw` \ + `echo "an406-fcaw-b 128000" > ctlfile` \ + `echo "an407-fcaw-b 131200" >> ctlfile` ctlfile . args.an4 + STDOUT_FILENAME := an4.log + else + RUN_OPTIONS := leng100.hmm + STDOUT_FILENAME := leng100.out + endif From isanbard at gmail.com Fri Sep 1 18:27:58 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:58 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/454.calculix/Makefile Message-ID: <200609012327.k81NRww3001956@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/454.calculix: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+23 -0) Makefile | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm-test/External/SPEC/CFP2006/454.calculix/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/454.calculix/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:24 2006 --- llvm-test/External/SPEC/CFP2006/454.calculix/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,23 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 calculix test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 5e-2 + FP_ABSTOLERANCE = 1.0e-2 + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + CPPFLAGS += -I$(SPEC_BENCH_DIR)/src/SPOOLES + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := -i beampic + STDOUT_FILENAME := beampic.log + else + RUN_OPTIONS := -i stairs + STDOUT_FILENAME := stairs.log + endif From isanbard at gmail.com Fri Sep 1 18:27:58 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:58 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/450.soplex/Makefile Message-ID: <200609012327.k81NRw0a001964@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/450.soplex: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+25 -0) Makefile | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+) Index: llvm-test/External/SPEC/CFP2006/450.soplex/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/450.soplex/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/450.soplex/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,25 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 soplex test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + FP_TOLERANCE = 0.0001 + FP_ABSTOLERANCE = 1.0e-5 + + include ../../Makefile.spec2006 + + CPPFLAGS += -DNDEBUG + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS := -s1 -e -m10000 test.mps + STDOUT_FILENAME := test.out + else + RUN_OPTIONS := -s1 -e -m1200 train.mps + STDOUT_FILENAME := train.out + endif + + LDFLAGS = -lstdc++ -lm + LIBS = -lstdc++ -lm From isanbard at gmail.com Fri Sep 1 18:27:58 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:27:58 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/437.leslie3d/Makefile Message-ID: <200609012327.k81NRwEY001969@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/437.leslie3d: Makefile added (r1.1) --- Log message: Initial commit for the SPEC2006 floating point Makefiles. --- Diffs of the changes: (+13 -0) Makefile | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm-test/External/SPEC/CFP2006/437.leslie3d/Makefile diff -c /dev/null llvm-test/External/SPEC/CFP2006/437.leslie3d/Makefile:1.1 *** /dev/null Fri Sep 1 18:27:23 2006 --- llvm-test/External/SPEC/CFP2006/437.leslie3d/Makefile Fri Sep 1 18:27:13 2006 *************** *** 0 **** --- 1,13 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 leslie3d test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + include ../../Makefile.spec2006 + include $(PROJ_SRC_ROOT)/Makefile.FORTRAN + + STDIN_FILENAME := leslie3d.in + STDOUT_FILENAME := leslie3d.out From isanbard at gmail.com Fri Sep 1 18:30:08 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:30:08 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/429.mcf/Makefile Message-ID: <200609012330.k81NU8fN002051@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/429.mcf: Makefile updated: 1.1 -> 1.2 --- Log message: Added perlbench Makefile. --- Diffs of the changes: (+0 -1) Makefile | 1 - 1 files changed, 1 deletion(-) Index: llvm-test/External/SPEC/CINT2006/429.mcf/Makefile diff -u llvm-test/External/SPEC/CINT2006/429.mcf/Makefile:1.1 llvm-test/External/SPEC/CINT2006/429.mcf/Makefile:1.2 --- llvm-test/External/SPEC/CINT2006/429.mcf/Makefile:1.1 Thu Aug 31 14:26:36 2006 +++ llvm-test/External/SPEC/CINT2006/429.mcf/Makefile Fri Sep 1 18:29:51 2006 @@ -11,7 +11,6 @@ RUN_OPTIONS = inp.in CPPFLAGS += -DWANT_STDC_PROTO -LDFLAGS += -lm ifeq ($(RUN_TYPE),test) STDOUT_FILENAME := test.out From isanbard at gmail.com Fri Sep 1 18:30:08 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:30:08 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile Message-ID: <200609012330.k81NU83h002043@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/400.perlbench: Makefile added (r1.1) --- Log message: Added perlbench Makefile. --- Diffs of the changes: (+36 -0) Makefile | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+) Index: llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile diff -c /dev/null llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile:1.1 *** /dev/null Fri Sep 1 18:30:01 2006 --- llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile Fri Sep 1 18:29:51 2006 *************** *** 0 **** --- 1,36 ---- + ##===- Makefile --------------------------------------------*- Makefile -*-===## + # + # This makefile contains information for building the SPEC2006 400.perlbench + # test. + # + ##===----------------------------------------------------------------------===## + + LEVEL = ../../../.. + + Source = $(addprefix $(SPEC_BENCH_DIR)/src/, \ + av.c deb.c doio.c doop.c dump.c globals.c gv.c hv.c locale.c mg.c \ + numeric.c op.c pad.c perl.c perlapi.c perlio.c perlmain.c perly.c pp.c \ + pp_ctl.c pp_hot.c pp_pack.c pp_sort.c pp_sys.c regcomp.c regexec.c run.c \ + scope.c sv.c taint.c toke.c universal.c utf8.c util.c xsutils.c Base64.c \ + Cwd.c Dumper.c HiRes.c IO.c Peek.c attrs.c poll.c stdio.c DynaLoader.c \ + MD5.c Storable.c Parser.c specrand.c Hostname.c Opcode.c) + + include ../../Makefile.spec2006 + + CPPFLAGS += -DPERL_CORE + + ifeq ($(OS),Darwin) + ifeq ($(ARCH),PowerPC) + CPPFLAGS += -DSPEC_CPU_MACOSX_PPC + else + ifeq ($(ARCH),x86) + CPPFLAGS += -DSPEC_CPU_MACOSX_IA32 + endif + endif + endif + + ifeq ($(RUN_TYPE),test) + RUN_OPTIONS = xxx + else + RUN_OPTIONS = xxx + endif From isanbard at gmail.com Fri Sep 1 18:30:08 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:30:08 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile Message-ID: <200609012330.k81NU8Wb002048@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/401.bzip2: Makefile updated: 1.1 -> 1.2 --- Log message: Added perlbench Makefile. --- Diffs of the changes: (+2 -2) Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile diff -u llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile:1.1 llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile:1.2 --- llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile:1.1 Thu Aug 31 14:26:35 2006 +++ llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile Fri Sep 1 18:29:51 2006 @@ -6,6 +6,8 @@ LEVEL = ../../../.. +include ../../Makefile.spec2006 + RUN_OPTIONS = `head -n 1 $(REF_IN_DIR)control` ifeq ($(RUN_TYPE),test) @@ -13,5 +15,3 @@ else STDOUT_FILENAME := input.combined.out endif - -include ../../Makefile.spec2006 From isanbard at gmail.com Fri Sep 1 18:30:10 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 18:30:10 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile Message-ID: <200609012330.k81NUAV3002058@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/483.xalancbmk: Makefile updated: 1.1 -> 1.2 --- Log message: Added perlbench Makefile. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile diff -u llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile:1.1 llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile:1.2 --- llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile:1.1 Thu Aug 31 14:26:36 2006 +++ llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile Fri Sep 1 18:29:51 2006 @@ -17,7 +17,7 @@ -I$(SPEC_BENCH_DIR)/src/xercesc/sax \ -I$(SPEC_BENCH_DIR)/src/xercesc/util/MsgLoaders/InMemory \ -I$(SPEC_BENCH_DIR)/src/xercesc/util/Transcoders/Iconv \ - -I$(SPEC_BENCH_DIR)/src/xalanc/include + -I$(SPEC_BENCH_DIR)/src/xalanc/Include include ../../Makefile.spec2006 From evan.cheng at apple.com Fri Sep 1 18:50:32 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Sep 2006 18:50:32 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-09-01-CycleInDAG.ll Message-ID: <200609012350.k81NoW0s002465@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: 2006-09-01-CycleInDAG.ll added (r1.1) --- Log message: Another "cyclic DAG" test case. --- Diffs of the changes: (+135 -0) 2006-09-01-CycleInDAG.ll | 135 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 135 insertions(+) Index: llvm/test/Regression/CodeGen/X86/2006-09-01-CycleInDAG.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/2006-09-01-CycleInDAG.ll:1.1 *** /dev/null Fri Sep 1 18:50:28 2006 --- llvm/test/Regression/CodeGen/X86/2006-09-01-CycleInDAG.ll Fri Sep 1 18:50:17 2006 *************** *** 0 **** --- 1,135 ---- + ; RUN: llvm-as < %s | llc -march=x86 + + target endian = little + target pointersize = 32 + target triple = "i686-apple-darwin8" + %struct.CUMULATIVE_ARGS = type { int, int, int, int, int, int, int, int, int, int, int, int } + %struct.FILE = type { ubyte*, int, int, short, short, %struct.__sbuf, int, sbyte*, int (sbyte*)*, int (sbyte*, sbyte*, int)*, long (sbyte*, long, int)*, int (sbyte*, sbyte*, int)*, %struct.__sbuf, %struct.__sFILEX*, int, [3 x ubyte], [1 x ubyte], %struct.__sbuf, int, long } + %struct.VEC_edge = type { uint, uint, [1 x %struct.edge_def*] } + %struct.VEC_tree = type { uint, uint, [1 x %struct.tree_node*] } + %struct.__sFILEX = type opaque + %struct.__sbuf = type { ubyte*, int } + %struct._obstack_chunk = type { sbyte*, %struct._obstack_chunk*, [4 x sbyte] } + %struct._var_map = type { %struct.partition_def*, int*, int*, %struct.tree_node**, uint, uint, int* } + %struct.basic_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.tree_node*, %struct.VEC_edge*, %struct.VEC_edge*, %struct.bitmap_head_def*, %struct.bitmap_head_def*, sbyte*, %struct.loop*, [2 x %struct.et_node*], %struct.basic_block_def*, %struct.basic_block_def*, %struct.reorder_block_def*, %struct.bb_ann_d*, long, int, int, int, int } + %struct.bb_ann_d = type { %struct.tree_node*, ubyte, %struct.edge_prediction* } + %struct.bitmap_element_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, uint, [4 x uint] } + %struct.bitmap_head_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, uint, %struct.bitmap_obstack* } + %struct.bitmap_iterator = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, uint, uint } + %struct.bitmap_obstack = type { %struct.bitmap_element_def*, %struct.bitmap_head_def*, %struct.obstack } + %struct.block_stmt_iterator = type { %struct.tree_stmt_iterator, %struct.basic_block_def* } + %struct.coalesce_list_d = type { %struct._var_map*, %struct.partition_pair_d**, bool } + %struct.conflict_graph_def = type opaque + %struct.dataflow_d = type { %struct.varray_head_tag*, [2 x %struct.tree_node*] } + %struct.def_operand_ptr = type { %struct.tree_node** } + %struct.def_optype_d = type { uint, [1 x %struct.def_operand_ptr] } + %struct.die_struct = type opaque + %struct.edge_def = type { %struct.basic_block_def*, %struct.basic_block_def*, %struct.edge_def_insns, sbyte*, %struct.location_t*, int, int, long, uint } + %struct.edge_def_insns = type { %struct.rtx_def* } + %struct.edge_iterator = type { uint, %struct.VEC_edge** } + %struct.edge_prediction = type { %struct.edge_prediction*, %struct.edge_def*, uint, int } + %struct.eh_status = type opaque + %struct.elt_list = type opaque + %struct.emit_status = type { int, int, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, int, %struct.location_t, int, ubyte*, %struct.rtx_def** } + %struct.et_node = type opaque + %struct.expr_status = type { int, int, int, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* } + %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.function*, int, int, int, int, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, ubyte, int, long, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.varray_head_tag*, %struct.temp_slot*, int, %struct.var_refs_queue*, int, int, %struct.rtvec_def*, %struct.tree_node*, int, int, int, %struct.machine_function*, uint, uint, bool, bool, %struct.language_function*, %struct.rtx_def*, uint, int, int, int, %struct.location_t, %struct.varray_head_tag*, %struct.tree_node*, ubyte, ubyte, ubyte } + %struct.ht_identifier = type { ubyte*, uint, uint } + %struct.initial_value_struct = type opaque + %struct.lang_decl = type opaque + %struct.lang_type = type opaque + %struct.language_function = type opaque + %struct.location_t = type { sbyte*, int } + %struct.loop = type opaque + %struct.machine_function = type { int, uint, sbyte*, int, int } + %struct.obstack = type { int, %struct._obstack_chunk*, sbyte*, sbyte*, sbyte*, int, int, %struct._obstack_chunk* (sbyte*, int)*, void (sbyte*, %struct._obstack_chunk*)*, sbyte*, ubyte } + %struct.partition_def = type { int, [1 x %struct.partition_elem] } + %struct.partition_elem = type { int, %struct.partition_elem*, uint } + %struct.partition_pair_d = type { int, int, int, %struct.partition_pair_d* } + %struct.phi_arg_d = type { %struct.tree_node*, bool } + %struct.pointer_set_t = type opaque + %struct.ptr_info_def = type { ubyte, %struct.bitmap_head_def*, %struct.tree_node* } + %struct.real_value = type opaque + %struct.reg_info_def = type opaque + %struct.reorder_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.basic_block_def*, %struct.basic_block_def*, %struct.basic_block_def*, int, int, int } + %struct.rtvec_def = type opaque + %struct.rtx_def = type opaque + %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* } + %struct.simple_bitmap_def = type { uint, uint, uint, [1 x ulong] } + %struct.ssa_op_iter = type { int, int, int, int, int, int, int, int, int, int, int, int, int, int, %struct.stmt_operands_d*, bool } + %struct.stmt_ann_d = type { %struct.tree_ann_common_d, ubyte, %struct.basic_block_def*, %struct.stmt_operands_d, %struct.dataflow_d*, %struct.bitmap_head_def*, uint } + %struct.stmt_operands_d = type { %struct.def_optype_d*, %struct.def_optype_d*, %struct.v_may_def_optype_d*, %struct.vuse_optype_d*, %struct.v_may_def_optype_d* } + %struct.temp_slot = type opaque + %struct.tree_ann_common_d = type { uint, sbyte*, %struct.tree_node* } + %struct.tree_ann_d = type { %struct.stmt_ann_d } + %struct.tree_binfo = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.VEC_tree*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.VEC_tree } + %struct.tree_block = type { %struct.tree_common, ubyte, [3 x ubyte], %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node* } + %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %struct.tree_ann_d*, ubyte, ubyte, ubyte, ubyte, ubyte } + %struct.tree_complex = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node* } + %struct.tree_decl = type { %struct.tree_common, %struct.location_t, uint, %struct.tree_node*, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, uint, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, int, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, long, %struct.lang_decl* } + %struct.tree_decl_u1 = type { long } + %struct.tree_decl_u1_a = type { uint } + %struct.tree_decl_u2 = type { %struct.function* } + %struct.tree_exp = type { %struct.tree_common, %struct.location_t*, int, %struct.tree_node*, [1 x %struct.tree_node*] } + %struct.tree_identifier = type { %struct.tree_common, %struct.ht_identifier } + %struct.tree_int_cst = type { %struct.tree_common, %struct.tree_int_cst_lowhi } + %struct.tree_int_cst_lowhi = type { ulong, long } + %struct.tree_list = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node* } + %struct.tree_live_info_d = type { %struct._var_map*, %struct.bitmap_head_def*, %struct.bitmap_head_def**, int, %struct.bitmap_head_def** } + %struct.tree_node = type { %struct.tree_decl } + %struct.tree_partition_associator_d = type { %struct.varray_head_tag*, %struct.varray_head_tag*, int*, int*, int, int, %struct._var_map* } + %struct.tree_phi_node = type { %struct.tree_common, %struct.tree_node*, int, int, int, %struct.basic_block_def*, %struct.dataflow_d*, [1 x %struct.phi_arg_d] } + %struct.tree_real_cst = type { %struct.tree_common, %struct.real_value* } + %struct.tree_ssa_name = type { %struct.tree_common, %struct.tree_node*, uint, %struct.ptr_info_def*, %struct.tree_node*, sbyte* } + %struct.tree_statement_list = type { %struct.tree_common, %struct.tree_statement_list_node*, %struct.tree_statement_list_node* } + %struct.tree_statement_list_node = type { %struct.tree_statement_list_node*, %struct.tree_statement_list_node*, %struct.tree_node* } + %struct.tree_stmt_iterator = type { %struct.tree_statement_list_node*, %struct.tree_node* } + %struct.tree_string = type { %struct.tree_common, int, [1 x sbyte] } + %struct.tree_type = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, uint, ushort, ubyte, ubyte, uint, %struct.tree_node*, %struct.tree_node*, %struct.tree_type_symtab, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, long, %struct.lang_type* } + %struct.tree_type_symtab = type { int } + %struct.tree_value_handle = type { %struct.tree_common, %struct.value_set*, uint } + %struct.tree_vec = type { %struct.tree_common, int, [1 x %struct.tree_node*] } + %struct.tree_vector = type { %struct.tree_common, %struct.tree_node* } + %struct.use_operand_ptr = type { %struct.tree_node** } + %struct.use_optype_d = type { uint, [1 x %struct.def_operand_ptr] } + %struct.v_def_use_operand_type_t = type { %struct.tree_node*, %struct.tree_node* } + %struct.v_may_def_optype_d = type { uint, [1 x %struct.v_def_use_operand_type_t] } + %struct.v_must_def_optype_d = type { uint, [1 x %struct.v_def_use_operand_type_t] } + %struct.value_set = type opaque + %struct.var_ann_d = type { %struct.tree_ann_common_d, ubyte, ubyte, %struct.tree_node*, %struct.varray_head_tag*, uint, uint, uint, %struct.tree_node*, %struct.tree_node* } + %struct.var_refs_queue = type { %struct.rtx_def*, uint, int, %struct.var_refs_queue* } + %struct.varasm_status = type opaque + %struct.varray_data = type { [1 x long] } + %struct.varray_head_tag = type { uint, uint, uint, sbyte*, %struct.varray_data } + %struct.vuse_optype_d = type { uint, [1 x %struct.tree_node*] } + %basic_block_info = external global %struct.varray_head_tag* ; <%struct.varray_head_tag**> [#uses=1] + + implementation ; Functions: + + + void %calculate_live_on_entry_cond_true3632(%struct.varray_head_tag* %stack3023.6, uint* %tmp3629, %struct.VEC_edge*** %tmp3397.out) { + newFuncRoot: + br label %cond_true3632 + + bb3502.exitStub: ; preds = %cond_true3632 + store %struct.VEC_edge** %tmp3397, %struct.VEC_edge*** %tmp3397.out + ret void + + cond_true3632: ; preds = %newFuncRoot + %tmp3378 = load uint* %tmp3629 ; [#uses=1] + %tmp3379 = add uint %tmp3378, 4294967295 ; [#uses=1] + %tmp3381 = getelementptr %struct.varray_head_tag* %stack3023.6, int 0, uint 4 ; <%struct.varray_data*> [#uses=1] + %tmp3382 = cast %struct.varray_data* %tmp3381 to [1 x int]* ; <[1 x int]*> [#uses=1] + %tmp3383 = getelementptr [1 x int]* %tmp3382, int 0, uint %tmp3379 ; [#uses=1] + %tmp3384 = load int* %tmp3383 ; [#uses=1] + %tmp3387 = load uint* %tmp3629 ; [#uses=1] + %tmp3388 = add uint %tmp3387, 4294967295 ; [#uses=1] + store uint %tmp3388, uint* %tmp3629 + %tmp3391 = load %struct.varray_head_tag** %basic_block_info ; <%struct.varray_head_tag*> [#uses=1] + %tmp3393 = getelementptr %struct.varray_head_tag* %tmp3391, int 0, uint 4 ; <%struct.varray_data*> [#uses=1] + %tmp3394 = cast %struct.varray_data* %tmp3393 to [1 x %struct.basic_block_def*]* ; <[1 x %struct.basic_block_def*]*> [#uses=1] + %tmp3395 = getelementptr [1 x %struct.basic_block_def*]* %tmp3394, int 0, int %tmp3384 ; <%struct.basic_block_def**> [#uses=1] + %tmp3396 = load %struct.basic_block_def** %tmp3395 ; <%struct.basic_block_def*> [#uses=1] + %tmp3397 = getelementptr %struct.basic_block_def* %tmp3396, int 0, uint 3 ; <%struct.VEC_edge**> [#uses=1] + br label %bb3502.exitStub + } From isanbard at gmail.com Fri Sep 1 19:04:16 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 19:04:16 -0500 Subject: [llvm-commits] CVS: llvm-test/autoconf/configure.ac Message-ID: <200609020004.k8204G2k002817@zion.cs.uiuc.edu> Changes in directory llvm-test/autoconf: configure.ac updated: 1.36 -> 1.37 --- Log message: Added support for SPEC2006. --- Diffs of the changes: (+13 -0) configure.ac | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm-test/autoconf/configure.ac diff -u llvm-test/autoconf/configure.ac:1.36 llvm-test/autoconf/configure.ac:1.37 --- llvm-test/autoconf/configure.ac:1.36 Wed Aug 16 17:09:23 2006 +++ llvm-test/autoconf/configure.ac Fri Sep 1 19:04:00 2006 @@ -33,8 +33,11 @@ AC_CONFIG_MAKEFILE(External/Povray/Makefile) AC_CONFIG_MAKEFILE(External/SPEC/Makefile) AC_CONFIG_MAKEFILE(External/SPEC/Makefile.spec) +AC_CONFIG_MAKEFILE(External/SPEC/Makefile.spec2006) AC_CONFIG_MAKEFILE(External/SPEC/Makefile.spec2000) AC_CONFIG_MAKEFILE(External/SPEC/Makefile.spec95) +AC_CONFIG_MAKEFILE(External/SPEC/CFP2006/Makefile) +AC_CONFIG_MAKEFILE(External/SPEC/CINT2006/Makefile) AC_CONFIG_MAKEFILE(External/SPEC/CFP2000/Makefile) AC_CONFIG_MAKEFILE(External/SPEC/CINT2000/Makefile) AC_CONFIG_MAKEFILE(External/SPEC/CFP95/Makefile) @@ -69,6 +72,7 @@ dnl Configure the default locations of the external benchmarks EXTERNAL_BENCHMARK(spec95,${LLVM_EXTERNALS}/spec95/benchspec) EXTERNAL_BENCHMARK(spec2000,${LLVM_EXTERNALS}/speccpu2000/benchspec) +EXTERNAL_BENCHMARK(spec2006,${LLVM_EXTERNALS}/speccpu2006/benchspec) EXTERNAL_BENCHMARK(povray,${LLVM_EXTERNALS}/povray31) EXTERNAL_BENCHMARK(namd,${LLVM_EXTERNALS}/spec_namd) EXTERNAL_BENCHMARK(sweep3d,${LLVM_EXTERNALS}/sweep3d) @@ -77,6 +81,15 @@ EXTERNAL_BENCHMARK(nurbs,${LLVM_EXTERNALS}/nurbs) dnl Check that the paths of provided external benchmark dirs make sense +if test -n "$SPEC2006_ROOT" ; then + if test -d "$SPEC2006_ROOT" ; then + if test `basename "$SPEC2006_ROOT"` != "benchspec"; then + AC_MSG_ERROR([SPEC 2006 directory must end in 'benchspec']) + fi + else + AC_MSG_ERROR([SPEC 2006 option must specify a directory]) + fi +fi if test -n "$SPEC2000_ROOT" ; then if test -d "$SPEC2000_ROOT" ; then if test `basename "$SPEC2000_ROOT"` != "benchspec"; then From isanbard at gmail.com Fri Sep 1 19:04:17 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 19:04:17 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.config.in Message-ID: <200609020004.k8204HxI002822@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.config.in updated: 1.20 -> 1.21 --- Log message: Added support for SPEC2006. --- Diffs of the changes: (+2 -0) Makefile.config.in | 2 ++ 1 files changed, 2 insertions(+) Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.20 llvm-test/Makefile.config.in:1.21 --- llvm-test/Makefile.config.in:1.20 Mon Apr 17 03:02:47 2006 +++ llvm-test/Makefile.config.in Fri Sep 1 19:04:00 2006 @@ -35,10 +35,12 @@ # SPEC benchmarks: # If these are set then run the SPEC benchmarks. # You must provide the SPEC benchmarks on your own. + at USE_SPEC2006@ @USE_SPEC2000@ @USE_SPEC95@ # Path to the SPEC benchmarks. +SPEC2006_ROOT := @SPEC2006_ROOT@ SPEC2000_ROOT := @SPEC2000_ROOT@ SPEC95_ROOT := @SPEC95_ROOT@ From isanbard at gmail.com Fri Sep 1 19:04:17 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 19:04:17 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/Makefile Makefile.spec Message-ID: <200609020004.k8204HQU002827@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC: Makefile updated: 1.18 -> 1.19 Makefile.spec updated: 1.55 -> 1.56 --- Log message: Added support for SPEC2006. --- Diffs of the changes: (+20 -9) Makefile | 15 +++++++++++++-- Makefile.spec | 14 +++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) Index: llvm-test/External/SPEC/Makefile diff -u llvm-test/External/SPEC/Makefile:1.18 llvm-test/External/SPEC/Makefile:1.19 --- llvm-test/External/SPEC/Makefile:1.18 Mon Oct 25 23:51:51 2004 +++ llvm-test/External/SPEC/Makefile Fri Sep 1 19:04:00 2006 @@ -1,10 +1,21 @@ +##===- Makefile --------------------------------------------*- Makefile -*-===## +# +# This makefile runs the SPEC benchmarks. +# +##===----------------------------------------------------------------------===## + LEVEL = ../.. -PARALLEL_DIRS := CFP2000 CINT2000 CFP95 CINT95 +PARALLEL_DIRS := CFP2006 CINT2006 CFP2000 CINT2000 CFP95 CINT95 include $(LEVEL)/Makefile.config # -# Remove SPEC95 and SPEC2000 per the user's configuration +# Remove SPEC95, SPEC2000, and SPEC2006 per the user's configuration # +ifndef USE_SPEC2006 +PARALLEL_DIRS := $(filter-out CFP2006, $(PARALLEL_DIRS)) +PARALLEL_DIRS := $(filter-out CINT2006, $(PARALLEL_DIRS)) +endif + ifndef USE_SPEC2000 PARALLEL_DIRS := $(filter-out CFP2000, $(PARALLEL_DIRS)) PARALLEL_DIRS := $(filter-out CINT2000, $(PARALLEL_DIRS)) Index: llvm-test/External/SPEC/Makefile.spec diff -u llvm-test/External/SPEC/Makefile.spec:1.55 llvm-test/External/SPEC/Makefile.spec:1.56 --- llvm-test/External/SPEC/Makefile.spec:1.55 Tue Jun 27 15:37:01 2006 +++ llvm-test/External/SPEC/Makefile.spec Fri Sep 1 19:04:00 2006 @@ -1,7 +1,7 @@ ##===- Makefile.spec ---------------------------------------*- Makefile -*-===## # -# This makefile is a template for building SPEC as an external -# test. It is included by Makefile.spec2000 and Makefile.spec95. +# This makefile is a template for building SPEC as an external test. It is +# included by Makefile.spec2006, Makefile.spec2000, and Makefile.spec95. # ##===----------------------------------------------------------------------===## @@ -38,12 +38,12 @@ PROG := $(BENCH_NAME) ifndef Source -Source := $(wildcard $(SPEC_BENCH_DIR)/src/*.c \ - $(SPEC_BENCH_DIR)/src/*.C \ - $(SPEC_BENCH_DIR)/src/*.cc \ +Source := $(wildcard $(SPEC_BENCH_DIR)/src/*.c \ + $(SPEC_BENCH_DIR)/src/*.C \ + $(SPEC_BENCH_DIR)/src/*.cc \ $(SPEC_BENCH_DIR)/src/*.cpp \ - $(SPEC_BENCH_DIR)/src/*.f \ - $(SPEC_BENCH_DIR)/src/*.F \ + $(SPEC_BENCH_DIR)/src/*.f \ + $(SPEC_BENCH_DIR)/src/*.F \ $(SPEC_BENCH_DIR)/src/*.f90 \ $(SPEC_BENCH_DIR)/src/*.F90) endif From isanbard at gmail.com Fri Sep 1 20:29:42 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 20:29:42 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile Message-ID: <200609020129.k821Tg35004099@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/400.perlbench: Makefile updated: 1.1 -> 1.2 --- Log message: Added RUN_OPTIONS, STD{OUT,IN}_FILENAME flags. Removed redundant "Source" line --- Diffs of the changes: (+11 -10) Makefile | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) Index: llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile diff -u llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile:1.1 llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile:1.2 --- llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile:1.1 Fri Sep 1 18:29:51 2006 +++ llvm-test/External/SPEC/CINT2006/400.perlbench/Makefile Fri Sep 1 20:29:28 2006 @@ -7,14 +7,6 @@ LEVEL = ../../../.. -Source = $(addprefix $(SPEC_BENCH_DIR)/src/, \ - av.c deb.c doio.c doop.c dump.c globals.c gv.c hv.c locale.c mg.c \ - numeric.c op.c pad.c perl.c perlapi.c perlio.c perlmain.c perly.c pp.c \ - pp_ctl.c pp_hot.c pp_pack.c pp_sort.c pp_sys.c regcomp.c regexec.c run.c \ - scope.c sv.c taint.c toke.c universal.c utf8.c util.c xsutils.c Base64.c \ - Cwd.c Dumper.c HiRes.c IO.c Peek.c attrs.c poll.c stdio.c DynaLoader.c \ - MD5.c Storable.c Parser.c specrand.c Hostname.c Opcode.c) - include ../../Makefile.spec2006 CPPFLAGS += -DPERL_CORE @@ -29,8 +21,17 @@ endif endif +ifeq ($(ENDIAN),little) + CPPFLAGS += -D__LITTLE_ENDIAN__ +else + CPPFLAGS += -D__BIG_ENDIAN__ +endif + ifeq ($(RUN_TYPE),test) - RUN_OPTIONS = xxx + RUN_OPTIONS = test.pl + STDOUT_FILENAME := test.out else - RUN_OPTIONS = xxx + RUN_OPTIONS = scrabbl.pl + STDIN_FILENAME := scrabbl.in + STDOUT_FILENAME := scrabbl.out endif From isanbard at gmail.com Fri Sep 1 20:30:55 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 20:30:55 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/429.mcf/Makefile Message-ID: <200609020130.k821UtgM004156@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/429.mcf: Makefile updated: 1.2 -> 1.3 --- Log message: Cosmetic changes --- Diffs of the changes: (+2 -7) Makefile | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) Index: llvm-test/External/SPEC/CINT2006/429.mcf/Makefile diff -u llvm-test/External/SPEC/CINT2006/429.mcf/Makefile:1.2 llvm-test/External/SPEC/CINT2006/429.mcf/Makefile:1.3 --- llvm-test/External/SPEC/CINT2006/429.mcf/Makefile:1.2 Fri Sep 1 18:29:51 2006 +++ llvm-test/External/SPEC/CINT2006/429.mcf/Makefile Fri Sep 1 20:30:39 2006 @@ -8,12 +8,7 @@ include ../../Makefile.spec2006 -RUN_OPTIONS = inp.in - CPPFLAGS += -DWANT_STDC_PROTO -ifeq ($(RUN_TYPE),test) - STDOUT_FILENAME := test.out -else - STDOUT_FILENAME := train.out -endif +RUN_OPTIONS = inp.in +STDOUT_FILENAME := inp.out From isanbard at gmail.com Fri Sep 1 20:30:56 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 20:30:56 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile Message-ID: <200609020130.k821UuHv004163@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/401.bzip2: Makefile updated: 1.2 -> 1.3 --- Log message: Cosmetic changes --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile diff -u llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile:1.2 llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile:1.3 --- llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile:1.2 Fri Sep 1 18:29:51 2006 +++ llvm-test/External/SPEC/CINT2006/401.bzip2/Makefile Fri Sep 1 20:30:39 2006 @@ -8,6 +8,7 @@ include ../../Makefile.spec2006 +## FIXME: The control file has more than one line in it. RUN_OPTIONS = `head -n 1 $(REF_IN_DIR)control` ifeq ($(RUN_TYPE),test) From isanbard at gmail.com Fri Sep 1 20:30:56 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 20:30:56 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/403.gcc/Makefile Message-ID: <200609020130.k821UuXu004161@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/403.gcc: Makefile updated: 1.1 -> 1.2 --- Log message: Cosmetic changes --- Diffs of the changes: (+4 -2) Makefile | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm-test/External/SPEC/CINT2006/403.gcc/Makefile diff -u llvm-test/External/SPEC/CINT2006/403.gcc/Makefile:1.1 llvm-test/External/SPEC/CINT2006/403.gcc/Makefile:1.2 --- llvm-test/External/SPEC/CINT2006/403.gcc/Makefile:1.1 Thu Aug 31 14:26:35 2006 +++ llvm-test/External/SPEC/CINT2006/403.gcc/Makefile Fri Sep 1 20:30:39 2006 @@ -17,7 +17,9 @@ endif ifeq ($(RUN_TYPE),test) - RUN_OPTIONS = cccp.i -o cccp.s + RUN_OPTIONS = cccp.i -o cccp.s + STDOUT_FILENAME := cccp.s else - RUN_OPTIONS = integrate.i -o integrate.s + RUN_OPTIONS = integrate.i -o integrate.s + STDOUT_FILENAME := integrate.s endif From isanbard at gmail.com Fri Sep 1 20:32:05 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 20:32:05 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile Message-ID: <200609020132.k821W5Dc004217@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/445.gobmk: Makefile updated: 1.1 -> 1.2 --- Log message: Add attempt to handle multiple directories --- Diffs of the changes: (+25 -2) Makefile | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 deletions(-) Index: llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile diff -u llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile:1.1 llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile:1.2 --- llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile:1.1 Thu Aug 31 14:26:36 2006 +++ llvm-test/External/SPEC/CINT2006/445.gobmk/Makefile Fri Sep 1 20:31:50 2006 @@ -6,14 +6,37 @@ LEVEL = ../../../.. +Source = $(addprefix $(SPEC_BENCH_DIR)/src/sgf/, \ + sgf_utils.c sgftree.c sgfnode.c) \ + $(addprefix $(SPEC_BENCH_DIR)/src/engine/, \ + aftermath.c board.c cache.c combination.c dragon.c filllib.c \ + fuseki.c genmove.c hash.c influence.c interface.c matchpat.c \ + move_reasons.c movelist.c optics.c owl.c printutils.c readconnect.c \ + reading.c score.c semeai.c sgfdecide.c sgffile.c shapes.c \ + showbord.c utils.c value_moves.c worm.c globals.c persistent.c \ + handicap.c surround.c) \ + $(addprefix $(SPEC_BENCH_DIR)/src/interface/, \ + gtp.c main.c play_ascii.c play_gtp.c play_solo.c play_test.c) \ + $(addprefix $(SPEC_BENCH_DIR)/src/patterns/, \ + connections.c dfa.c helpers.c transform.c owl_attackpat.c conn.c \ + patterns.c apatterns.c dpatterns.c owl_vital_apat.c eyes.c \ + influence.c barriers.c endgame.c aa_attackpat.c owl_defendpat.c \ + fusekipat.c fuseki9.c fuseki13.c fuseki19.c josekidb.c handipat.c) \ + $(addprefix $(SPEC_BENCH_DIR)/src/utils/, \ + getopt.c getopt1.c gg_utils.c random.c) + include ../../Makefile.spec2006 CPPFLAGS += -DHAVE_CONFIG_H +## FIXME: Multiple *.tst files + ifeq ($(RUN_TYPE),test) - RUN_OPTIONS := --quiet --mode gtp capture.tst + RUN_OPTIONS := --quiet --mode gtp + STDIN_FILENAME := capture.tst STDOUT_FILENAME := capture.out else - RUN_OPTIONS := --quiet --mode gtp arb.tst + RUN_OPTIONS := --quiet --mode gtp + STDIN_FILENAME := arb.tst STDOUT_FILENAME := arb.out endif From isanbard at gmail.com Fri Sep 1 20:32:04 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 20:32:04 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile Message-ID: <200609020132.k821W4UZ004212@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/471.omnetpp: Makefile updated: 1.1 -> 1.2 --- Log message: Add attempt to handle multiple directories --- Diffs of the changes: (+27 -8) Makefile | 35 +++++++++++++++++++++++++++-------- 1 files changed, 27 insertions(+), 8 deletions(-) Index: llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile diff -u llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile:1.1 llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile:1.2 --- llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile:1.1 Thu Aug 31 14:26:36 2006 +++ llvm-test/External/SPEC/CINT2006/471.omnetpp/Makefile Fri Sep 1 20:31:50 2006 @@ -6,8 +6,32 @@ LEVEL = ../../../.. -FP_ABSTOLERANCE = 0.000001 FP_TOLERANCE = 0.00001 +FP_ABSTOLERANCE = 0.000001 + +Source = $(addprefix $(SPEC_BENCH_DIR)/src/, \ + EtherAppCli.cc EtherAppCli_n.cc EtherAppSrv.cc EtherAppSrv_n.cc \ + EtherApp_m.cc EtherBus.cc EtherBus_n.cc EtherCtrl_m.cc \ + EtherEncap.cc EtherEncap_n.cc EtherFrame_m.cc EtherHost_n.cc \ + EtherHub.cc EtherHub_n.cc EtherLLC.cc EtherLLC_n.cc EtherMAC.cc \ + EtherMAC_n.cc EtherSwitch_n.cc LargeNet_n.cc MACAddress.cc \ + MACAddress_m.cc MACRelayUnitBase.cc MACRelayUnitNP.cc \ + MACRelayUnitNP_n.cc MACRelayUnitPP.cc MACRelayUnitPP_n.cc \ + MACRelayUnit_n.cc Networks_n.cc eth-index_n.cc utils.cc) \ + $(addprefix $(SPEC_BENCH_DIR)/src/libs/cmdenv/, \ + cmdenv.cc enumstr.cc heap.cc) \ + $(addprefix $(SPEC_BENCH_DIR)/src/libs/envir/, \ + akoutvectormgr.cc args.cc cenvir.cc cinifile.cc filemgrs.cc main.cc \ + omnetapp.cc patmatch.cc platdep.cc seeds.cc slaveapp.cc speedmtr.cc)\ + $(addprefix $(SPEC_BENCH_DIR)/src/libs/sim/, \ + carray.cc cexception.cc cmessage.cc cpar.cc ctypes.cc task.cc \ + cchannel.cc cfsm.cc cmodule.cc cpsquare.cc cvarhist.cc util.cc \ + ccoroutine.cc cgate.cc cmsgheap.cc cqueue.cc cwatch.cc cdensity.cc \ + chead.cc cnetmod.cc csimul.cc distrib.cc cdetect.cc chist.cc \ + cobject.cc cstat.cc errmsg.cc cdispstr.cc cksplit.cc coutvect.cc \ + cstruct.cc onstartup.cc cenum.cc cllist.cc cpacket.cc ctopo.cc \ + random.cc std/netpack.cc) \ + $(SPEC_BENCH_DIR)/src/libs/spec/spec_qsort.cc CPPFLAGS += -DNDEBUG=1 \ -I$(SPEC_BENCH_DIR)/src/omnet_include \ @@ -15,10 +39,5 @@ include ../../Makefile.spec2006 -RUN_OPTIONS = omnetpp.ini - -ifeq ($(RUN_TYPE),test) - STDOUT_FILENAME := test.out -else - STDOUT_FILENAME := train.out -endif +RUN_OPTIONS = omnetpp.ini +STDOUT_FILENAME := omnetpp.log From isanbard at gmail.com Fri Sep 1 20:32:36 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 20:32:36 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile Message-ID: <200609020132.k821Wauj004248@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/456.hmmer: Makefile updated: 1.1 -> 1.2 --- Log message: Cosmetic changes --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile diff -u llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile:1.1 llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile:1.2 --- llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile:1.1 Thu Aug 31 14:26:36 2006 +++ llvm-test/External/SPEC/CINT2006/456.hmmer/Makefile Fri Sep 1 20:32:22 2006 @@ -6,8 +6,8 @@ LEVEL = ../../../.. -FP_ABSTOLERANCE = 0.00001 FP_TOLERANCE = 0.002 +FP_ABSTOLERANCE = 0.00001 include ../../Makefile.spec2006 From isanbard at gmail.com Fri Sep 1 20:32:37 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 1 Sep 2006 20:32:37 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile Message-ID: <200609020132.k821Wbta004253@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CINT2006/483.xalancbmk: Makefile updated: 1.2 -> 1.3 --- Log message: Cosmetic changes --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile diff -u llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile:1.2 llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile:1.3 --- llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile:1.2 Fri Sep 1 18:29:51 2006 +++ llvm-test/External/SPEC/CINT2006/483.xalancbmk/Makefile Fri Sep 1 20:32:22 2006 @@ -17,7 +17,7 @@ -I$(SPEC_BENCH_DIR)/src/xercesc/sax \ -I$(SPEC_BENCH_DIR)/src/xercesc/util/MsgLoaders/InMemory \ -I$(SPEC_BENCH_DIR)/src/xercesc/util/Transcoders/Iconv \ - -I$(SPEC_BENCH_DIR)/src/xalanc/Include + -I$(SPEC_BENCH_DIR)/src/xalanc/include include ../../Makefile.spec2006 From lattner at cs.uiuc.edu Sat Sep 2 00:26:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 00:26:15 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200609020526.k825QFR1007858@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.57 -> 1.58 --- Log message: new method --- Diffs of the changes: (+7 -0) LiveIntervalAnalysis.h | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.57 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.58 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.57 Thu Aug 31 23:02:42 2006 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Sat Sep 2 00:26:01 2006 @@ -168,6 +168,13 @@ /// below to update aliases. bool JoinIntervals(LiveInterval &LHS, LiveInterval &RHS); + /// SimpleJoin - Attempt to joint the specified interval into this one. The + /// caller of this method must guarantee that the RHS only contains a single + /// value number and that the RHS is not defined by a copy from this + /// interval. This returns false if the intervals are not joinable, or it + /// joins them and returns true. + bool SimpleJoin(LiveInterval &LHS, LiveInterval &RHS); + /// handleRegisterDef - update intervals for a register def /// (calls handlePhysicalRegisterDef and /// handleVirtualRegisterDef) From lattner at cs.uiuc.edu Sat Sep 2 00:27:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 00:27:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp LiveIntervalAnalysis.cpp Message-ID: <200609020527.k825RDdt007893@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.34 -> 1.35 LiveIntervalAnalysis.cpp updated: 1.179 -> 1.180 --- Log message: When joining two intervals where the RHS is really simple, use a light-weight method for joining the live ranges instead of the fully-general one. --- Diffs of the changes: (+172 -11) LiveInterval.cpp | 17 ++++ LiveIntervalAnalysis.cpp | 166 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 172 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.34 llvm/lib/CodeGen/LiveInterval.cpp:1.35 --- llvm/lib/CodeGen/LiveInterval.cpp:1.34 Thu Aug 31 00:54:43 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Sat Sep 2 00:26:59 2006 @@ -351,6 +351,23 @@ weight += Other.weight; } +/// MergeRangesInAsValue - Merge all of the intervals in RHS into this live +/// interval as the specified value number. The LiveRanges in RHS are +/// allowed to overlap with LiveRanges in the current interval, but only if +/// the overlapping LiveRanges have the specified value number. +void LiveInterval::MergeRangesInAsValue(const LiveInterval &RHS, + unsigned LHSValNo) { + // TODO: Make this more efficient. + iterator InsertPos = begin(); + for (const_iterator I = RHS.begin(), E = RHS.end(); I != E; ++I) { + // Map the ValId in the other live range to the current live range. + LiveRange Tmp = *I; + Tmp.ValId = LHSValNo; + InsertPos = addRangeFrom(Tmp, InsertPos); + } +} + + /// MergeInClobberRanges - For any live ranges that are not defined in the /// current interval, but are defined in the Clobbers interval, mark them /// used with an unknown definition value. Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.179 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.180 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.179 Fri Sep 1 02:00:23 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Sep 2 00:26:59 2006 @@ -883,6 +883,140 @@ return ThisValNoAssignments[VN] = UltimateVN; } +Statistic<> A("x", "a"); +Statistic<> B("x", "b"); +Statistic<> C("x", "c"); +Statistic<> D("x", "d"); + + +static bool InVector(unsigned Val, const SmallVector &V) { + return std::find(V.begin(), V.end(), Val) != V.end(); +} + +/// SimpleJoin - Attempt to joint the specified interval into this one. The +/// caller of this method must guarantee that the RHS only contains a single +/// value number and that the RHS is not defined by a copy from this +/// interval. This returns false if the intervals are not joinable, or it +/// joins them and returns true. +bool LiveIntervals::SimpleJoin(LiveInterval &LHS, LiveInterval &RHS) { + assert(RHS.containsOneValue()); + + // Some number (potentially more than one) value numbers in the current + // interval may be defined as copies from the RHS. Scan the overlapping + // portions of the LHS and RHS, keeping track of this and looking for + // overlapping live ranges that are NOT defined as copies. If these exist, we + // cannot coallesce. + + LiveInterval::iterator LHSIt = LHS.begin(), LHSEnd = LHS.end(); + LiveInterval::iterator RHSIt = RHS.begin(), RHSEnd = RHS.end(); + + if (LHSIt->start < RHSIt->start) { + LHSIt = std::upper_bound(LHSIt, LHSEnd, RHSIt->start); + if (LHSIt != LHS.begin()) --LHSIt; + } else if (RHSIt->start < LHSIt->start) { + RHSIt = std::upper_bound(RHSIt, RHSEnd, LHSIt->start); + if (RHSIt != RHS.begin()) --RHSIt; + } + + SmallVector EliminatedLHSVals; + + while (1) { + // Determine if these live intervals overlap. + bool Overlaps = false; + if (LHSIt->start <= RHSIt->start) + Overlaps = LHSIt->end > RHSIt->start; + else + Overlaps = RHSIt->end > LHSIt->start; + + // If the live intervals overlap, there are two interesting cases: if the + // LHS interval is defined by a copy from the RHS, it's ok and we record + // that the LHS value # is the same as the RHS. If it's not, then we cannot + // coallesce these live ranges and we bail out. + if (Overlaps) { + // If we haven't already recorded that this value # is safe, check it. + if (!InVector(LHSIt->ValId, EliminatedLHSVals)) { + // Copy from the RHS? + unsigned SrcReg = LHS.getSrcRegForValNum(LHSIt->ValId); + if (rep(SrcReg) != RHS.reg) + return false; // Nope, bail out. + + EliminatedLHSVals.push_back(LHSIt->ValId); + } + + // We know this entire LHS live range is okay, so skip it now. + if (++LHSIt == LHSEnd) break; + continue; + } + + if (LHSIt->end < RHSIt->end) { + if (++LHSIt == LHSEnd) break; + } else { + // One interesting case to check here. It's possible that we have + // something like "X3 = Y" which defines a new value number in the LHS, + // and is the last use of this liverange of the RHS. In this case, we + // want to notice this copy (so that it gets coallesced away) even though + // the live ranges don't actually overlap. + if (LHSIt->start == RHSIt->end) { + if (InVector(LHSIt->ValId, EliminatedLHSVals)) { + // We already know that this value number is going to be merged in + // if coallescing succeeds. Just skip the liverange. + if (++LHSIt == LHSEnd) break; + } else { + // Otherwise, if this is a copy from the RHS, mark it as being merged + // in. + if (rep(LHS.getSrcRegForValNum(LHSIt->ValId)) == RHS.reg) { + EliminatedLHSVals.push_back(LHSIt->ValId); + + // We know this entire LHS live range is okay, so skip it now. + if (++LHSIt == LHSEnd) break; + } + } + } + + if (++RHSIt == RHSEnd) break; + } + } + + // If we got here, we know that the coallescing will be successful and that + // the value numbers in EliminatedLHSVals will all be merged together. Since + // the most common case is that EliminatedLHSVals has a single number, we + // optimize for it: if there is more than one value, we merge them all into + // the lowest numbered one, then handle the interval as if we were merging + // with one value number. + unsigned LHSValNo; + if (EliminatedLHSVals.size() > 1) { + // Loop through all the equal value numbers merging them into the smallest + // one. + unsigned Smallest = EliminatedLHSVals[0]; + for (unsigned i = 1, e = EliminatedLHSVals.size(); i != e; ++i) { + if (EliminatedLHSVals[i] < Smallest) { + // Merge the current notion of the smallest into the smaller one. + LHS.MergeValueNumberInto(Smallest, EliminatedLHSVals[i]); + Smallest = EliminatedLHSVals[i]; + } else { + // Merge into the smallest. + LHS.MergeValueNumberInto(EliminatedLHSVals[i], Smallest); + } + } + LHSValNo = Smallest; + } else { + assert(!EliminatedLHSVals.empty() && "No copies from the RHS?"); + LHSValNo = EliminatedLHSVals[0]; + } + + // Okay, now that there is a single LHS value number that we're merging the + // RHS into, update the value number info for the LHS to indicate that the + // value number is defined where the RHS value number was. + LHS.setValueNumberInfo(LHSValNo, RHS.getValNumInfo(0)); + + // Okay, the final step is to loop over the RHS live intervals, adding them to + // the LHS. + LHS.MergeRangesInAsValue(RHS, LHSValNo); + LHS.weight += RHS.weight; + + return true; +} + /// JoinIntervals - Attempt to join these two intervals. On failure, this /// returns false. Otherwise, if one of the intervals being joined is a /// physreg, this method always canonicalizes LHS to be it. The output @@ -894,9 +1028,6 @@ SmallVector LHSValNoAssignments; SmallVector RHSValNoAssignments; SmallVector, 16> ValueNumberInfo; - LHSValNoAssignments.resize(LHS.getNumValNums(), -1); - RHSValNoAssignments.resize(RHS.getNumValNums(), -1); - ValueNumberInfo.reserve(LHS.getNumValNums() + RHS.getNumValNums()); // Compute ultimate value numbers for the LHS and RHS values. if (RHS.containsOneValue()) { @@ -907,19 +1038,27 @@ // Find out if the RHS is defined as a copy from some value in the LHS. int RHSValID = -1; std::pair RHSValNoInfo; - if (unsigned RHSSrcReg = RHS.getSrcRegForValNum(0)) { - if (rep(RHSSrcReg) != LHS.reg) { - RHSValNoInfo = RHS.getValNumInfo(0); + unsigned RHSSrcReg = RHS.getSrcRegForValNum(0); + if ((RHSSrcReg == 0 || rep(RHSSrcReg) != LHS.reg)) { + // If RHS is not defined as a copy from the LHS, we can use simpler and + // faster checks to see if the live ranges are coallescable. This joiner + // can't swap the LHS/RHS intervals though. + if (!MRegisterInfo::isPhysicalRegister(RHS.reg)) { + return SimpleJoin(LHS, RHS); } else { - // It was defined as a copy from the LHS, find out what value # it is. - unsigned ValInst = RHS.getInstForValNum(0); - RHSValID = LHS.getLiveRangeContaining(ValInst-1)->ValId; - RHSValNoInfo = LHS.getValNumInfo(RHSValID); + RHSValNoInfo = RHS.getValNumInfo(0); } + ++A; } else { - RHSValNoInfo = RHS.getValNumInfo(0); + // It was defined as a copy from the LHS, find out what value # it is. + unsigned ValInst = RHS.getInstForValNum(0); + RHSValID = LHS.getLiveRangeContaining(ValInst-1)->ValId; + RHSValNoInfo = LHS.getValNumInfo(RHSValID); + ++B; } + LHSValNoAssignments.resize(LHS.getNumValNums(), -1); + RHSValNoAssignments.resize(RHS.getNumValNums(), -1); ValueNumberInfo.resize(LHS.getNumValNums()); // Okay, *all* of the values in LHS that are defined as a copy from RHS @@ -954,6 +1093,7 @@ RHSValNoAssignments[0] = RHSValID; } else { + ++D; // Loop over the value numbers of the LHS, seeing if any are defined from // the RHS. SmallVector LHSValsDefinedFromRHS; @@ -992,6 +1132,10 @@ RHSValsDefinedFromLHS[VN] = LHS.getLiveRangeContaining(ValInst-1)->ValId; } + LHSValNoAssignments.resize(LHS.getNumValNums(), -1); + RHSValNoAssignments.resize(RHS.getNumValNums(), -1); + ValueNumberInfo.reserve(LHS.getNumValNums() + RHS.getNumValNums()); + for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) { if (LHSValNoAssignments[VN] >= 0 || LHS.getInstForValNum(VN) == ~2U) continue; From lattner at cs.uiuc.edu Sat Sep 2 00:33:07 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 00:33:07 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200609020533.k825X7a1008020@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.58 -> 1.59 --- Log message: Iteration is required for some cases, even if they don't occur in crafty. Restore it, which re-fixes X86/2006-08-21-ExtraMovInst.ll --- Diffs of the changes: (+15 -3) LiveIntervalAnalysis.h | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.58 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.59 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.58 Sat Sep 2 00:26:01 2006 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Sat Sep 2 00:32:53 2006 @@ -53,6 +53,17 @@ std::vector allocatableRegs_; public: + struct CopyRec { + MachineInstr *MI; + unsigned SrcReg, DstReg; + }; + CopyRec getCopyRec(MachineInstr *MI, unsigned SrcReg, unsigned DstReg) { + CopyRec R; + R.MI = MI; + R.SrcReg = SrcReg; + R.DstReg = DstReg; + return R; + } struct InstrSlots { enum { LOAD = 0, @@ -150,9 +161,10 @@ /// joinIntervals - join compatible live intervals void joinIntervals(); - /// CopyCoallesceInMBB - Coallsece copies in the specified MBB. - void CopyCoallesceInMBB(MachineBasicBlock *MBB); - + /// CopyCoallesceInMBB - Coallsece copies in the specified MBB, putting + /// copies that cannot yet be coallesced into the "TryAgain" list. + void CopyCoallesceInMBB(MachineBasicBlock *MBB, + std::vector &TryAgain); /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true /// if the copy was successfully coallesced away, or if it is never possible From lattner at cs.uiuc.edu Sat Sep 2 00:33:08 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 00:33:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200609020533.k825X8sp008025@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.180 -> 1.181 --- Log message: Iteration is required for some cases, even if they don't occur in crafty. Restore it, which re-fixes X86/2006-08-21-ExtraMovInst.ll --- Diffs of the changes: (+24 -13) LiveIntervalAnalysis.cpp | 37 ++++++++++++++++++++++++------------- 1 files changed, 24 insertions(+), 13 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.180 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.181 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.180 Sat Sep 2 00:26:59 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Sep 2 00:32:53 2006 @@ -883,12 +883,6 @@ return ThisValNoAssignments[VN] = UltimateVN; } -Statistic<> A("x", "a"); -Statistic<> B("x", "b"); -Statistic<> C("x", "c"); -Statistic<> D("x", "d"); - - static bool InVector(unsigned Val, const SmallVector &V) { return std::find(V.begin(), V.end(), Val) != V.end(); } @@ -1048,13 +1042,11 @@ } else { RHSValNoInfo = RHS.getValNumInfo(0); } - ++A; } else { // It was defined as a copy from the LHS, find out what value # it is. unsigned ValInst = RHS.getInstForValNum(0); RHSValID = LHS.getLiveRangeContaining(ValInst-1)->ValId; RHSValNoInfo = LHS.getValNumInfo(RHSValID); - ++B; } LHSValNoAssignments.resize(LHS.getNumValNums(), -1); @@ -1093,7 +1085,6 @@ RHSValNoAssignments[0] = RHSValID; } else { - ++D; // Loop over the value numbers of the LHS, seeing if any are defined from // the RHS. SmallVector LHSValsDefinedFromRHS; @@ -1223,7 +1214,8 @@ } -void LiveIntervals::CopyCoallesceInMBB(MachineBasicBlock *MBB) { +void LiveIntervals::CopyCoallesceInMBB(MachineBasicBlock *MBB, + std::vector &TryAgain) { DEBUG(std::cerr << ((Value*)MBB->getBasicBlock())->getName() << ":\n"); for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end(); @@ -1234,7 +1226,8 @@ unsigned SrcReg, DstReg; if (!tii_->isMoveInstr(*Inst, SrcReg, DstReg)) continue; - JoinCopy(Inst, SrcReg, DstReg); + if (!JoinCopy(Inst, SrcReg, DstReg)) + TryAgain.push_back(getCopyRec(Inst, SrcReg, DstReg)); } } @@ -1242,12 +1235,14 @@ void LiveIntervals::joinIntervals() { DEBUG(std::cerr << "********** JOINING INTERVALS ***********\n"); + std::vector TryAgainList; + const LoopInfo &LI = getAnalysis(); if (LI.begin() == LI.end()) { // If there are no loops in the function, join intervals in function order. for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E; ++I) - CopyCoallesceInMBB(I); + CopyCoallesceInMBB(I, TryAgainList); } else { // Otherwise, join intervals in inner loops before other intervals. // Unfortunately we can't just iterate over loop hierarchy here because @@ -1262,7 +1257,23 @@ // Finally, join intervals in loop nest order. for (unsigned i = 0, e = MBBs.size(); i != e; ++i) - CopyCoallesceInMBB(MBBs[i].second); + CopyCoallesceInMBB(MBBs[i].second, TryAgainList); + } + + // Joining intervals can allow other intervals to be joined. Iteratively join + // until we make no progress. + bool ProgressMade = true; + while (ProgressMade) { + ProgressMade = false; + + for (unsigned i = 0, e = TryAgainList.size(); i != e; ++i) { + CopyRec &TheCopy = TryAgainList[i]; + if (TheCopy.MI && + JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) { + TheCopy.MI = 0; // Mark this one as done. + ProgressMade = true; + } + } } DEBUG(std::cerr << "*** Register mapping ***\n"); From lattner at cs.uiuc.edu Sat Sep 2 00:38:07 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 00:38:07 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveInterval.h Message-ID: <200609020538.k825c75W008204@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveInterval.h updated: 1.24 -> 1.25 --- Log message: add a prototype --- Diffs of the changes: (+7 -1) LiveInterval.h | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.24 llvm/include/llvm/CodeGen/LiveInterval.h:1.25 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.24 Fri Sep 1 01:57:35 2006 +++ llvm/include/llvm/CodeGen/LiveInterval.h Sat Sep 2 00:37:53 2006 @@ -166,6 +166,13 @@ /// used with an unknown definition value. void MergeInClobberRanges(const LiveInterval &Clobbers); + + /// MergeRangesInAsValue - Merge all of the intervals in RHS into this live + /// interval as the specified value number. The LiveRanges in RHS are + /// allowed to overlap with LiveRanges in the current interval, but only if + /// the overlapping LiveRanges have the specified value number. + void MergeRangesInAsValue(const LiveInterval &RHS, unsigned LHSValNo); + bool empty() const { return ranges.empty(); } /// beginNumber - Return the lowest numbered slot covered by interval. @@ -233,7 +240,6 @@ int *RHSValNoAssignments, SmallVector,16> &NewValueNumberInfo); - /// removeRange - Remove the specified range from this interval. Note that /// the range must already be in this interval in its entirety. void removeRange(unsigned Start, unsigned End); From lattner at cs.uiuc.edu Sat Sep 2 02:29:48 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 02:29:48 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.config.in Message-ID: <200609020729.k827TmF5018178@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.config.in updated: 1.21 -> 1.22 --- Log message: disable this for now. Without autoconf being run, this breaks the nightly testers. --- Diffs of the changes: (+1 -1) Makefile.config.in | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.21 llvm-test/Makefile.config.in:1.22 --- llvm-test/Makefile.config.in:1.21 Fri Sep 1 19:04:00 2006 +++ llvm-test/Makefile.config.in Sat Sep 2 02:29:33 2006 @@ -35,7 +35,7 @@ # SPEC benchmarks: # If these are set then run the SPEC benchmarks. # You must provide the SPEC benchmarks on your own. - at USE_SPEC2006@ +#@USE_SPEC2006@ @USE_SPEC2000@ @USE_SPEC95@ From lattner at cs.uiuc.edu Sat Sep 2 12:24:54 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 12:24:54 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200609021724.k82HOsWG002622@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.223 -> 1.224 --- Log message: Fix PR891: http://llvm.org/PR891 --- Diffs of the changes: (+3 -3) Makefile.programs | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.223 llvm-test/Makefile.programs:1.224 --- llvm-test/Makefile.programs:1.223 Tue Aug 29 15:55:09 2006 +++ llvm-test/Makefile.programs Sat Sep 2 12:24:34 2006 @@ -203,7 +203,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -enable-x86-fastcc +LLCBETAOPTION := -regalloc=local -fast endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts @@ -266,11 +266,11 @@ # Targets to get the pass arguments that gccas and gccld are using... Output/gccas-pass-args: $(LGCCAS) Output/.dir -$(LGCCAS) /dev/null -o /dev/null -debug-pass=Arguments > $@.1 2>&1 - sed 's/Pass Arguments: //' < $@.1 > $@ + sed 's/Pass Arguments: //' < $@.1 | sed 's/-emitbytecode//'> $@ Output/gccld-pass-args: $(LGCCLDPROG) Output/.dir $(LLVMAS) < /dev/null > Output/gccld.test.bc $(LGCCLD) Output/gccld.test.bc -o Output/gccld.test-out -debug-pass=Arguments > $@.1 2>&1 - sed 's/Pass Arguments: //' < $@.1 > $@ + sed 's/Pass Arguments: //' < $@.1 | sed 's/-emitbytecode//' | > $@ # If the program requires exception handling support, enable (potentially # expensive) support for it. From lattner at cs.uiuc.edu Sat Sep 2 12:37:44 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 12:37:44 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachOWriter.cpp Message-ID: <200609021737.k82HbiRI002876@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachOWriter.cpp updated: 1.3 -> 1.4 --- Log message: improve compat with certain versions of GCC (on cygwin?) --- Diffs of the changes: (+1 -1) MachOWriter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/MachOWriter.cpp diff -u llvm/lib/CodeGen/MachOWriter.cpp:1.3 llvm/lib/CodeGen/MachOWriter.cpp:1.4 --- llvm/lib/CodeGen/MachOWriter.cpp:1.3 Sat Aug 26 10:46:34 2006 +++ llvm/lib/CodeGen/MachOWriter.cpp Sat Sep 2 12:37:30 2006 @@ -197,7 +197,7 @@ // desired section alignment, which must be at least as much as required by // this symbol. if (Align) { - Sec.align = std::max(Sec.align, Align); + Sec.align = std::max(unsigned(Sec.align), Align); Sec.size = (Sec.size + Align - 1) & ~(Align-1); } // Record the offset of the symbol, and then allocate space for it. From nicholas at mxc.ca Sat Sep 2 14:40:52 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 2 Sep 2006 14:40:52 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/2006-08-02-Switch.ll predsimplify.ll Message-ID: <200609021940.k82JeqU8005033@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: 2006-08-02-Switch.ll added (r1.1) predsimplify.ll updated: 1.1 -> 1.2 --- Log message: Improve handling of SelectInst. Reorder operations to remove duplicated work. Fix to leave floating-point types out of the optimization. Add tests to predsimplify.ll for SwitchInst and SelectInst handling. --- Diffs of the changes: (+185 -1) 2006-08-02-Switch.ll | 22 ++++++ predsimplify.ll | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/PredicateSimplifier/2006-08-02-Switch.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/2006-08-02-Switch.ll:1.1 *** /dev/null Sat Sep 2 14:40:48 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/2006-08-02-Switch.ll Sat Sep 2 14:40:38 2006 *************** *** 0 **** --- 1,22 ---- + ; RUN: llvm-as < %s | opt -predsimplify -disable-output + + fastcc void %_ov_splice(int %n1, int %n2, int %ch2) { + entry: + %tmp = setgt int %n1, %n2 ; [#uses=1] + %n.0 = select bool %tmp, int %n2, int %n1 ; [#uses=1] + %tmp104 = setlt int 0, %ch2 ; [#uses=1] + br bool %tmp104, label %cond_true105, label %return + + cond_true95: ; preds = %cond_true105 + ret void + + bb98: ; preds = %cond_true105 + ret void + + cond_true105: ; preds = %entry + %tmp94 = setgt int %n.0, 0 ; [#uses=1] + br bool %tmp94, label %cond_true95, label %bb98 + + return: ; preds = %entry + ret void + } Index: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll diff -u llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll:1.1 llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll:1.2 --- llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll:1.1 Mon Aug 28 17:44:55 2006 +++ llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll Sat Sep 2 14:40:38 2006 @@ -1,4 +1,5 @@ -; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | not grep fail +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | not grep fail && +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | grep pass | wc -l | grep 3 void %test1(int %x) { entry: @@ -124,6 +125,167 @@ ret void } +void %test9(int %y, int %z) { +entry: + %x = add int %y, %z + %A = seteq int %y, 3 + %B = seteq int %z, 5 + %C = and bool %A, %B + br bool %C, label %cond_true, label %return + +cond_true: + %D = seteq int %x, 8 + br bool %D, label %then, label %oops + +then: + call void (...)* %pass( ) + ret void + +oops: + call void (...)* %fail( ) + ret void + +return: + ret void +} + +void %switch1(int %x) { +entry: + %A = seteq int %x, 10 + br bool %A, label %return, label %cond_false + +cond_false: + switch int %x, label %return [ + int 9, label %then1 + int 10, label %then2 + ] + +then1: + call void (...)* %pass( ) + ret void + +then2: + call void (...)* %fail( ) + ret void + +return: + ret void +} + +void %switch2(int %x) { +entry: + %A = seteq int %x, 10 + br bool %A, label %return, label %cond_false + +cond_false: + switch int %x, label %return [ + int 8, label %then1 + int 9, label %then1 + int 10, label %then1 + ] + +then1: + %B = setne int %x, 8 + br bool %B, label %then2, label %return + +then2: + call void (...)* %pass( ) + ret void + +return: + ret void +} + +void %switch3(int %x) { +entry: + %A = seteq int %x, 10 + br bool %A, label %return, label %cond_false + +cond_false: + switch int %x, label %return [ + int 9, label %then1 + int 10, label %then1 + ] + +then1: + %B = seteq int %x, 9 + br bool %B, label %return, label %oops + +oops: + call void (...)* %fail( ) + ret void + +return: + ret void +} + +void %switch4(int %x) { +entry: + %A = seteq int %x, 10 + br bool %A, label %then1, label %cond_false + +cond_false: + switch int %x, label %default [ + int 9, label %then1 + int 10, label %then2 + ] + +then1: + ret void + +then2: + ret void + +default: + %B = seteq int %x, 9 + br bool %B, label %oops, label %then1 + +oops: + call void (...)* %fail( ) + ret void +} + +void %select1(int %x) { +entry: + %A = seteq int %x, 10 + %B = select bool %A, int 1, int 2 + %C = seteq int %B, 1 + br bool %C, label %then, label %else + +then: + br bool %A, label %return, label %oops + +else: + br bool %A, label %oops, label %return + +oops: + call void (...)* %fail( ) + ret void + +return: + ret void +} + +void %select2(int %x) { +entry: + %A = seteq int %x, 10 + %B = select bool %A, int 1, int 2 + %C = seteq int %B, 1 + br bool %A, label %then, label %else + +then: + br bool %C, label %return, label %oops + +else: + br bool %C, label %oops, label %return + +oops: + call void (...)* %fail( ) + ret void + +return: + ret void +} declare void %fail(...) From nicholas at mxc.ca Sat Sep 2 14:40:53 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 2 Sep 2006 14:40:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200609021940.k82JerF1005038@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.4 -> 1.5 --- Log message: Improve handling of SelectInst. Reorder operations to remove duplicated work. Fix to leave floating-point types out of the optimization. Add tests to predsimplify.ll for SwitchInst and SelectInst handling. --- Diffs of the changes: (+44 -31) PredicateSimplifier.cpp | 75 ++++++++++++++++++++++++++++-------------------- 1 files changed, 44 insertions(+), 31 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.4 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.5 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.4 Thu Aug 31 22:26:35 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Sat Sep 2 14:40:37 2006 @@ -28,9 +28,6 @@ // //===------------------------------------------------------------------===// -// TODO: -// * Check handling of NAN in floating point types - #define DEBUG_TYPE "predsimplify" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" @@ -112,14 +109,22 @@ } void addEqual(Value *V1, Value *V2) { + // If %x = 0. and %y = -0., seteq %x, %y is true, but + // copysign(%x) is not the same as copysign(%y). + if (V2->getType()->isFloatingPoint()) return; + order(V1, V2); if (isa(V2)) return; // refuse to set false == true. + DEBUG(std::cerr << "equal: " << *V1 << " and " << *V2 << "\n"); union_find.unionSets(V1, V2); addImpliedProperties(EQ, V1, V2); } void addNotEqual(Value *V1, Value *V2) { + // If %x = NAN then seteq %x, %x is false. + if (V2->getType()->isFloatingPoint()) return; + DEBUG(std::cerr << "not equal: " << *V1 << " and " << *V2 << "\n"); if (findProperty(NE, V1, V2) != Properties.end()) return; // found. @@ -180,15 +185,9 @@ struct Property { Property(Ops opcode, Value *v1, Value *v2) : Opcode(opcode), V1(v1), V2(v2) - { assert(opcode != EQ && "Equality belongs in the synonym set," + { assert(opcode != EQ && "Equality belongs in the synonym set, " "not a property."); } - bool operator<(const Property &rhs) const { - if (Opcode != rhs.Opcode) return Opcode < rhs.Opcode; - if (V1 != rhs.V1) return V1 < rhs.V1; - return V2 < rhs.V2; - } - Ops Opcode; Value *V1, *V2; }; @@ -208,7 +207,7 @@ } } - // Finds the properties implied by a synonym and adds them too. + // Finds the properties implied by a equivalence and adds them too. // Example: ("seteq %a, %b", true, EQ) --> (%a, %b, EQ) // ("seteq %a, %b", false, EQ) --> (%a, %b, NE) void addImpliedProperties(Ops Opcode, Value *V1, Value *V2) { @@ -267,13 +266,25 @@ default: break; } + } else if (SelectInst *SI = dyn_cast(V2)) { + if (Opcode != EQ && Opcode != NE) return; + + ConstantBool *True = (Opcode==EQ) ? ConstantBool::True + : ConstantBool::False, + *False = (Opcode==EQ) ? ConstantBool::False + : ConstantBool::True; + + if (V1 == SI->getTrueValue()) + addEqual(SI->getCondition(), True); + else if (V1 == SI->getFalseValue()) + addEqual(SI->getCondition(), False); + else if (Opcode == EQ) + assert("Result of select not equal to either value."); } } - std::map SynonymMap; - std::vector Synonyms; - public: +#ifdef DEBUG void debug(std::ostream &os) const { for (EquivalenceClasses::iterator I = union_find.begin(), E = union_find.end(); I != E; ++I) { @@ -284,6 +295,7 @@ std::cerr << "\n--\n"; } } +#endif std::vector Properties; }; @@ -351,13 +363,13 @@ // resolve catches cases addProperty won't because it wasn't used as a // condition in the branch, and that visit won't, because the instruction -// was defined outside of the range that the properties apply to. +// was defined outside of the scope that the properties apply to. Value *PredicateSimplifier::resolve(SetCondInst *SCI, const PropertySet &KP) { // Attempt to resolve the SetCondInst to a boolean. - Value *SCI0 = SCI->getOperand(0), - *SCI1 = SCI->getOperand(1); + Value *SCI0 = resolve(SCI->getOperand(0), KP), + *SCI1 = resolve(SCI->getOperand(1), KP); PropertySet::ConstPropertyIterator NE = KP.findProperty(PropertySet::NE, SCI0, SCI1); @@ -378,9 +390,6 @@ } } - SCI0 = KP.canonicalize(SCI0); - SCI1 = KP.canonicalize(SCI1); - ConstantIntegral *CI1 = dyn_cast(SCI0), *CI2 = dyn_cast(SCI1); @@ -445,6 +454,8 @@ V = KP.canonicalize(V); + DEBUG(std::cerr << "peering into " << *V << "\n"); + if (BinaryOperator *BO = dyn_cast(V)) return resolve(BO, KP); else if (SelectInst *SI = dyn_cast(V)) @@ -466,8 +477,19 @@ DEBUG(std::cerr << "Considering instruction " << *I << "\n"); DEBUG(KnownProperties.debug(std::cerr)); - // Substitute values known to be equal. - for (unsigned i = 0, E = I->getNumOperands(); i != E; ++i) { + // Try to replace whole instruction. + Value *V = resolve(I, KnownProperties); + assert(V && "resolve not supposed to return NULL."); + if (V != I) { + modified = true; + ++NumInstruction; + I->replaceAllUsesWith(V); + I->eraseFromParent(); + return; + } + + // Try to substitute operands. + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { Value *Oper = I->getOperand(i); Value *V = resolve(Oper, KnownProperties); assert(V && "resolve not supposed to return NULL."); @@ -480,15 +502,6 @@ } } - Value *V = resolve(I, KnownProperties); - assert(V && "resolve not supposed to return NULL."); - if (V != I) { - modified = true; - ++NumInstruction; - I->replaceAllUsesWith(V); - I->eraseFromParent(); - } - if (TerminatorInst *TI = dyn_cast(I)) visit(TI, DTNode, KnownProperties); else if (LoadInst *LI = dyn_cast(I)) From rafael.espindola at gmail.com Sat Sep 2 15:24:41 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sat, 2 Sep 2006 15:24:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARM.h ARMISelDAGToDAG.cpp Message-ID: <200609022024.k82KOfQw006021@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARM.h updated: 1.3 -> 1.4 ARMISelDAGToDAG.cpp updated: 1.38 -> 1.39 --- Log message: add more condition codes --- Diffs of the changes: (+30 -2) ARM.h | 30 ++++++++++++++++++++++++++++-- ARMISelDAGToDAG.cpp | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) Index: llvm/lib/Target/ARM/ARM.h diff -u llvm/lib/Target/ARM/ARM.h:1.3 llvm/lib/Target/ARM/ARM.h:1.4 --- llvm/lib/Target/ARM/ARM.h:1.3 Thu Aug 24 12:19:08 2006 +++ llvm/lib/Target/ARM/ARM.h Sat Sep 2 15:24:25 2006 @@ -23,16 +23,42 @@ // Enums corresponding to ARM condition codes namespace ARMCC { enum CondCodes { + EQ, NE, - EQ + CS, + CC, + MI, + PL, + VS, + VC, + HI, + LS, + GE, + LT, + GT, + LE, + AL }; } static const char *ARMCondCodeToString(ARMCC::CondCodes CC) { switch (CC) { default: assert(0 && "Unknown condition code"); - case ARMCC::NE: return "ne"; case ARMCC::EQ: return "eq"; + case ARMCC::NE: return "ne"; + case ARMCC::CS: return "cs"; + case ARMCC::CC: return "cc"; + case ARMCC::MI: return "mi"; + case ARMCC::PL: return "pl"; + case ARMCC::VS: return "vs"; + case ARMCC::VC: return "vc"; + case ARMCC::HI: return "hi"; + case ARMCC::LS: return "ls"; + case ARMCC::GE: return "ge"; + case ARMCC::LT: return "lt"; + case ARMCC::GT: return "gt"; + case ARMCC::LE: return "le"; + case ARMCC::AL: return "al"; } } Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.38 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.39 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.38 Sat Aug 26 00:32:46 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Sat Sep 2 15:24:25 2006 @@ -89,6 +89,8 @@ default: assert(0 && "Unknown condition code!"); case ISD::SETNE: return ARMCC::NE; case ISD::SETEQ: return ARMCC::EQ; + case ISD::SETGE: return ARMCC::GE; + case ISD::SETUGE: return ARMCC::CS; } } From rafael.espindola at gmail.com Sat Sep 2 15:24:41 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sat, 2 Sep 2006 15:24:41 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/branch.ll Message-ID: <200609022024.k82KOfek006026@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: branch.ll updated: 1.1 -> 1.2 --- Log message: add more condition codes --- Diffs of the changes: (+33 -3) branch.ll | 36 +++++++++++++++++++++++++++++++++--- 1 files changed, 33 insertions(+), 3 deletions(-) Index: llvm/test/Regression/CodeGen/ARM/branch.ll diff -u llvm/test/Regression/CodeGen/ARM/branch.ll:1.1 llvm/test/Regression/CodeGen/ARM/branch.ll:1.2 --- llvm/test/Regression/CodeGen/ARM/branch.ll:1.1 Thu Aug 24 08:45:55 2006 +++ llvm/test/Regression/CodeGen/ARM/branch.ll Sat Sep 2 15:24:25 2006 @@ -1,7 +1,37 @@ -; RUN: llvm-as < %s | llc -march=arm -void %f(int %a, int* %v) { +; RUN: llvm-as < %s | llc -march=arm && +; RUN: llvm-as < %s | llc -march=arm | grep bne && +; RUN: llvm-as < %s | llc -march=arm | grep bge && +; RUN: llvm-as < %s | llc -march=arm | grep bcs + +void %f1(int %a, int %b, int* %v) { +entry: + %tmp = seteq int %a, %b ; [#uses=1] + br bool %tmp, label %cond_true, label %return + +cond_true: ; preds = %entry + store int 0, int* %v + ret void + +return: ; preds = %entry + ret void +} + +void %f2(int %a, int %b, int* %v) { +entry: + %tmp = setlt int %a, %b ; [#uses=1] + br bool %tmp, label %cond_true, label %return + +cond_true: ; preds = %entry + store int 0, int* %v + ret void + +return: ; preds = %entry + ret void +} + +void %f3(uint %a, uint %b, int* %v) { entry: - %tmp = seteq int %a, 0 ; [#uses=1] + %tmp = setlt uint %a, %b ; [#uses=1] br bool %tmp, label %cond_true, label %return cond_true: ; preds = %entry From resistor at mac.com Sat Sep 2 16:19:58 2006 From: resistor at mac.com (Owen Anderson) Date: Sat, 2 Sep 2006 16:19:58 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll Message-ID: <200609022119.k82LJw7Z006809@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ArgumentPromotion: recursion.ll added (r1.1) --- Log message: Make ArgumentPromotion handle recursive functions that pass pointers in their recursive calls. --- Diffs of the changes: (+16 -0) recursion.ll | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) Index: llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll diff -c /dev/null llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll:1.1 *** /dev/null Sat Sep 2 16:19:54 2006 --- llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll Sat Sep 2 16:19:44 2006 *************** *** 0 **** --- 1,16 ---- + ; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | grep x.val + ; ModuleID = 'recursive2.bc' + + implementation ; Functions: + + internal int %foo(int* %x) { + entry: + %tmp.foo = load int* %x + ret int %tmp.foo + } + + int %bar(int* %x) { + entry: + %tmp3 = call int %foo( int* %x) ; [#uses=1] + ret int %tmp3 + } \ No newline at end of file From resistor at mac.com Sat Sep 2 16:19:59 2006 From: resistor at mac.com (Owen Anderson) Date: Sat, 2 Sep 2006 16:19:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Message-ID: <200609022119.k82LJxDr006815@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: ArgumentPromotion.cpp updated: 1.22 -> 1.23 --- Log message: Make ArgumentPromotion handle recursive functions that pass pointers in their recursive calls. --- Diffs of the changes: (+33 -11) ArgumentPromotion.cpp | 44 +++++++++++++++++++++++++++++++++----------- 1 files changed, 33 insertions(+), 11 deletions(-) Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.22 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.23 --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.22 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Sat Sep 2 16:19:44 2006 @@ -186,6 +186,8 @@ /// elements of the aggregate in order to avoid exploding the number of /// arguments passed in. bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg) const { + AliasAnalysis &AA = getAnalysis(); + // We can only promote this argument if all of the uses are loads, or are GEP // instructions (with constant indices) that are subsequently loaded. bool HasLoadInEntryBlock = false; @@ -240,6 +242,25 @@ } GEPIndices.push_back(Operands); } + } else if (CallInst* CI = dyn_cast(*UI)) { + // Is this a recursive call? + if (CI->getCalledFunction() != Arg->getParent()) + return false; + + // Find out what position argument we're dealing with. + unsigned Position = 0; + Function::arg_iterator ArgPos = Arg->getParent()->arg_begin(); + while (Arg != ArgPos) { + assert(ArgPos != Arg->getParent()->arg_end() && + "Arg not in parent's arg list?"); + Position++; + ArgPos++; + } + + // We only know that the call is safe if it's passing the argument in + // the same position that it came in at. + if (UI.getOperandNo() != Position+1) + return false; } else { return false; // Not a load or a GEP. } @@ -264,8 +285,7 @@ // Because there could be several/many load instructions, remember which // blocks we know to be transparent to the load. std::set TranspBlocks; - - AliasAnalysis &AA = getAnalysis(); + TargetData &TD = getAnalysis(); for (unsigned i = 0, e = Loads.size(); i != e; ++i) { @@ -360,15 +380,17 @@ for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) { Instruction *User = cast(*UI); - assert(isa(User) || isa(User)); - std::vector Indices(User->op_begin()+1, User->op_end()); - ArgIndices.insert(Indices); - LoadInst *OrigLoad; - if (LoadInst *L = dyn_cast(User)) - OrigLoad = L; - else - OrigLoad = cast(User->use_back()); - OriginalLoads[Indices] = OrigLoad; + if (!isa(User)) { + assert(isa(User) || isa(User)); + std::vector Indices(User->op_begin()+1, User->op_end()); + ArgIndices.insert(Indices); + LoadInst *OrigLoad; + if (LoadInst *L = dyn_cast(User)) + OrigLoad = L; + else + OrigLoad = cast(User->use_back()); + OriginalLoads[Indices] = OrigLoad; + } } // Add a parameter to the function for each element passed in. From lattner at cs.uiuc.edu Sat Sep 2 17:27:43 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 17:27:43 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200609022227.k82MRhTv008299@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.59 -> 1.60 --- Log message: Fix a typo pointed out by Gabor --- Diffs of the changes: (+1 -1) LiveIntervalAnalysis.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.59 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.60 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.59 Sat Sep 2 00:32:53 2006 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Sat Sep 2 17:27:29 2006 @@ -180,7 +180,7 @@ /// below to update aliases. bool JoinIntervals(LiveInterval &LHS, LiveInterval &RHS); - /// SimpleJoin - Attempt to joint the specified interval into this one. The + /// SimpleJoin - Attempt to join the specified interval into this one. The /// caller of this method must guarantee that the RHS only contains a single /// value number and that the RHS is not defined by a copy from this /// interval. This returns false if the intervals are not joinable, or it From resistor at mac.com Sat Sep 2 17:47:12 2006 From: resistor at mac.com (Owen Anderson) Date: Sat, 2 Sep 2006 17:47:12 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll Message-ID: <200609022247.k82MlCxR008579@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ArgumentPromotion: recursion.ll updated: 1.1 -> 1.2 --- Log message: Make this testcase actually recursive. I accidentally committed the wrong copy last time. --- Diffs of the changes: (+2 -1) recursion.ll | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll diff -u llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll:1.1 llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll:1.2 --- llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll:1.1 Sat Sep 2 16:19:44 2006 +++ llvm/test/Regression/Transforms/ArgumentPromotion/recursion.ll Sat Sep 2 17:46:58 2006 @@ -5,7 +5,8 @@ internal int %foo(int* %x) { entry: - %tmp.foo = load int* %x + %tmp = load int* %x + %tmp.foo = call int %foo(int *%x) ret int %tmp.foo } From lattner at cs.uiuc.edu Sat Sep 2 18:09:38 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 18:09:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManagerT.h Message-ID: <200609022309.k82N9cCa008943@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManagerT.h updated: 1.68 -> 1.69 --- Log message: Count the time for a pass to ReleaseMemory against that pass. Not doing this was under accounting for the time that livevariables cost --- Diffs of the changes: (+2 -0) PassManagerT.h | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/VMCore/PassManagerT.h diff -u llvm/lib/VMCore/PassManagerT.h:1.68 llvm/lib/VMCore/PassManagerT.h:1.69 --- llvm/lib/VMCore/PassManagerT.h:1.68 Sun Aug 27 19:08:25 2006 +++ llvm/lib/VMCore/PassManagerT.h Sat Sep 2 18:09:24 2006 @@ -670,7 +670,9 @@ for (std::vector::iterator I = DeadPass.begin(),E = DeadPass.end(); I != E; ++I) { PMDebug::PrintPassInformation(getDepth()+1, "Freeing Pass", *I, M); + if (TheTimeInfo) TheTimeInfo->passStarted(*I); (*I)->releaseMemory(); + if (TheTimeInfo) TheTimeInfo->passEnded(*I); } for (std::map::iterator I = CurrentAnalyses.begin(); From lattner at cs.uiuc.edu Sat Sep 2 19:04:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 19:04:13 -0500 Subject: [llvm-commits] CVS: llvm-www/Features.html Message-ID: <200609030004.k8304DjW009948@zion.cs.uiuc.edu> Changes in directory llvm-www: Features.html updated: 1.16 -> 1.17 --- Log message: clean this up --- Diffs of the changes: (+11 -8) Features.html | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) Index: llvm-www/Features.html diff -u llvm-www/Features.html:1.16 llvm-www/Features.html:1.17 --- llvm-www/Features.html:1.16 Thu Mar 16 13:02:22 2006 +++ llvm-www/Features.html Sat Sep 2 19:03:59 2006 @@ -5,7 +5,8 @@ following:

          -
        • Front-ends for C and C++ based on the GCC 3.4 parser. They support the +
        • Front-ends for C and C++ based on the GCC 3.4 and 4.0.01 parsers. + They support the full ANSI-standard C and C++ languages, plus many GCC extensions. LLVM also includes a front-end for "Stacker", a Forth-like language.
        • @@ -25,11 +26,11 @@ analysis, call graph construction, and support for profile-guided optimizations. -
        • Static native code generators for x86, Sparc, PowerPC, Alpha, and - IA-64.
        • +
        • An easily retargettable code generator, which currently supports X86, + Sparc, PowerPC, Alpha, and IA-64.
        • -
        • A Just-In-Time (JIT) code generation system for x86, Sparc, and - PowerPC.
        • +
        • A Just-In-Time (JIT) code generation system for X86, Sparc, + PowerPC and PowerPC-64.
        • A C back-end useful for testing and for generating native code on targets other than the ones listed above.
        • @@ -67,9 +68,8 @@
        • LLVM has full support for accurate garbage collection.
        • -
        • It includes native code generators for X86, Sparc, PowerPC, Alpha, and - IA-64. LLVM can also compile to C code on targets where it does not have - native back-end support. Other native backends are in development.
        • +
        • The LLVM code generator is relatively easy to retarget, and makes use of + a powerful target description language.
        • LLVM has extensive documentation and has hosted many projects of various sorts.
        • @@ -86,6 +86,9 @@
        • LLVM is freely available under an OSI-approved "three-clause BSD" license.
        • + +
        • LLVM is currently used by several commercial entities, who contribute + many extensions and new features.
        • From lattner at cs.uiuc.edu Sat Sep 2 19:05:23 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 19:05:23 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h Message-ID: <200609030005.k8305NZU010017@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.28 -> 1.29 --- Log message: Move two methods out of line, make them work when the record for a machine instruction includes physregs. --- Diffs of the changes: (+6 -28) LiveVariables.h | 34 ++++++---------------------------- 1 files changed, 6 insertions(+), 28 deletions(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.28 llvm/include/llvm/CodeGen/LiveVariables.h:1.29 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.28 Wed Jan 4 01:29:33 2006 +++ llvm/include/llvm/CodeGen/LiveVariables.h Sat Sep 2 19:05:09 2006 @@ -242,19 +242,8 @@ /// removeVirtualRegistersKilled - Remove all killed info for the specified /// instruction. - void removeVirtualRegistersKilled(MachineInstr *MI) { - std::map >::iterator I = - RegistersKilled.find(MI); - if (I != RegistersKilled.end()) { - std::vector &Regs = I->second; - for (unsigned i = 0, e = Regs.size(); i != e; ++i) { - bool removed = getVarInfo(Regs[i]).removeKill(MI); - assert(removed && "kill not in register's VarInfo?"); - } - RegistersKilled.erase(I); - } - } - + void removeVirtualRegistersKilled(MachineInstr *MI); + /// addVirtualRegisterDead - Add information about the fact that the specified /// register is dead after being used by the specified instruction. /// @@ -292,21 +281,10 @@ return true; } - /// removeVirtualRegistersDead - Remove all of the specified dead - /// registers from the live variable information. - void removeVirtualRegistersDead(MachineInstr *MI) { - std::map >::iterator I = - RegistersDead.find(MI); - if (I != RegistersDead.end()) { - std::vector &Regs = I->second; - for (unsigned i = 0, e = Regs.size(); i != e; ++i) { - bool removed = getVarInfo(Regs[i]).removeKill(MI); - assert(removed && "kill not in register's VarInfo?"); - } - RegistersDead.erase(I); - } - } - + /// removeVirtualRegistersDead - Remove all of the dead registers for the + /// specified instruction from the live variable information. + void removeVirtualRegistersDead(MachineInstr *MI); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } From lattner at cs.uiuc.edu Sat Sep 2 19:05:25 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 19:05:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveVariables.cpp Message-ID: <200609030005.k8305Pq8010023@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveVariables.cpp updated: 1.57 -> 1.58 --- Log message: Move two methods out of line, make them work when the record for a machine instruction includes physregs. --- Diffs of the changes: (+36 -0) LiveVariables.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+) Index: llvm/lib/CodeGen/LiveVariables.cpp diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.57 llvm/lib/CodeGen/LiveVariables.cpp:1.58 --- llvm/lib/CodeGen/LiveVariables.cpp:1.57 Sun Aug 27 17:30:17 2006 +++ llvm/lib/CodeGen/LiveVariables.cpp Sat Sep 2 19:05:09 2006 @@ -415,3 +415,39 @@ RegistersDead.erase(OldMI); } } + +/// removeVirtualRegistersKilled - Remove all killed info for the specified +/// instruction. +void LiveVariables::removeVirtualRegistersKilled(MachineInstr *MI) { + std::map >::iterator I = + RegistersKilled.find(MI); + if (I == RegistersKilled.end()) return; + + std::vector &Regs = I->second; + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { + if (MRegisterInfo::isVirtualRegister(Regs[i])) { + bool removed = getVarInfo(Regs[i]).removeKill(MI); + assert(removed && "kill not in register's VarInfo?"); + } + } + RegistersKilled.erase(I); +} + +/// removeVirtualRegistersDead - Remove all of the dead registers for the +/// specified instruction from the live variable information. +void LiveVariables::removeVirtualRegistersDead(MachineInstr *MI) { + std::map >::iterator I = + RegistersDead.find(MI); + if (I == RegistersDead.end()) return; + + std::vector &Regs = I->second; + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { + if (MRegisterInfo::isVirtualRegister(Regs[i])) { + bool removed = getVarInfo(Regs[i]).removeKill(MI); + assert(removed && "kill not in register's VarInfo?"); + } + } + RegistersDead.erase(I); +} + + From lattner at cs.uiuc.edu Sat Sep 2 19:06:22 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 2 Sep 2006 19:06:22 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLocal.cpp Message-ID: <200609030006.k8306M4U010082@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLocal.cpp updated: 1.86 -> 1.87 --- Log message: When deleting a machine instruction, make sure to remove it from the livevariables information. This fixes several regalloc=local failures on x86 --- Diffs of the changes: (+4 -1) RegAllocLocal.cpp | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/RegAllocLocal.cpp diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.86 llvm/lib/CodeGen/RegAllocLocal.cpp:1.87 --- llvm/lib/CodeGen/RegAllocLocal.cpp:1.86 Sun Aug 27 07:54:01 2006 +++ llvm/lib/CodeGen/RegAllocLocal.cpp Sat Sep 2 19:06:08 2006 @@ -659,8 +659,11 @@ // Finally, if this is a noop copy instruction, zap it. unsigned SrcReg, DstReg; - if (TII.isMoveInstr(*MI, SrcReg, DstReg) && SrcReg == DstReg) + if (TII.isMoveInstr(*MI, SrcReg, DstReg) && SrcReg == DstReg) { + LV->removeVirtualRegistersKilled(MI); + LV->removeVirtualRegistersDead(MI); MBB.erase(MI); + } } MachineBasicBlock::iterator MI = MBB.getFirstTerminator(); From lattner at cs.uiuc.edu Sun Sep 3 02:15:02 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 02:15:02 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-09-02-LocalAllocCrash.ll Message-ID: <200609030715.k837F2NS022362@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-09-02-LocalAllocCrash.ll added (r1.1) --- Log message: Testcase (distilled from crafty) that crashed the local RA on X86. --- Diffs of the changes: (+115 -0) 2006-09-02-LocalAllocCrash.ll | 115 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 115 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2006-09-02-LocalAllocCrash.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2006-09-02-LocalAllocCrash.ll:1.1 *** /dev/null Sun Sep 3 02:14:57 2006 --- llvm/test/Regression/CodeGen/Generic/2006-09-02-LocalAllocCrash.ll Sun Sep 3 02:14:47 2006 *************** *** 0 **** --- 1,115 ---- + ; RUN: llvm-as < %s | llc -regalloc=local + + %struct.CHESS_POSITION = type { ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, uint, int, sbyte, sbyte, [64 x sbyte], sbyte, sbyte, sbyte, sbyte, sbyte } + %search = external global %struct.CHESS_POSITION ; <%struct.CHESS_POSITION*> [#uses=2] + %bishop_shift_rl45 = external global [64 x int] ; <[64 x int]*> [#uses=1] + %bishop_shift_rr45 = external global [64 x int] ; <[64 x int]*> [#uses=1] + %black_outpost = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=1] + %bishop_mobility_rl45 = external global [64 x [256 x int]] ; <[64 x [256 x int]]*> [#uses=1] + %bishop_mobility_rr45 = external global [64 x [256 x int]] ; <[64 x [256 x int]]*> [#uses=1] + + implementation ; Functions: + + declare fastcc int %FirstOne() + + fastcc void %Evaluate() { + entry: + br bool false, label %cond_false186, label %cond_true + + cond_true: ; preds = %entry + ret void + + cond_false186: ; preds = %entry + br bool false, label %cond_true293, label %bb203 + + bb203: ; preds = %cond_false186 + ret void + + cond_true293: ; preds = %cond_false186 + br bool false, label %cond_true298, label %cond_next317 + + cond_true298: ; preds = %cond_true293 + br bool false, label %cond_next518, label %cond_true397.preheader + + cond_next317: ; preds = %cond_true293 + ret void + + cond_true397.preheader: ; preds = %cond_true298 + ret void + + cond_next518: ; preds = %cond_true298 + br bool false, label %bb1069, label %cond_true522 + + cond_true522: ; preds = %cond_next518 + ret void + + bb1069: ; preds = %cond_next518 + br bool false, label %cond_next1131, label %bb1096 + + bb1096: ; preds = %bb1069 + ret void + + cond_next1131: ; preds = %bb1069 + br bool false, label %cond_next1207, label %cond_true1150 + + cond_true1150: ; preds = %cond_next1131 + ret void + + cond_next1207: ; preds = %cond_next1131 + br bool false, label %cond_next1219, label %cond_true1211 + + cond_true1211: ; preds = %cond_next1207 + ret void + + cond_next1219: ; preds = %cond_next1207 + br bool false, label %cond_true1223, label %cond_next1283 + + cond_true1223: ; preds = %cond_next1219 + br bool false, label %cond_true1254, label %cond_true1264 + + cond_true1254: ; preds = %cond_true1223 + br bool false, label %bb1567, label %cond_true1369.preheader + + cond_true1264: ; preds = %cond_true1223 + ret void + + cond_next1283: ; preds = %cond_next1219 + ret void + + cond_true1369.preheader: ; preds = %cond_true1254 + ret void + + bb1567: ; preds = %cond_true1254 + %tmp1580 = load ulong* getelementptr (%struct.CHESS_POSITION* %search, int 0, uint 3) ; [#uses=1] + %tmp1591 = load ulong* getelementptr (%struct.CHESS_POSITION* %search, int 0, uint 4) ; [#uses=1] + %tmp1572 = tail call fastcc int %FirstOne( ) ; [#uses=5] + %tmp1582 = getelementptr [64 x int]* %bishop_shift_rl45, int 0, int %tmp1572 ; [#uses=1] + %tmp1583 = load int* %tmp1582 ; [#uses=1] + %tmp1583 = cast int %tmp1583 to ubyte ; [#uses=1] + %tmp1584 = shr ulong %tmp1580, ubyte %tmp1583 ; [#uses=1] + %tmp1584 = cast ulong %tmp1584 to uint ; [#uses=1] + %tmp1585 = and uint %tmp1584, 255 ; [#uses=1] + %tmp1587 = getelementptr [64 x [256 x int]]* %bishop_mobility_rl45, int 0, int %tmp1572, uint %tmp1585 ; [#uses=1] + %tmp1588 = load int* %tmp1587 ; [#uses=1] + %tmp1593 = getelementptr [64 x int]* %bishop_shift_rr45, int 0, int %tmp1572 ; [#uses=1] + %tmp1594 = load int* %tmp1593 ; [#uses=1] + %tmp1594 = cast int %tmp1594 to ubyte ; [#uses=1] + %tmp1595 = shr ulong %tmp1591, ubyte %tmp1594 ; [#uses=1] + %tmp1595 = cast ulong %tmp1595 to uint ; [#uses=1] + %tmp1596 = and uint %tmp1595, 255 ; [#uses=1] + %tmp1598 = getelementptr [64 x [256 x int]]* %bishop_mobility_rr45, int 0, int %tmp1572, uint %tmp1596 ; [#uses=1] + %tmp1599 = load int* %tmp1598 ; [#uses=1] + %tmp1600.neg = sub int 0, %tmp1588 ; [#uses=1] + %tmp1602 = sub int %tmp1600.neg, %tmp1599 ; [#uses=1] + %tmp1604 = getelementptr [64 x sbyte]* %black_outpost, int 0, int %tmp1572 ; [#uses=1] + %tmp1605 = load sbyte* %tmp1604 ; [#uses=1] + %tmp1606 = seteq sbyte %tmp1605, 0 ; [#uses=1] + br bool %tmp1606, label %cond_next1637, label %cond_true1607 + + cond_true1607: ; preds = %bb1567 + ret void + + cond_next1637: ; preds = %bb1567 + %tmp1662 = sub int %tmp1602, 0 ; [#uses=0] + ret void + } From lattner at cs.uiuc.edu Sun Sep 3 02:15:53 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 02:15:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLocal.cpp Message-ID: <200609030715.k837Frk5023140@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLocal.cpp updated: 1.87 -> 1.88 --- Log message: Fix Regression/CodeGen/Generic/2006-09-02-LocalAllocCrash.ll on X86. Just because an alias of a register is available, it doesn't mean that we can arbitrarily evict the register. --- Diffs of the changes: (+11 -6) RegAllocLocal.cpp | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/RegAllocLocal.cpp diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.87 llvm/lib/CodeGen/RegAllocLocal.cpp:1.88 --- llvm/lib/CodeGen/RegAllocLocal.cpp:1.87 Sat Sep 2 19:06:08 2006 +++ llvm/lib/CodeGen/RegAllocLocal.cpp Sun Sep 3 02:15:37 2006 @@ -103,8 +103,8 @@ } void MarkPhysRegRecentlyUsed(unsigned Reg) { - if(PhysRegsUseOrder.empty() || - PhysRegsUseOrder.back() == Reg) return; // Already most recently used + if (PhysRegsUseOrder.empty() || + PhysRegsUseOrder.back() == Reg) return; // Already most recently used for (unsigned i = PhysRegsUseOrder.size(); i != 0; --i) if (areRegsEqual(Reg, PhysRegsUseOrder[i-1])) { @@ -408,10 +408,15 @@ } else { // If one of the registers aliased to the current register is // compatible, use it. - for (const unsigned *AliasSet = RegInfo->getAliasSet(R); - *AliasSet; ++AliasSet) { - if (RC->contains(*AliasSet)) { - PhysReg = *AliasSet; // Take an aliased register + for (const unsigned *AliasIt = RegInfo->getAliasSet(R); + *AliasIt; ++AliasIt) { + if (RC->contains(*AliasIt) && + // If this is pinned down for some reason, don't use it. For + // example, if CL is pinned, and we run across CH, don't use + // CH as justification for using scavenging ECX (which will + // fail). + PhysRegsUsed[*AliasIt] != 0) { + PhysReg = *AliasIt; // Take an aliased register break; } } From lattner at cs.uiuc.edu Sun Sep 3 02:54:05 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 02:54:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200609030754.k837s5i7025267@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.181 -> 1.182 --- Log message: minor speedup --- Diffs of the changes: (+3 -3) LiveIntervalAnalysis.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.181 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.182 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.181 Sat Sep 2 00:32:53 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Sun Sep 3 02:53:50 2006 @@ -161,7 +161,7 @@ numIntervalsAfter += getNumIntervals(); // perform a final pass over the instructions and compute spill - // weights, coalesce virtual registers and remove identity moves + // weights, coalesce virtual registers and remove identity moves. const LoopInfo& loopInfo = getAnalysis(); for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end(); @@ -182,8 +182,8 @@ ++numPeep; } else { - for (unsigned i = 0; i < mii->getNumOperands(); ++i) { - const MachineOperand& mop = mii->getOperand(i); + for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) { + const MachineOperand &mop = mii->getOperand(i); if (mop.isRegister() && mop.getReg() && MRegisterInfo::isVirtualRegister(mop.getReg())) { // replace register with representative register From lattner at cs.uiuc.edu Sun Sep 3 03:07:40 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 03:07:40 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200609030807.k8387eag025564@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.60 -> 1.61 --- Log message: Avoid beating on the mi2i map when we know the answer already. --- Diffs of the changes: (+6 -4) LiveIntervalAnalysis.h | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.60 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.61 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.60 Sat Sep 2 17:27:29 2006 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Sun Sep 3 03:07:11 2006 @@ -190,20 +190,22 @@ /// handleRegisterDef - update intervals for a register def /// (calls handlePhysicalRegisterDef and /// handleVirtualRegisterDef) - void handleRegisterDef(MachineBasicBlock* mbb, - MachineBasicBlock::iterator mi, + void handleRegisterDef(MachineBasicBlock *MBB, + MachineBasicBlock::iterator MI, unsigned MIIdx, unsigned reg); /// handleVirtualRegisterDef - update intervals for a virtual /// register def - void handleVirtualRegisterDef(MachineBasicBlock* mbb, - MachineBasicBlock::iterator mi, + void handleVirtualRegisterDef(MachineBasicBlock *MBB, + MachineBasicBlock::iterator MI, + unsigned MIIdx, LiveInterval& interval); /// handlePhysicalRegisterDef - update intervals for a physical register /// def. void handlePhysicalRegisterDef(MachineBasicBlock* mbb, MachineBasicBlock::iterator mi, + unsigned MIIdx, LiveInterval &interval, unsigned SrcReg); From lattner at cs.uiuc.edu Sun Sep 3 03:07:40 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 03:07:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200609030807.k8387eap025565@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.182 -> 1.183 --- Log message: Avoid beating on the mi2i map when we know the answer already. --- Diffs of the changes: (+19 -12) LiveIntervalAnalysis.cpp | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.182 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.183 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.182 Sun Sep 3 02:53:50 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Sun Sep 3 03:07:11 2006 @@ -137,10 +137,10 @@ MachineBasicBlock *Entry = fn.begin(); for (MachineFunction::livein_iterator I = fn.livein_begin(), E = fn.livein_end(); I != E; ++I) { - handlePhysicalRegisterDef(Entry, Entry->begin(), + handlePhysicalRegisterDef(Entry, Entry->begin(), 0, getOrCreateInterval(I->first), 0); for (const unsigned* AS = mri_->getAliasSet(I->first); *AS; ++AS) - handlePhysicalRegisterDef(Entry, Entry->begin(), + handlePhysicalRegisterDef(Entry, Entry->begin(), 0, getOrCreateInterval(*AS), 0); } } @@ -354,6 +354,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, MachineBasicBlock::iterator mi, + unsigned MIIdx, LiveInterval &interval) { DEBUG(std::cerr << "\t\tregister: "; printRegName(interval.reg)); LiveVariables::VarInfo& vi = lv_->getVarInfo(interval.reg); @@ -364,7 +365,7 @@ // time we see a vreg. if (interval.empty()) { // Get the Idx of the defining instructions. - unsigned defIndex = getDefIndex(getInstructionIndex(mi)); + unsigned defIndex = getDefIndex(MIIdx); unsigned ValNum; unsigned SrcReg, DstReg; @@ -451,7 +452,7 @@ // need to take the LiveRegion that defines this register and split it // into two values. unsigned DefIndex = getDefIndex(getInstructionIndex(vi.DefInst)); - unsigned RedefIndex = getDefIndex(getInstructionIndex(mi)); + unsigned RedefIndex = getDefIndex(MIIdx); // Delete the initial value, which should be short and continuous, // because the 2-addr copy must be in the same MBB as the redef. @@ -509,7 +510,7 @@ // In the case of PHI elimination, each variable definition is only // live until the end of the block. We've already taken care of the // rest of the live range. - unsigned defIndex = getDefIndex(getInstructionIndex(mi)); + unsigned defIndex = getDefIndex(MIIdx); unsigned ValNum; unsigned SrcReg, DstReg; @@ -530,6 +531,7 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock *MBB, MachineBasicBlock::iterator mi, + unsigned MIIdx, LiveInterval &interval, unsigned SrcReg) { // A physical register cannot be live across basic block, so its @@ -537,7 +539,7 @@ DEBUG(std::cerr << "\t\tregister: "; printRegName(interval.reg)); typedef LiveVariables::killed_iterator KillIter; - unsigned baseIndex = getInstructionIndex(mi); + unsigned baseIndex = MIIdx; unsigned start = getDefIndex(baseIndex); unsigned end = start; @@ -579,16 +581,17 @@ void LiveIntervals::handleRegisterDef(MachineBasicBlock *MBB, MachineBasicBlock::iterator MI, + unsigned MIIdx, unsigned reg) { if (MRegisterInfo::isVirtualRegister(reg)) - handleVirtualRegisterDef(MBB, MI, getOrCreateInterval(reg)); + handleVirtualRegisterDef(MBB, MI, MIIdx, getOrCreateInterval(reg)); else if (allocatableRegs_[reg]) { unsigned SrcReg, DstReg; if (!tii_->isMoveInstr(*MI, SrcReg, DstReg)) SrcReg = 0; - handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(reg), SrcReg); + handlePhysicalRegisterDef(MBB, MI, MIIdx, getOrCreateInterval(reg), SrcReg); for (const unsigned* AS = mri_->getAliasSet(reg); *AS; ++AS) - handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(*AS), 0); + handlePhysicalRegisterDef(MBB, MI, MIIdx, getOrCreateInterval(*AS), 0); } } @@ -602,6 +605,8 @@ << ((Value*)mf_->getFunction())->getName() << '\n'); bool IgnoreFirstInstr = mf_->livein_begin() != mf_->livein_end(); + // Track the index of the current machine instr. + unsigned MIIndex = 0; for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E; ++I) { MachineBasicBlock* mbb = I; @@ -612,12 +617,12 @@ for (; mi != miEnd; ++mi) { const TargetInstrDescriptor& tid = tm_->getInstrInfo()->get(mi->getOpcode()); - DEBUG(std::cerr << getInstructionIndex(mi) << "\t" << *mi); + DEBUG(std::cerr << MIIndex << "\t" << *mi); // handle implicit defs if (tid.ImplicitDefs) { for (const unsigned* id = tid.ImplicitDefs; *id; ++id) - handleRegisterDef(mbb, mi, *id); + handleRegisterDef(mbb, mi, MIIndex, *id); } // handle explicit defs @@ -625,8 +630,10 @@ MachineOperand& mop = mi->getOperand(i); // handle register defs - build intervals if (mop.isRegister() && mop.getReg() && mop.isDef()) - handleRegisterDef(mbb, mi, mop.getReg()); + handleRegisterDef(mbb, mi, MIIndex, mop.getReg()); } + + MIIndex += InstrSlots::NUM; } } } From rafael.espindola at gmail.com Sun Sep 3 08:19:34 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 3 Sep 2006 08:19:34 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/branch.ll Message-ID: <200609031319.k83DJYRb030987@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: branch.ll updated: 1.2 -> 1.3 --- Log message: add the SETULT condition code --- Diffs of the changes: (+15 -1) branch.ll | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/ARM/branch.ll diff -u llvm/test/Regression/CodeGen/ARM/branch.ll:1.2 llvm/test/Regression/CodeGen/ARM/branch.ll:1.3 --- llvm/test/Regression/CodeGen/ARM/branch.ll:1.2 Sat Sep 2 15:24:25 2006 +++ llvm/test/Regression/CodeGen/ARM/branch.ll Sun Sep 3 08:19:16 2006 @@ -1,7 +1,8 @@ ; RUN: llvm-as < %s | llc -march=arm && ; RUN: llvm-as < %s | llc -march=arm | grep bne && ; RUN: llvm-as < %s | llc -march=arm | grep bge && -; RUN: llvm-as < %s | llc -march=arm | grep bcs +; RUN: llvm-as < %s | llc -march=arm | grep bcs && +; RUN: llvm-as < %s | llc -march=arm | grep bcc void %f1(int %a, int %b, int* %v) { entry: @@ -41,3 +42,16 @@ return: ; preds = %entry ret void } + +void %f4(uint %a, uint %b, int* %v) { +entry: + %tmp = setlt uint %a, %b ; [#uses=1] + br bool %tmp, label %return, label %cond_true + +cond_true: ; preds = %entry + store int 0, int* %v + ret void + +return: ; preds = %entry + ret void +} From rafael.espindola at gmail.com Sun Sep 3 08:19:34 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 3 Sep 2006 08:19:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200609031319.k83DJYFv030988@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.39 -> 1.40 --- Log message: add the SETULT condition code --- Diffs of the changes: (+1 -0) ARMISelDAGToDAG.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.39 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.40 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.39 Sat Sep 2 15:24:25 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Sun Sep 3 08:19:15 2006 @@ -91,6 +91,7 @@ case ISD::SETEQ: return ARMCC::EQ; case ISD::SETGE: return ARMCC::GE; case ISD::SETUGE: return ARMCC::CS; + case ISD::SETULT: return ARMCC::CC; } } From lattner at cs.uiuc.edu Sun Sep 3 13:37:26 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:37:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200609031837.k83IbQpE003510@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.78 -> 1.79 --- Log message: eliminate use of TM.getName() --- Diffs of the changes: (+1 -2) JIT.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.78 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.79 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.78 Fri Sep 1 13:45:22 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Sun Sep 3 13:37:12 2006 @@ -67,8 +67,7 @@ // Turn the machine code intermediate representation into bytes in memory that // may be executed. if (TM.addPassesToEmitMachineCode(PM, *MCE)) { - std::cerr << "Target '" << TM.getName() - << "' doesn't support machine code emission!\n"; + std::cerr << "Target does not support machine code emission!\n"; abort(); } } From lattner at cs.uiuc.edu Sun Sep 3 13:38:44 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:38:44 -0500 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200609031838.k83IciFi003556@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.138 -> 1.139 --- Log message: Remove use of target::getName() --- Diffs of the changes: (+2 -2) llc.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.138 llvm/tools/llc/llc.cpp:1.139 --- llvm/tools/llc/llc.cpp:1.138 Wed Aug 23 16:29:52 2006 +++ llvm/tools/llc/llc.cpp Sun Sep 3 13:38:30 2006 @@ -222,8 +222,8 @@ // Ask the target to add backend passes as necessary. if (Target.addPassesToEmitFile(Passes, *Out, FileType, Fast)) { - std::cerr << argv[0] << ": target '" << Target.getName() - << "' does not support generation of this file type!\n"; + std::cerr << argv[0] << ": target does not support generation of this" + << " file type!\n"; if (Out != &std::cout) delete Out; // And the Out file is empty and useless, so remove it now. sys::Path(OutputFilename).eraseFromDisk(); From lattner at cs.uiuc.edu Sun Sep 3 13:44:27 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Message-ID: <200609031844.k83IiRMN003761@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCTargetMachine.cpp updated: 1.101 -> 1.102 --- Log message: Simplify target construction. --- 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.101 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.102 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.101 Mon Aug 28 21:30:59 2006 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Sun Sep 3 13:44:02 2006 @@ -85,7 +85,7 @@ PPCTargetMachine::PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit) - : TargetMachine("PowerPC"), Subtarget(M, FS, is64Bit), + : Subtarget(M, FS, is64Bit), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this, false), JITInfo(*this, is64Bit), TLInfo(*this), InstrItins(Subtarget.getInstrItineraryData()) { From lattner at cs.uiuc.edu Sun Sep 3 13:44:27 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMTargetMachine.cpp Message-ID: <200609031844.k83IiRw7003766@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMTargetMachine.cpp updated: 1.6 -> 1.7 --- Log message: Simplify target construction. --- Diffs of the changes: (+1 -2) ARMTargetMachine.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Target/ARM/ARMTargetMachine.cpp diff -u llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.6 llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.7 --- llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.6 Mon Aug 21 17:00:32 2006 +++ llvm/lib/Target/ARM/ARMTargetMachine.cpp Sun Sep 3 13:44:02 2006 @@ -33,8 +33,7 @@ /// TargetMachine ctor - Create an ILP32 architecture model /// ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS) - : TargetMachine("ARM"), DataLayout("E-p:32:32"), - FrameInfo() { + : DataLayout("E-p:32:32") { } unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) { From lattner at cs.uiuc.edu Sun Sep 3 13:44:28 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcTargetMachine.cpp Message-ID: <200609031844.k83IiSrK003771@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcTargetMachine.cpp updated: 1.48 -> 1.49 --- Log message: Simplify target construction. --- Diffs of the changes: (+1 -1) SparcTargetMachine.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Sparc/SparcTargetMachine.cpp diff -u llvm/lib/Target/Sparc/SparcTargetMachine.cpp:1.48 llvm/lib/Target/Sparc/SparcTargetMachine.cpp:1.49 --- llvm/lib/Target/Sparc/SparcTargetMachine.cpp:1.48 Fri Jun 16 13:22:52 2006 +++ llvm/lib/Target/Sparc/SparcTargetMachine.cpp Sun Sep 3 13:44:02 2006 @@ -31,7 +31,7 @@ /// SparcTargetMachine ctor - Create an ILP32 architecture model /// SparcTargetMachine::SparcTargetMachine(const Module &M, const std::string &FS) - : TargetMachine("Sparc"), DataLayout("E-p:32:32"), + : DataLayout("E-p:32:32"), Subtarget(M, FS), InstrInfo(Subtarget), FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) { } From lattner at cs.uiuc.edu Sun Sep 3 13:44:28 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Message-ID: <200609031844.k83IiS1s003779@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaTargetMachine.cpp updated: 1.27 -> 1.28 --- Log message: Simplify target construction. --- Diffs of the changes: (+1 -1) AlphaTargetMachine.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.27 llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.28 --- llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.27 Tue Jul 25 15:40:54 2006 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Sun Sep 3 13:44:02 2006 @@ -54,7 +54,7 @@ } AlphaTargetMachine::AlphaTargetMachine(const Module &M, const std::string &FS) - : TargetMachine("alpha"), DataLayout("e"), + : DataLayout("e"), FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), JITInfo(*this), Subtarget(M, FS) From lattner at cs.uiuc.edu Sun Sep 3 13:44:28 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp Message-ID: <200609031844.k83IiScx003776@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetMachine.cpp updated: 1.122 -> 1.123 --- Log message: Simplify target construction. --- Diffs of the changes: (+1 -3) X86TargetMachine.cpp | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.122 llvm/lib/Target/X86/X86TargetMachine.cpp:1.123 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.122 Tue Aug 29 13:28:33 2006 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Sun Sep 3 13:44:02 2006 @@ -68,9 +68,7 @@ /// X86TargetMachine ctor - Create an ILP32 architecture model /// X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS) - : TargetMachine("X86"), - Subtarget(M, FS), - DataLayout("e-p:32:32-d:32-l:32"), + : Subtarget(M, FS), DataLayout("e-p:32:32-d:32-l:32"), FrameInfo(TargetFrameInfo::StackGrowsDown, Subtarget.getStackAlignment(), -4), InstrInfo(*this), JITInfo(*this), TLInfo(*this) { From lattner at cs.uiuc.edu Sun Sep 3 13:44:29 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp Message-ID: <200609031844.k83IiTN9003786@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetMachine.cpp updated: 1.51 -> 1.52 --- Log message: Simplify target construction. --- Diffs of the changes: (+0 -4) TargetMachine.cpp | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.51 llvm/lib/Target/TargetMachine.cpp:1.52 --- llvm/lib/Target/TargetMachine.cpp:1.51 Tue Aug 29 10:13:10 2006 +++ llvm/lib/Target/TargetMachine.cpp Sun Sep 3 13:44:02 2006 @@ -95,10 +95,6 @@ // TargetMachine Class // -TargetMachine::TargetMachine(const std::string &name, const Module &M) - : Name(name) { -} - TargetMachine::~TargetMachine() { } From lattner at cs.uiuc.edu Sun Sep 3 13:44:29 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/CTargetMachine.h Message-ID: <200609031844.k83IiTET003791@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: CTargetMachine.h updated: 1.14 -> 1.15 --- Log message: Simplify target construction. --- Diffs of the changes: (+1 -1) CTargetMachine.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/CBackend/CTargetMachine.h diff -u llvm/lib/Target/CBackend/CTargetMachine.h:1.14 llvm/lib/Target/CBackend/CTargetMachine.h:1.15 --- llvm/lib/Target/CBackend/CTargetMachine.h:1.14 Fri Jun 16 13:22:52 2006 +++ llvm/lib/Target/CBackend/CTargetMachine.h Sun Sep 3 13:44:02 2006 @@ -23,7 +23,7 @@ const TargetData DataLayout; // Calculates type size & alignment CTargetMachine(const Module &M, const std::string &FS) - : TargetMachine("CBackend", M), DataLayout(&M) {} + : DataLayout(&M) {} // This is the only thing that actually does anything here. virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, From lattner at cs.uiuc.edu Sun Sep 3 13:44:29 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64TargetMachine.cpp Message-ID: <200609031844.k83IiTfO003796@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64TargetMachine.cpp updated: 1.18 -> 1.19 --- Log message: Simplify target construction. --- Diffs of the changes: (+1 -1) IA64TargetMachine.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/IA64/IA64TargetMachine.cpp diff -u llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.18 llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.19 --- llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.18 Sat Aug 26 16:33:05 2006 +++ llvm/lib/Target/IA64/IA64TargetMachine.cpp Sun Sep 3 13:44:02 2006 @@ -71,7 +71,7 @@ /// IA64TargetMachine ctor - Create an LP64 architecture model /// IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS) - : TargetMachine("IA64"), DataLayout("e"), + : DataLayout("e"), FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), TLInfo(*this) { // FIXME? check this stuff } From lattner at cs.uiuc.edu Sun Sep 3 13:44:40 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 13:44:40 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h Message-ID: <200609031844.k83IieUS003809@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.67 -> 1.68 --- Log message: Eliminate target name. --- Diffs of the changes: (+3 -14) TargetMachine.h | 17 +++-------------- 1 files changed, 3 insertions(+), 14 deletions(-) Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.67 llvm/include/llvm/Target/TargetMachine.h:1.68 --- llvm/include/llvm/Target/TargetMachine.h:1.67 Wed Jul 26 16:12:04 2006 +++ llvm/include/llvm/Target/TargetMachine.h Sun Sep 3 13:44:26 2006 @@ -62,18 +62,10 @@ /// through this interface. /// class TargetMachine { - const std::string Name; - TargetMachine(const TargetMachine&); // DO NOT IMPLEMENT void operator=(const TargetMachine&); // DO NOT IMPLEMENT -protected: // Can only create subclasses... - TargetMachine(const std::string &name) : Name(name) { }; - - /// This constructor is used for targets that support arbitrary TargetData - /// layouts, like the C backend. It initializes the TargetData to match that - /// of the specified module. - /// - TargetMachine(const std::string &name, const Module &M); +protected: // Can only create subclasses. + TargetMachine() { } /// getSubtargetImpl - virtual method implemented by subclasses that returns /// a reference to that target's TargetSubtarget-derived member variable. @@ -94,9 +86,6 @@ /// will not be used unless an explicit -march option is used. static unsigned getJITMatchQuality() { return 0; } - - const std::string &getName() const { return Name; } - // Interfaces to the major aspects of target machine information: // -- Instruction opcode and operand information // -- Pipelines and scheduling information @@ -122,7 +111,7 @@ /// not, return null. This is kept separate from RegInfo until RegInfo has /// details of graph coloring register allocation removed from it. /// - virtual const MRegisterInfo* getRegisterInfo() const { return 0; } + virtual const MRegisterInfo *getRegisterInfo() const { return 0; } /// getJITInfo - If this target supports a JIT, return information for it, /// otherwise return null. From isanbard at gmail.com Sun Sep 3 15:38:28 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 3 Sep 2006 15:38:28 -0500 Subject: [llvm-commits] CVS: llvm-test/configure Message-ID: <200609032038.k83KcSdM005441@zion.cs.uiuc.edu> Changes in directory llvm-test: configure updated: 1.38 -> 1.39 --- Log message: Regenerated after adding SPEC2006 support. --- Diffs of the changes: (+112 -29) configure | 141 +++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 112 insertions(+), 29 deletions(-) Index: llvm-test/configure diff -u llvm-test/configure:1.38 llvm-test/configure:1.39 --- llvm-test/configure:1.38 Wed Aug 16 17:09:23 2006 +++ llvm-test/configure Sun Sep 3 15:38:14 2006 @@ -798,6 +798,8 @@ USE_SPEC95 SPEC2000_ROOT USE_SPEC2000 +SPEC2006_ROOT +USE_SPEC2006 POVRAY_ROOT USE_POVRAY NAMD_ROOT @@ -1474,6 +1476,7 @@ --with-externals=DIR Location of External Test code --with-spec95=DIR Use spec95 as a benchmark (srcs in DIR) --with-spec2000=DIR Use spec2000 as a benchmark (srcs in DIR) + --with-spec2006=DIR Use spec2006 as a benchmark (srcs in DIR) --with-povray=DIR Use povray as a benchmark (srcs in DIR) --with-namd=DIR Use namd as a benchmark (srcs in DIR) --with-sweep3d=DIR Use sweep3d as a benchmark (srcs in DIR) @@ -2054,12 +2057,21 @@ ac_config_commands="$ac_config_commands External/SPEC/Makefile.spec" +ac_config_commands="$ac_config_commands External/SPEC/Makefile.spec2006" + + ac_config_commands="$ac_config_commands External/SPEC/Makefile.spec2000" ac_config_commands="$ac_config_commands External/SPEC/Makefile.spec95" +ac_config_commands="$ac_config_commands External/SPEC/CFP2006/Makefile" + + +ac_config_commands="$ac_config_commands External/SPEC/CINT2006/Makefile" + + ac_config_commands="$ac_config_commands External/SPEC/CFP2000/Makefile" @@ -2215,6 +2227,53 @@ +# Check whether --with-spec2006 was given. +if test "${with_spec2006+set}" = set; then + withval=$with_spec2006; checkresult=$withval +else + checkresult=auto +fi + +{ echo "$as_me:$LINENO: checking for spec2006 benchmark sources" >&5 +echo $ECHO_N "checking for spec2006 benchmark sources... $ECHO_C" >&6; } +case "$checkresult" in +auto|yes) + defaultdir=${LLVM_EXTERNALS}/speccpu2006/benchspec + if test -d "$defaultdir"; then + SPEC2006_ROOT=$defaultdir + + USE_SPEC2006=USE_SPEC2006=1 + + checkresult="yes, found in $defaultdir" + else + checkresult=no + fi + ;; +no) + + + checkresult=no + ;; +*) + if test -d "$checkresult" ; then + SPEC2006_ROOT="$checkresult" + + USE_SPEC2006=USE_SPEC2006=1 + + checkresult="yes, in $checkresult" + else + + + checkresult="no, not found in $checkresult" + fi + ;; +esac +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } + + + + # Check whether --with-povray was given. if test "${with_povray+set}" = set; then withval=$with_povray; checkresult=$withval @@ -2496,6 +2555,19 @@ +if test -n "$SPEC2006_ROOT" ; then + if test -d "$SPEC2006_ROOT" ; then + if test `basename "$SPEC2006_ROOT"` != "benchspec"; then + { { echo "$as_me:$LINENO: error: SPEC 2006 directory must end in 'benchspec'" >&5 +echo "$as_me: error: SPEC 2006 directory must end in 'benchspec'" >&2;} + { (exit 1); exit 1; }; } + fi + else + { { echo "$as_me:$LINENO: error: SPEC 2006 option must specify a directory" >&5 +echo "$as_me: error: SPEC 2006 option must specify a directory" >&2;} + { (exit 1); exit 1; }; } + fi +fi if test -n "$SPEC2000_ROOT" ; then if test -d "$SPEC2000_ROOT" ; then if test `basename "$SPEC2000_ROOT"` != "benchspec"; then @@ -4460,9 +4532,9 @@ { echo "$as_me:$LINENO: result: $llvm_cv_has_bison" >&5 echo "${ECHO_T}$llvm_cv_has_bison" >&6; } if test "$YACC" != "bison -y"; then - { { echo "$as_me:$LINENO: error: bison not found but required" >&5 -echo "$as_me: error: bison not found but required" >&2;} - { (exit 1); exit 1; }; } + + { echo "$as_me:$LINENO: WARNING: bison not found, can't rebuild grammars" >&5 +echo "$as_me: WARNING: bison not found, can't rebuild grammars" >&2;} else BISON=bison @@ -5262,7 +5334,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5265 "configure"' > conftest.$ac_ext + echo '#line 5337 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7427,11 +7499,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7430: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7502: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7434: \$? = $ac_status" >&5 + echo "$as_me:7506: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7695,11 +7767,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7698: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7770: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7702: \$? = $ac_status" >&5 + echo "$as_me:7774: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7799,11 +7871,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7802: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7874: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7806: \$? = $ac_status" >&5 + echo "$as_me:7878: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10251,7 +10323,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12794: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12726: \$? = $ac_status" >&5 + echo "$as_me:12798: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12823,11 +12895,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12826: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12898: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12830: \$? = $ac_status" >&5 + echo "$as_me:12902: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14393,11 +14465,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14396: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14468: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14400: \$? = $ac_status" >&5 + echo "$as_me:14472: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14497,11 +14569,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14500: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14572: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14504: \$? = $ac_status" >&5 + echo "$as_me:14576: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16732,11 +16804,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16735: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16807: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16739: \$? = $ac_status" >&5 + echo "$as_me:16811: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17000,11 +17072,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17003: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17075: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17007: \$? = $ac_status" >&5 + echo "$as_me:17079: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17104,11 +17176,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17107: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17179: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17111: \$? = $ac_status" >&5 + echo "$as_me:17183: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21413,8 +21485,11 @@ "External/Povray/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS External/Povray/Makefile" ;; "External/SPEC/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/Makefile" ;; "External/SPEC/Makefile.spec") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/Makefile.spec" ;; + "External/SPEC/Makefile.spec2006") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/Makefile.spec2006" ;; "External/SPEC/Makefile.spec2000") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/Makefile.spec2000" ;; "External/SPEC/Makefile.spec95") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/Makefile.spec95" ;; + "External/SPEC/CFP2006/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/CFP2006/Makefile" ;; + "External/SPEC/CINT2006/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/CINT2006/Makefile" ;; "External/SPEC/CFP2000/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/CFP2000/Makefile" ;; "External/SPEC/CINT2000/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/CINT2000/Makefile" ;; "External/SPEC/CFP95/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS External/SPEC/CFP95/Makefile" ;; @@ -21528,6 +21603,8 @@ USE_SPEC95!$USE_SPEC95$ac_delim SPEC2000_ROOT!$SPEC2000_ROOT$ac_delim USE_SPEC2000!$USE_SPEC2000$ac_delim +SPEC2006_ROOT!$SPEC2006_ROOT$ac_delim +USE_SPEC2006!$USE_SPEC2006$ac_delim POVRAY_ROOT!$POVRAY_ROOT$ac_delim USE_POVRAY!$USE_POVRAY$ac_delim NAMD_ROOT!$NAMD_ROOT$ac_delim @@ -21579,8 +21656,6 @@ F77!$F77$ac_delim FFLAGS!$FFLAGS$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim -LIBTOOL!$LIBTOOL$ac_delim -USE_F2C!$USE_F2C$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -21622,6 +21697,8 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +LIBTOOL!$LIBTOOL$ac_delim +USE_F2C!$USE_F2C$ac_delim F2C!$F2C$ac_delim F2C_BIN!$F2C_BIN$ac_delim F2C_DIR!$F2C_DIR$ac_delim @@ -21638,7 +21715,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 14; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 16; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -21985,10 +22062,16 @@ ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile External/SPEC/Makefile ;; "External/SPEC/Makefile.spec":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec` ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec External/SPEC/Makefile.spec ;; + "External/SPEC/Makefile.spec2006":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec2006` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec2006 External/SPEC/Makefile.spec2006 ;; "External/SPEC/Makefile.spec2000":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec2000` ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec2000 External/SPEC/Makefile.spec2000 ;; "External/SPEC/Makefile.spec95":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/Makefile.spec95` ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/Makefile.spec95 External/SPEC/Makefile.spec95 ;; + "External/SPEC/CFP2006/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CFP2006/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CFP2006/Makefile External/SPEC/CFP2006/Makefile ;; + "External/SPEC/CINT2006/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CINT2006/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CINT2006/Makefile External/SPEC/CINT2006/Makefile ;; "External/SPEC/CFP2000/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CFP2000/Makefile` ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/External/SPEC/CFP2000/Makefile External/SPEC/CFP2000/Makefile ;; "External/SPEC/CINT2000/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname External/SPEC/CINT2000/Makefile` From lattner at cs.uiuc.edu Sun Sep 3 18:10:31 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 18:10:31 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.config.in Message-ID: <200609032310.k83NAVHH007850@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.config.in updated: 1.22 -> 1.23 --- Log message: Reenable this now that the matching configure change has been made --- Diffs of the changes: (+1 -1) Makefile.config.in | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.22 llvm-test/Makefile.config.in:1.23 --- llvm-test/Makefile.config.in:1.22 Sat Sep 2 02:29:33 2006 +++ llvm-test/Makefile.config.in Sun Sep 3 18:10:17 2006 @@ -35,7 +35,7 @@ # SPEC benchmarks: # If these are set then run the SPEC benchmarks. # You must provide the SPEC benchmarks on your own. -#@USE_SPEC2006@ + at USE_SPEC2006@ @USE_SPEC2000@ @USE_SPEC95@ From lattner at cs.uiuc.edu Sun Sep 3 20:02:39 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 20:02:39 -0500 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200609040102.k8412dpH009594@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.399 -> 1.400 --- Log message: Rearrange library linkage order. --- Diffs of the changes: (+4 -3) Makefile.rules | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.399 llvm/Makefile.rules:1.400 --- llvm/Makefile.rules:1.399 Sun Aug 27 20:02:49 2006 +++ llvm/Makefile.rules Sun Sep 3 20:02:25 2006 @@ -641,8 +641,7 @@ Link += -dlopen self # Generic JIT libraries -JIT_LIBS := LLVMInterpreter LLVMJIT LLVMSelectionDAG.a LLVMCodeGen.a \ - LLVMExecutionEngine +JIT_LIBS := LLVMInterpreter LLVMJIT # You can enable the X86 JIT on a non-X86 host by setting the flag # ENABLE_X86_JIT on the make command line. If not, it will still be @@ -680,8 +679,10 @@ JIT_LIBS += LLVMAlpha endif +JIT_LIBS += LLVMTarget.a LLVMSelectionDAG.a LLVMCodeGen.a LLVMExecutionEngine + LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts.a LLVMTransformUtils.a LLVMAnalysis.a \ - LLVMBCReader.a LLVMTarget.a LLVMCore.a LLVMSupport.a LLVMbzip2.a \ + LLVMBCReader.a LLVMCore.a LLVMSupport.a LLVMbzip2.a \ LLVMSystem.a $(PLATFORMLIBDL) endif From lattner at cs.uiuc.edu Sun Sep 3 20:48:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 20:48:46 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-config/find-cycles.pl Message-ID: <200609040148.k841mkj3010370@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-config: find-cycles.pl updated: 1.6 -> 1.7 --- Log message: remove message --- Diffs of the changes: (+0 -1) find-cycles.pl | 1 - 1 files changed, 1 deletion(-) Index: llvm/tools/llvm-config/find-cycles.pl diff -u llvm/tools/llvm-config/find-cycles.pl:1.6 llvm/tools/llvm-config/find-cycles.pl:1.7 --- llvm/tools/llvm-config/find-cycles.pl:1.6 Fri Aug 4 16:52:23 2006 +++ llvm/tools/llvm-config/find-cycles.pl Sun Sep 3 20:48:32 2006 @@ -61,7 +61,6 @@ $cycles_found = $cycles_found + 1; print STDERR "find-cycles.pl: Circular dependency between *.a files:\n"; print STDERR "find-cycles.pl: ", join(' ', @archives), "\n"; - print STDERR "find-cycles.pl: Some linkers may have problems.\n"; push @modules, @archives; # WORKAROUND: Duplicate *.a files. Ick. } From lattner at cs.uiuc.edu Sun Sep 3 20:49:24 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 20:49:24 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-config/Makefile Message-ID: <200609040149.k841nO0G010424@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-config: Makefile updated: 1.16 -> 1.17 --- Log message: If a cycle exists, don't succeed building the second time around. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llvm-config/Makefile diff -u llvm/tools/llvm-config/Makefile:1.16 llvm/tools/llvm-config/Makefile:1.17 --- llvm/tools/llvm-config/Makefile:1.16 Fri Aug 4 17:55:53 2006 +++ llvm/tools/llvm-config/Makefile Sun Sep 3 20:49:10 2006 @@ -39,7 +39,7 @@ # don't have to process them at runtime. $(FinalLibDeps): find-cycles.pl $(LibDeps) $(Echo) "Finding cyclic dependencies between LLVM libraries." - $(Verb) $(PERL) $< < $(LibDeps) > $@ + $(Verb) $(PERL) $< < $(LibDeps) > $@ || rm -f $@ # Rerun our configure substitutions as needed. ConfigInIn = $(PROJ_SRC_DIR)/llvm-config.in.in From lattner at cs.uiuc.edu Sun Sep 3 23:04:56 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:04:56 -0500 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200609040404.k8444uPk012464@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.88 -> 1.89 --- Log message: rearrange targets to satisfy dependencies. Too bad we aren't using llvm-config. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.88 llvm/tools/llc/Makefile:1.89 --- llvm/tools/llc/Makefile:1.88 Thu Aug 3 11:59:17 2006 +++ llvm/tools/llc/Makefile Sun Sep 3 23:04:41 2006 @@ -17,9 +17,9 @@ include $(LEVEL)/Makefile.config USEDLIBS := $(addprefix LLVM,$(TARGETS_TO_BUILD)) \ + LLVMTarget.a \ LLVMCodeGen.a \ LLVMSelectionDAG.a \ - LLVMTarget.a \ LLVMipa.a \ LLVMTransforms.a \ LLVMScalarOpts.a \ From lattner at cs.uiuc.edu Sun Sep 3 23:06:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:06:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp Message-ID: <200609040406.k8446FBd012540@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetMachine.cpp updated: 1.52 -> 1.53 --- Log message: remove #include --- Diffs of the changes: (+1 -1) TargetMachine.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.52 llvm/lib/Target/TargetMachine.cpp:1.53 --- llvm/lib/Target/TargetMachine.cpp:1.52 Sun Sep 3 13:44:02 2006 +++ llvm/lib/Target/TargetMachine.cpp Sun Sep 3 23:06:01 2006 @@ -13,7 +13,6 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/Type.h" #include "llvm/Support/CommandLine.h" using namespace llvm; @@ -127,3 +126,4 @@ /// and results are never NaNs or +-Infs. bool FiniteOnlyFPMath() { return UnsafeFPMath || FiniteOnlyFPMathOption; } } + From lattner at cs.uiuc.edu Sun Sep 3 23:07:54 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:07:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp Message-ID: <200609040407.k8447s4K012617@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.71 -> 1.72 --- Log message: Add explicit doInitialization/doFinalization methods instead of making the FunctionPassManager redo this for each function. --- Diffs of the changes: (+14 -1) Pass.cpp | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.71 llvm/lib/VMCore/Pass.cpp:1.72 --- llvm/lib/VMCore/Pass.cpp:1.71 Sun Aug 27 17:21:55 2006 +++ llvm/lib/VMCore/Pass.cpp Sun Sep 3 23:07:39 2006 @@ -94,13 +94,26 @@ FunctionPassManager::~FunctionPassManager() { delete PM; } void FunctionPassManager::add(FunctionPass *P) { PM->add(P); } void FunctionPassManager::add(ImmutablePass *IP) { PM->add(IP); } + +/// doInitialization - Run all of the initializers for the function passes. +/// +bool FunctionPassManager::doInitialization() { + return PM->doInitialization(*MP->getModule()); +} + bool FunctionPassManager::run(Function &F) { std::string errstr; if (MP->materializeFunction(&F, &errstr)) { std::cerr << "Error reading bytecode file: " << errstr << "\n"; abort(); } - return PM->run(F); + return PM->runOnFunction(F); +} + +/// doFinalization - Run all of the initializers for the function passes. +/// +bool FunctionPassManager::doFinalization() { + return PM->doFinalization(*MP->getModule()); } From lattner at cs.uiuc.edu Sun Sep 3 23:07:55 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:07:55 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200609040407.k8447tOA012625@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.14 -> 1.15 --- Log message: Add explicit doInitialization/doFinalization methods instead of making the FunctionPassManager redo this for each function. --- Diffs of the changes: (+8 -0) PassManager.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.14 llvm/include/llvm/PassManager.h:1.15 --- llvm/include/llvm/PassManager.h:1.14 Wed Jan 4 01:47:12 2006 +++ llvm/include/llvm/PassManager.h Sun Sep 3 23:07:39 2006 @@ -70,11 +70,19 @@ /// void add(ImmutablePass *IP); + /// doInitialization - Run all of the initializers for the function passes. + /// + bool doInitialization(); + /// run - Execute all of the passes scheduled for execution. Keep /// track of whether any of the passes modifies the function, and if /// so, return true. /// bool run(Function &F); + + /// doFinalization - Run all of the initializers for the function passes. + /// + bool doFinalization(); }; } // End llvm namespace From lattner at cs.uiuc.edu Sun Sep 3 23:09:12 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:09:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.h Message-ID: <200609040409.k8449CMK012724@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.h updated: 1.12 -> 1.13 --- Log message: Add accessor --- Diffs of the changes: (+1 -0) X86Subtarget.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.12 llvm/lib/Target/X86/X86Subtarget.h:1.13 --- llvm/lib/Target/X86/X86Subtarget.h:1.12 Fri Feb 17 18:15:05 2006 +++ llvm/lib/Target/X86/X86Subtarget.h Sun Sep 3 23:08:58 2006 @@ -82,6 +82,7 @@ bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; } bool isTargetDarwin() const { return TargetType == isDarwin; } + bool isTargetELF() const { return TargetType == isELF; } }; } // End llvm namespace From lattner at cs.uiuc.edu Sun Sep 3 23:15:22 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:22 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200609040415.k844FML0012892@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.79 -> 1.80 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+5 -5) JIT.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.79 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.80 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.79 Sun Sep 3 13:37:12 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Sun Sep 3 23:14:57 2006 @@ -58,18 +58,18 @@ // Add target data MutexGuard locked(lock); - FunctionPassManager& PM = state.getPM(locked); + FunctionPassManager &PM = state.getPM(locked); PM.add(new TargetData(*TM.getTargetData())); - // Compile LLVM Code down to machine code in the intermediate representation - TJI.addPassesToJITCompile(PM); - // Turn the machine code intermediate representation into bytes in memory that // may be executed. - if (TM.addPassesToEmitMachineCode(PM, *MCE)) { + if (TM.addPassesToEmitMachineCode(PM, *MCE, false /*fast*/)) { std::cerr << "Target does not support machine code emission!\n"; abort(); } + + // Initialize passes. + PM.doInitialization(); } JIT::~JIT() { From lattner at cs.uiuc.edu Sun Sep 3 23:15:22 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:22 -0500 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200609040415.k844FM30012890@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.139 -> 1.140 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+110 -79) llc.cpp | 189 +++++++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 110 insertions(+), 79 deletions(-) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.139 llvm/tools/llc/llc.cpp:1.140 --- llvm/tools/llc/llc.cpp:1.139 Sun Sep 3 13:38:30 2006 +++ llvm/tools/llc/llc.cpp Sun Sep 3 23:14:57 2006 @@ -101,6 +101,69 @@ return outputFilename; } +static std::ostream *GetOutputStream(const char *ProgName) { + if (OutputFilename != "") { + if (OutputFilename == "-") + return &std::cout; + + // Specified an output filename? + if (!Force && std::ifstream(OutputFilename.c_str())) { + // If force is not specified, make sure not to overwrite a file! + std::cerr << ProgName << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; + return 0; + } + // Make sure that the Out file gets unlinked from the disk if we get a + // SIGINT + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + + return new std::ofstream(OutputFilename.c_str()); + } + + if (InputFilename == "-") { + OutputFilename = "-"; + return &std::cout; + } + + OutputFilename = GetFileNameRoot(InputFilename); + + switch (FileType) { + case TargetMachine::AssemblyFile: + if (MArch->Name[0] != 'c' || MArch->Name[1] != 0) // not CBE + OutputFilename += ".s"; + else + OutputFilename += ".cbe.c"; + break; + case TargetMachine::ObjectFile: + OutputFilename += ".o"; + break; + case TargetMachine::DynamicLibrary: + OutputFilename += LTDL_SHLIB_EXT; + break; + } + + if (!Force && std::ifstream(OutputFilename.c_str())) { + // If force is not specified, make sure not to overwrite a file! + std::cerr << ProgName << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; + return 0; + } + + // Make sure that the Out file gets unlinked from the disk if we get a + // SIGINT + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + + std::ostream *Out = new std::ofstream(OutputFilename.c_str()); + if (!Out->good()) { + std::cerr << ProgName << ": error opening " << OutputFilename << "!\n"; + delete Out; + return 0; + } + + return Out; +} // main - Entry point for the llc compiler. // @@ -148,91 +211,59 @@ assert(target.get() && "Could not allocate target machine!"); TargetMachine &Target = *target.get(); - // Build up all of the passes that we want to do to the module... - PassManager Passes; - Passes.add(new TargetData(*Target.getTargetData())); - -#ifndef NDEBUG - if(!NoVerify) - Passes.add(createVerifierPass()); -#endif - // Figure out where we are going to send the output... - std::ostream *Out = 0; - if (OutputFilename != "") { - if (OutputFilename != "-") { - // Specified an output filename? - 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()); - - // Make sure that the Out file gets unlinked from the disk if we get a - // SIGINT - sys::RemoveFileOnSignal(sys::Path(OutputFilename)); - } else { - Out = &std::cout; + std::ostream *Out = GetOutputStream(argv[0]); + if (Out == 0) return 1; + + // If this target requires addPassesToEmitWholeFile, do it now. This is + // used by strange things like the C backend. + if (Target.WantsWholeFile()) { + PassManager PM; + PM.add(new TargetData(*Target.getTargetData())); + if (!NoVerify) + PM.add(createVerifierPass()); + + // Ask the target to add backend passes as necessary. + if (Target.addPassesToEmitWholeFile(PM, *Out, FileType, Fast)) { + std::cerr << argv[0] << ": target does not support generation of this" + << " file type!\n"; + if (Out != &std::cout) delete Out; + // And the Out file is empty and useless, so remove it now. + sys::Path(OutputFilename).eraseFromDisk(); + return 1; } + PM.run(mod); } else { - if (InputFilename == "-") { - OutputFilename = "-"; - Out = &std::cout; - } else { - OutputFilename = GetFileNameRoot(InputFilename); - - switch (FileType) { - case TargetMachine::AssemblyFile: - if (MArch->Name[0] != 'c' || MArch->Name[1] != 0) // not CBE - OutputFilename += ".s"; - else - OutputFilename += ".cbe.c"; - break; - case TargetMachine::ObjectFile: - OutputFilename += ".o"; - break; - case TargetMachine::DynamicLibrary: - OutputFilename += LTDL_SHLIB_EXT; - break; - } - - 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()); - if (!Out->good()) { - std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; - delete Out; - return 1; - } - - // Make sure that the Out file gets unlinked from the disk if we get a - // SIGINT - sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + // Build up all of the passes that we want to do to the module. + FunctionPassManager Passes(new ExistingModuleProvider(M.get())); + Passes.add(new TargetData(*Target.getTargetData())); + +#ifndef NDEBUG + if (!NoVerify) + Passes.add(createVerifierPass()); +#endif + + // Ask the target to add backend passes as necessary. + if (Target.addPassesToEmitFile(Passes, *Out, FileType, Fast)) { + std::cerr << argv[0] << ": target does not support generation of this" + << " file type!\n"; + if (Out != &std::cout) delete Out; + // And the Out file is empty and useless, so remove it now. + sys::Path(OutputFilename).eraseFromDisk(); + return 1; } - } - - // Ask the target to add backend passes as necessary. - if (Target.addPassesToEmitFile(Passes, *Out, FileType, Fast)) { - std::cerr << argv[0] << ": target does not support generation of this" - << " file type!\n"; - if (Out != &std::cout) delete Out; - // And the Out file is empty and useless, so remove it now. - sys::Path(OutputFilename).eraseFromDisk(); - return 1; - } else { + + Passes.doInitialization(); + // Run our queue of passes all at once now, efficiently. - Passes.run(*M.get()); + // TODO: this could lazily stream functions out of the module. + for (Module::iterator I = mod.begin(), E = mod.end(); I != E; ++I) + if (!I->isExternal()) + Passes.run(*I); + + Passes.doFinalization(); } - + // Delete the ostream if it's not a stdout stream if (Out != &std::cout) delete Out; From lattner at cs.uiuc.edu Sun Sep 3 23:15:25 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/CTargetMachine.h Writer.cpp Message-ID: <200609040415.k844FPX0012916@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: CTargetMachine.h updated: 1.15 -> 1.16 Writer.cpp updated: 1.267 -> 1.268 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+8 -6) CTargetMachine.h | 8 ++++---- Writer.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/lib/Target/CBackend/CTargetMachine.h diff -u llvm/lib/Target/CBackend/CTargetMachine.h:1.15 llvm/lib/Target/CBackend/CTargetMachine.h:1.16 --- llvm/lib/Target/CBackend/CTargetMachine.h:1.15 Sun Sep 3 13:44:02 2006 +++ llvm/lib/Target/CBackend/CTargetMachine.h Sun Sep 3 23:14:57 2006 @@ -25,14 +25,14 @@ CTargetMachine(const Module &M, const std::string &FS) : DataLayout(&M) {} - // This is the only thing that actually does anything here. - virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, bool Fast); + virtual bool WantsWholeFile() const { return true; } + virtual bool addPassesToEmitWholeFile(PassManager &PM, std::ostream &Out, + CodeGenFileType FileType, bool Fast); // This class always works, but shouldn't be the default in most cases. static unsigned getModuleMatchQuality(const Module &M) { return 1; } - virtual const TargetData *getTargetData() const { return &DataLayout; } + virtual const TargetData *getTargetData() const { return &DataLayout; } }; } // End llvm namespace Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.267 llvm/lib/Target/CBackend/Writer.cpp:1.268 --- llvm/lib/Target/CBackend/Writer.cpp:1.267 Fri Jul 28 15:58:47 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Sun Sep 3 23:14:57 2006 @@ -2027,8 +2027,10 @@ // External Interface declaration //===----------------------------------------------------------------------===// -bool CTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &o, - CodeGenFileType FileType, bool Fast) { +bool CTargetMachine::addPassesToEmitWholeFile(PassManager &PM, + std::ostream &o, + CodeGenFileType FileType, + bool Fast) { if (FileType != TargetMachine::AssemblyFile) return true; PM.add(createLowerGCPass()); From lattner at cs.uiuc.edu Sun Sep 3 23:15:25 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:25 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetJITInfo.h TargetMachine.h Message-ID: <200609040415.k844FP0t012902@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetJITInfo.h updated: 1.10 -> 1.11 TargetMachine.h updated: 1.68 -> 1.69 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+96 -11) TargetJITInfo.h | 5 -- TargetMachine.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 96 insertions(+), 11 deletions(-) Index: llvm/include/llvm/Target/TargetJITInfo.h diff -u llvm/include/llvm/Target/TargetJITInfo.h:1.10 llvm/include/llvm/Target/TargetJITInfo.h:1.11 --- llvm/include/llvm/Target/TargetJITInfo.h:1.10 Thu Jul 27 13:19:24 2006 +++ llvm/include/llvm/Target/TargetJITInfo.h Sun Sep 3 23:14:57 2006 @@ -33,11 +33,6 @@ public: virtual ~TargetJITInfo() {} - /// addPassesToJITCompile - Add passes to the specified pass manager to - /// implement a fast code generator for this target. - /// - virtual void addPassesToJITCompile(FunctionPassManager &PM) = 0; - /// replaceMachineCodeForFunction - Make it so that calling the function /// whose machine code is at OLD turns into a call to NEW, perhaps by /// overwriting OLD with a branch to NEW. This is used for self-modifying Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.68 llvm/include/llvm/Target/TargetMachine.h:1.69 --- llvm/include/llvm/Target/TargetMachine.h:1.68 Sun Sep 3 13:44:26 2006 +++ llvm/include/llvm/Target/TargetMachine.h Sun Sep 3 23:14:57 2006 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file describes the general parts of a Target machine. +// This file defines the TargetMachine and LLVMTargetMachine classes. // //===----------------------------------------------------------------------===// @@ -62,8 +62,8 @@ /// through this interface. /// class TargetMachine { - TargetMachine(const TargetMachine&); // DO NOT IMPLEMENT - void operator=(const TargetMachine&); // DO NOT IMPLEMENT + TargetMachine(const TargetMachine &); // DO NOT IMPLEMENT + void operator=(const TargetMachine &); // DO NOT IMPLEMENT protected: // Can only create subclasses. TargetMachine() { } @@ -151,19 +151,109 @@ /// code as fast as possible, without regard for compile time. This method /// should return true if emission of this file type is not supported. /// - virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, + virtual bool addPassesToEmitFile(FunctionPassManager &PM, std::ostream &Out, CodeGenFileType FileType, bool Fast) { return true; } + + /// addPassesToEmitMachineCode - Add passes to the specified pass manager to + /// get machine code emitted. This uses a MachineCodeEmitter object to handle + /// actually outputting the machine code and resolving things like the address + /// of functions. This method returns true if machine code emission is + /// not supported. + /// + virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM, + MachineCodeEmitter &MCE, bool Fast) { + return true; + } + + /// addPassesToEmitWholeFile - This method can be implemented by targets that + /// require having the entire module at once. This is not recommended, do not + /// use this. + virtual bool WantsWholeFile() const { return false; } + virtual bool addPassesToEmitWholeFile(PassManager &PM, std::ostream &Out, + CodeGenFileType FileType, bool Fast) { + return true; + } +}; + +/// LLVMTargetMachine - This class describes a target machine that is +/// implemented with the LLVM target-independent code generator. +/// +class LLVMTargetMachine : public TargetMachine { +protected: // Can only create subclasses. + LLVMTargetMachine() { } +public: + + /// addPassesToEmitFile - Add passes to the specified pass manager to get + /// the specified file emitted. Typically this will involve several steps of + /// code generation. If Fast is set to true, the code generator should emit + /// code as fast as possible, without regard for compile time. This method + /// should return true if emission of this file type is not supported. + /// + /// The default implementation of this method adds components from the + /// LLVM retargetable code generator, invoking the methods below to get + /// target-specific passes in standard locations. + /// + virtual bool addPassesToEmitFile(FunctionPassManager &PM, std::ostream &Out, + CodeGenFileType FileType, bool Fast); + /// addPassesToEmitMachineCode - Add passes to the specified pass manager to /// get machine code emitted. This uses a MachineCodeEmitter object to handle /// actually outputting the machine code and resolving things like the address - /// of functions. This method should returns true if machine code emission is + /// of functions. This method returns true if machine code emission is /// not supported. /// virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM, - MachineCodeEmitter &MCE) { + MachineCodeEmitter &MCE, bool Fast); + + /// Target-Independent Code Generator Pass Configuration Options. + + /// addInstSelector - This method should add any "last minute" LLVM->LLVM + /// passes, then install an instruction selector pass, which converts from + /// LLVM code to machine instructions. + virtual bool addInstSelector(FunctionPassManager &PM, bool Fast) { + return true; + } + + /// addPostRegAllocPasses - This method may be implemented by targets that + /// want to run passes after register allocation but before prolog-epilog + /// insertion. This should return true if -print-machineinstrs should print + /// after these passes. + virtual bool addPostRegAlloc(FunctionPassManager &PM, bool Fast) { + return false; + } + + /// addPreEmitPass - This pass may be implemented by targets that want to run + /// passes immediately before machine code is emitted. This should return + /// true if -print-machineinstrs should print out the code after the passes. + virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast) { + return false; + } + + + /// addAssemblyEmitter - This pass should be overridden by the target to add + /// the asmprinter, if asm emission is supported. If this is not supported, + /// 'true' should be returned. + virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { + return true; + } + + /// addObjectWriter - This pass should be overridden by the target to add + /// the object-file writer, if supported. If this is not supported, + /// 'true' should be returned. + virtual bool addObjectWriter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { + return true; + } + + /// addCodeEmitter - This pass should be overridden by the target to add a + /// code emitter, if supported. If this is not supported, 'true' should be + /// returned. + virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast, + MachineCodeEmitter &MCE) { return true; } }; From lattner at cs.uiuc.edu Sun Sep 3 23:15:26 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMTargetMachine.cpp ARMTargetMachine.h Message-ID: <200609040415.k844FQHC012923@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMTargetMachine.cpp updated: 1.7 -> 1.8 ARMTargetMachine.h updated: 1.2 -> 1.3 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+11 -54) ARMTargetMachine.cpp | 56 +++++---------------------------------------------- ARMTargetMachine.h | 9 ++++---- 2 files changed, 11 insertions(+), 54 deletions(-) Index: llvm/lib/Target/ARM/ARMTargetMachine.cpp diff -u llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.7 llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.8 --- llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.7 Sun Sep 3 13:44:02 2006 +++ llvm/lib/Target/ARM/ARMTargetMachine.cpp Sun Sep 3 23:14:57 2006 @@ -14,15 +14,9 @@ #include "ARMTargetMachine.h" #include "ARMFrameInfo.h" #include "ARM.h" -#include "llvm/Assembly/PrintModulePass.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/Passes.h" -#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetMachineRegistry.h" -#include "llvm/Transforms/Scalar.h" -#include using namespace llvm; namespace { @@ -47,54 +41,16 @@ return 0; } -/// addPassesToEmitFile - Add passes to the specified pass manager -/// to implement a static compiler for this target. -/// -bool ARMTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, - bool Fast) { - if (FileType != TargetMachine::AssemblyFile) - return true; - - // Run loop strength reduction before anything else. - if (!Fast) - PM.add(createLoopStrengthReducePass()); - - if (!Fast) - PM.add(createCFGSimplificationPass()); - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); - - // FIXME: implement the invoke/unwind instructions! - PM.add(createLowerInvokePass()); - - // Print LLVM code input to instruction selector: - if (PrintMachineCode) - PM.add(new PrintFunctionPass()); - - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); +// Pass Pipeline Configuration +bool ARMTargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) { PM.add(createARMISelDag(*this)); - - // Print machine instructions as they were initially generated. - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createRegisterAllocator()); - PM.add(createPrologEpilogCodeInserter()); - - // Print machine instructions after register allocation and prolog/epilog - // insertion. - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - + return false; +} +bool ARMTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { // Output assembly language. PM.add(createARMCodePrinterPass(Out, *this)); - - // Delete the MachineInstrs we generated, since they're no longer needed. - PM.add(createMachineCodeDeleter()); return false; } Index: llvm/lib/Target/ARM/ARMTargetMachine.h diff -u llvm/lib/Target/ARM/ARMTargetMachine.h:1.2 llvm/lib/Target/ARM/ARMTargetMachine.h:1.3 --- llvm/lib/Target/ARM/ARMTargetMachine.h:1.2 Wed Aug 16 09:43:33 2006 +++ llvm/lib/Target/ARM/ARMTargetMachine.h Sun Sep 3 23:14:57 2006 @@ -18,7 +18,6 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" -#include "llvm/PassManager.h" #include "ARMInstrInfo.h" #include "ARMFrameInfo.h" @@ -26,7 +25,7 @@ class Module; -class ARMTargetMachine : public TargetMachine { +class ARMTargetMachine : public LLVMTargetMachine { const TargetData DataLayout; // Calculates type size & alignment ARMInstrInfo InstrInfo; ARMFrameInfo FrameInfo; @@ -41,8 +40,10 @@ virtual const TargetData *getTargetData() const { return &DataLayout; } static unsigned getModuleMatchQuality(const Module &M); - virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, bool Fast); + // Pass Pipeline Configuration + virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); + virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out); }; } // end namespace llvm From lattner at cs.uiuc.edu Sun Sep 3 23:15:26 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaJITInfo.h AlphaTargetMachine.cpp AlphaTargetMachine.h Message-ID: <200609040415.k844FQrR012932@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaJITInfo.h updated: 1.3 -> 1.4 AlphaTargetMachine.cpp updated: 1.28 -> 1.29 AlphaTargetMachine.h updated: 1.14 -> 1.15 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+25 -94) AlphaJITInfo.h | 6 --- AlphaTargetMachine.cpp | 95 ++++++++----------------------------------------- AlphaTargetMachine.h | 18 ++++----- 3 files changed, 25 insertions(+), 94 deletions(-) Index: llvm/lib/Target/Alpha/AlphaJITInfo.h diff -u llvm/lib/Target/Alpha/AlphaJITInfo.h:1.3 llvm/lib/Target/Alpha/AlphaJITInfo.h:1.4 --- llvm/lib/Target/Alpha/AlphaJITInfo.h:1.3 Thu Jul 27 13:20:17 2006 +++ llvm/lib/Target/Alpha/AlphaJITInfo.h Sun Sep 3 23:14:57 2006 @@ -29,12 +29,6 @@ AlphaJITInfo(TargetMachine &tm) : TM(tm) { useGOT = true; } - /// addPassesToJITCompile - Add passes to the specified pass manager to - /// implement a fast dynamic compiler for this target. Return true if this - /// is not supported for this target. - /// - virtual void addPassesToJITCompile(FunctionPassManager &PM); - virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE); virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); virtual void relocate(void *Function, MachineRelocation *MR, Index: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.28 llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.29 --- llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.28 Sun Sep 3 13:44:02 2006 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Sun Sep 3 23:14:57 2006 @@ -14,12 +14,8 @@ #include "AlphaJITInfo.h" #include "AlphaTargetMachine.h" #include "llvm/Module.h" -#include "llvm/CodeGen/Passes.h" -#include "llvm/Target/TargetOptions.h" +#include "llvm/PassManager.h" #include "llvm/Target/TargetMachineRegistry.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Support/Debug.h" -#include using namespace llvm; @@ -57,89 +53,30 @@ : DataLayout("e"), FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), JITInfo(*this), - Subtarget(M, FS) -{ - DEBUG(std::cerr << "FS is " << FS << "\n"); -} - -/// addPassesToEmitFile - Add passes to the specified pass manager to implement -/// a static compiler for this target. -/// -bool AlphaTargetMachine::addPassesToEmitFile(PassManager &PM, - std::ostream &Out, - CodeGenFileType FileType, - bool Fast) { - if (FileType != TargetMachine::AssemblyFile) return true; - - PM.add(createLoopStrengthReducePass()); - PM.add(createCFGSimplificationPass()); - - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); + Subtarget(M, FS) { +} - // FIXME: Implement the invoke/unwind instructions! - PM.add(createLowerInvokePass()); - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); +//===----------------------------------------------------------------------===// +// Pass Pipeline Configuration +//===----------------------------------------------------------------------===// +bool AlphaTargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) { PM.add(createAlphaISelDag(*this)); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createRegisterAllocator()); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createPrologEpilogCodeInserter()); - - // Must run branch selection immediately preceding the asm printer - //PM.add(createAlphaBranchSelectionPass()); - - PM.add(createAlphaCodePrinterPass(Out, *this)); - - PM.add(createMachineCodeDeleter()); return false; } - -void AlphaJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { - - PM.add(createLoopStrengthReducePass()); - PM.add(createCFGSimplificationPass()); - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); - - // FIXME: Implement the invoke/unwind instructions! - PM.add(createLowerInvokePass()); - - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); - - PM.add(createAlphaISelDag(TM)); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createRegisterAllocator()); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createPrologEpilogCodeInserter()); - +bool AlphaTargetMachine::addPreEmitPass(FunctionPassManager &PM, bool Fast) { // Must run branch selection immediately preceding the asm printer //PM.add(createAlphaBranchSelectionPass()); - + return false; } - -bool AlphaTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM, - MachineCodeEmitter &MCE) { +bool AlphaTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { + PM.add(createAlphaCodePrinterPass(Out, *this)); + return false; +} +bool AlphaTargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast, + MachineCodeEmitter &MCE) { PM.add(createAlphaCodeEmitterPass(*this, MCE)); - // Delete machine code for this function - PM.add(createMachineCodeDeleter()); return false; } Index: llvm/lib/Target/Alpha/AlphaTargetMachine.h diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.14 llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.15 --- llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.14 Fri May 12 01:33:48 2006 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.h Sun Sep 3 23:14:57 2006 @@ -17,7 +17,6 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" -#include "llvm/PassManager.h" #include "AlphaInstrInfo.h" #include "AlphaJITInfo.h" #include "AlphaSubtarget.h" @@ -26,7 +25,7 @@ class GlobalValue; -class AlphaTargetMachine : public TargetMachine { +class AlphaTargetMachine : public LLVMTargetMachine { const TargetData DataLayout; // Calculates type size & alignment AlphaInstrInfo InstrInfo; TargetFrameInfo FrameInfo; @@ -48,14 +47,15 @@ } static unsigned getJITMatchQuality(); - - virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM, - MachineCodeEmitter &MCE); - - virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, bool Fast); - static unsigned getModuleMatchQuality(const Module &M); + + // Pass Pipeline Configuration + virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); + virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast); + virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out); + virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast, + MachineCodeEmitter &MCE); }; } // end namespace llvm From lattner at cs.uiuc.edu Sun Sep 3 23:15:25 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64TargetMachine.cpp IA64TargetMachine.h Message-ID: <200609040415.k844FP1D012907@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64TargetMachine.cpp updated: 1.19 -> 1.20 IA64TargetMachine.h updated: 1.12 -> 1.13 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+22 -77) IA64TargetMachine.cpp | 84 ++++++++------------------------------------------ IA64TargetMachine.h | 15 ++++---- 2 files changed, 22 insertions(+), 77 deletions(-) Index: llvm/lib/Target/IA64/IA64TargetMachine.cpp diff -u llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.19 llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.20 --- llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.19 Sun Sep 3 13:44:02 2006 +++ llvm/lib/Target/IA64/IA64TargetMachine.cpp Sun Sep 3 23:14:57 2006 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file defines the IA64 specific subclass of TargetMachine. +// This file implements the IA64 specific subclass of TargetMachine. // //===----------------------------------------------------------------------===// @@ -15,14 +15,7 @@ #include "IA64.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/Passes.h" -#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetMachineRegistry.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/ADT/Statistic.h" -#include using namespace llvm; /// IA64TargetMachineModule - Note that this is used on hosts that cannot link @@ -33,14 +26,6 @@ int IA64TargetMachineModule = 0; namespace { - cl::opt DisableOutput("disable-ia64-llc-output", cl::Hidden, - cl::desc("Disable the IA64 asm printer, for use " - "when profiling the code generator.")); - - cl::opt EnableDAGIsel("enable-ia64-dag-isel", cl::Hidden, - cl::desc("Enable the IA64 DAG->DAG isel")); - - // Register the target. RegisterTarget X("ia64", " IA-64 (Itanium)"); } @@ -76,65 +61,24 @@ TLInfo(*this) { // FIXME? check this stuff } -// addPassesToEmitFile - We currently use all of the same passes as the JIT -// does to emit statically compiled machine code. -bool IA64TargetMachine::addPassesToEmitFile(PassManager &PM, - std::ostream &Out, - CodeGenFileType FileType, - bool Fast) { - if (FileType != TargetMachine::AssemblyFile) return true; - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); - - // FIXME: Implement the invoke/unwind instructions! - PM.add(createLowerInvokePass(704, 16)); // on ia64 linux, jmpbufs are 704 - // bytes and must be 16byte aligned - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); +//===----------------------------------------------------------------------===// +// Pass Pipeline Configuration +//===----------------------------------------------------------------------===// - // Add an instruction selector -// FIXME: reap this option one day: if(EnableDAGIsel) +bool IA64TargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) { PM.add(createIA64DAGToDAGInstructionSelector(*this)); - -/* XXX not yet. ;) - // Run optional SSA-based machine code optimizations next... - if (!NoSSAPeephole) - PM.add(createIA64SSAPeepholeOptimizerPass()); -*/ - - // Print the instruction selected machine code... - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - // Perform register allocation to convert to a concrete IA64 representation - PM.add(createRegisterAllocator()); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - // Insert prolog/epilog code. Eliminate abstract frame index references... - PM.add(createPrologEpilogCodeInserter()); - -/* XXX no, not just yet */ -// PM.add(createIA64PeepholeOptimizerPass()); + return false; +} +bool IA64TargetMachine::addPreEmitPass(FunctionPassManager &PM, bool Fast) { // Make sure everything is bundled happily PM.add(createIA64BundlingPass(*this)); - - if (PrintMachineCode) // Print the register-allocated code - PM.add(createIA64CodePrinterPass(std::cerr, *this)); - - if (!DisableOutput) - PM.add(createIA64CodePrinterPass(Out, *this)); - - // Delete machine code for this function - PM.add(createMachineCodeDeleter()); - - return false; // success! + return true; +} +bool IA64TargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { + PM.add(createIA64CodePrinterPass(Out, *this)); + return false; } Index: llvm/lib/Target/IA64/IA64TargetMachine.h diff -u llvm/lib/Target/IA64/IA64TargetMachine.h:1.12 llvm/lib/Target/IA64/IA64TargetMachine.h:1.13 --- llvm/lib/Target/IA64/IA64TargetMachine.h:1.12 Sat Aug 26 16:33:05 2006 +++ llvm/lib/Target/IA64/IA64TargetMachine.h Sun Sep 3 23:14:57 2006 @@ -11,19 +11,18 @@ // //===----------------------------------------------------------------------===// -#ifndef IA64TARGETMACHINE_H -#define IA64TARGETMACHINE_H +#ifndef LLVM_TARGET_IA64TARGETMACHINE_H +#define LLVM_TARGET_IA64TARGETMACHINE_H #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" -#include "llvm/PassManager.h" #include "IA64InstrInfo.h" #include "IA64ISelLowering.h" namespace llvm { -class IA64TargetMachine : public TargetMachine { +class IA64TargetMachine : public LLVMTargetMachine { const TargetData DataLayout; // Calculates type size & alignment IA64InstrInfo InstrInfo; TargetFrameInfo FrameInfo; @@ -42,11 +41,13 @@ } virtual const TargetData *getTargetData() const { return &DataLayout; } - virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, bool Fast); - static unsigned getModuleMatchQuality(const Module &M); + // Pass Pipeline Configuration + virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); + virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast); + virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out); }; } // End llvm namespace From lattner at cs.uiuc.edu Sun Sep 3 23:15:26 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcTargetMachine.cpp SparcTargetMachine.h Message-ID: <200609040415.k844FQ3B012953@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcTargetMachine.cpp updated: 1.49 -> 1.50 SparcTargetMachine.h updated: 1.14 -> 1.15 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+18 -54) SparcTargetMachine.cpp | 61 ++++++++----------------------------------------- SparcTargetMachine.h | 11 +++++--- 2 files changed, 18 insertions(+), 54 deletions(-) Index: llvm/lib/Target/Sparc/SparcTargetMachine.cpp diff -u llvm/lib/Target/Sparc/SparcTargetMachine.cpp:1.49 llvm/lib/Target/Sparc/SparcTargetMachine.cpp:1.50 --- llvm/lib/Target/Sparc/SparcTargetMachine.cpp:1.49 Sun Sep 3 13:44:02 2006 +++ llvm/lib/Target/Sparc/SparcTargetMachine.cpp Sun Sep 3 23:14:57 2006 @@ -12,14 +12,9 @@ #include "SparcTargetMachine.h" #include "Sparc.h" -#include "llvm/Assembly/PrintModulePass.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/Passes.h" -#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetMachineRegistry.h" -#include "llvm/Transforms/Scalar.h" #include using namespace llvm; @@ -55,57 +50,23 @@ return 0; } -/// addPassesToEmitFile - Add passes to the specified pass manager -/// to implement a static compiler for this target. -/// -bool SparcTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, - bool Fast) { - if (FileType != TargetMachine::AssemblyFile) return true; - - // Run loop strength reduction before anything else. - if (!Fast) PM.add(createLoopStrengthReducePass()); - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); - - // FIXME: implement the invoke/unwind instructions! - PM.add(createLowerInvokePass()); - - // Print LLVM code input to instruction selector: - if (PrintMachineCode) - PM.add(new PrintFunctionPass()); - - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); - +bool SparcTargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) { PM.add(createSparcISelDag(*this)); + return false; +} - // Print machine instructions as they were initially generated. - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createRegisterAllocator()); - PM.add(createPrologEpilogCodeInserter()); - - // Print machine instructions after register allocation and prolog/epilog - // insertion. - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - +/// addPreEmitPass - This pass may be implemented by targets that want to run +/// passes immediately before machine code is emitted. This should return +/// true if -print-machineinstrs should print out the code after the passes. +bool SparcTargetMachine::addPreEmitPass(FunctionPassManager &PM, bool Fast) { PM.add(createSparcFPMoverPass(*this)); - PM.add(createSparcDelaySlotFillerPass(*this)); + return true; +} - // Print machine instructions after filling delay slots. - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - +bool SparcTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { // Output assembly language. PM.add(createSparcCodePrinterPass(Out, *this)); - - // Delete the MachineInstrs we generated, since they're no longer needed. - PM.add(createMachineCodeDeleter()); return false; } - Index: llvm/lib/Target/Sparc/SparcTargetMachine.h diff -u llvm/lib/Target/Sparc/SparcTargetMachine.h:1.14 llvm/lib/Target/Sparc/SparcTargetMachine.h:1.15 --- llvm/lib/Target/Sparc/SparcTargetMachine.h:1.14 Fri May 12 01:33:48 2006 +++ llvm/lib/Target/Sparc/SparcTargetMachine.h Sun Sep 3 23:14:57 2006 @@ -17,7 +17,6 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" -#include "llvm/PassManager.h" #include "SparcInstrInfo.h" #include "SparcSubtarget.h" @@ -25,7 +24,7 @@ class Module; -class SparcTargetMachine : public TargetMachine { +class SparcTargetMachine : public LLVMTargetMachine { const TargetData DataLayout; // Calculates type size & alignment SparcSubtarget Subtarget; SparcInstrInfo InstrInfo; @@ -42,8 +41,12 @@ virtual const TargetData *getTargetData() const { return &DataLayout; } static unsigned getModuleMatchQuality(const Module &M); - virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, bool Fast); + + // Pass Pipeline Configuration + virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); + virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast); + virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out); }; } // end namespace llvm From lattner at cs.uiuc.edu Sun Sep 3 23:15:26 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86.h X86ELFWriter.cpp X86JITInfo.h X86TargetMachine.cpp X86TargetMachine.h Message-ID: <200609040415.k844FQF3012945@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86.h updated: 1.47 -> 1.48 X86ELFWriter.cpp updated: 1.6 -> 1.7 X86JITInfo.h updated: 1.10 -> 1.11 X86TargetMachine.cpp updated: 1.123 -> 1.124 X86TargetMachine.h updated: 1.37 -> 1.38 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+38 -128) X86.h | 4 - X86ELFWriter.cpp | 2 X86JITInfo.h | 6 -- X86TargetMachine.cpp | 134 ++++++++------------------------------------------- X86TargetMachine.h | 20 ++++--- 5 files changed, 38 insertions(+), 128 deletions(-) Index: llvm/lib/Target/X86/X86.h diff -u llvm/lib/Target/X86/X86.h:1.47 llvm/lib/Target/X86/X86.h:1.48 --- llvm/lib/Target/X86/X86.h:1.47 Tue Aug 29 13:28:33 2006 +++ llvm/lib/Target/X86/X86.h Sun Sep 3 23:14:57 2006 @@ -20,7 +20,7 @@ namespace llvm { class X86TargetMachine; -class PassManager; +class FunctionPassManager; class FunctionPass; class IntrinsicLowering; class MachineCodeEmitter; @@ -50,7 +50,7 @@ /// addX86ELFObjectWriterPass - Add passes to the FPM that output the generated /// code as an ELF object file. /// -void addX86ELFObjectWriterPass(PassManager &FPM, +void addX86ELFObjectWriterPass(FunctionPassManager &FPM, std::ostream &o, X86TargetMachine &tm); /// createX86EmitCodeToMemory - Returns a pass that converts a register Index: llvm/lib/Target/X86/X86ELFWriter.cpp diff -u llvm/lib/Target/X86/X86ELFWriter.cpp:1.6 llvm/lib/Target/X86/X86ELFWriter.cpp:1.7 --- llvm/lib/Target/X86/X86ELFWriter.cpp:1.6 Sun Aug 27 07:54:01 2006 +++ llvm/lib/Target/X86/X86ELFWriter.cpp Sun Sep 3 23:14:57 2006 @@ -31,7 +31,7 @@ /// addX86ELFObjectWriterPass - Returns a pass that outputs the generated code /// as an ELF object file. /// -void llvm::addX86ELFObjectWriterPass(PassManager &FPM, +void llvm::addX86ELFObjectWriterPass(FunctionPassManager &FPM, std::ostream &O, X86TargetMachine &TM) { X86ELFWriter *EW = new X86ELFWriter(O, TM); FPM.add(EW); Index: llvm/lib/Target/X86/X86JITInfo.h diff -u llvm/lib/Target/X86/X86JITInfo.h:1.10 llvm/lib/Target/X86/X86JITInfo.h:1.11 --- llvm/lib/Target/X86/X86JITInfo.h:1.10 Thu Jul 27 13:21:10 2006 +++ llvm/lib/Target/X86/X86JITInfo.h Sun Sep 3 23:14:57 2006 @@ -25,12 +25,6 @@ public: X86JITInfo(X86TargetMachine &tm) : TM(tm) {useGOT = 0;} - /// addPassesToJITCompile - Add passes to the specified pass manager to - /// implement a fast dynamic compiler for this target. Return true if this - /// is not supported for this target. - /// - virtual void addPassesToJITCompile(FunctionPassManager &PM); - /// replaceMachineCodeForFunction - Make it so that calling the function /// whose machine code is at OLD turns into a call to NEW, perhaps by /// overwriting OLD with a branch to NEW. This is used for self-modifying Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.123 llvm/lib/Target/X86/X86TargetMachine.cpp:1.124 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.123 Sun Sep 3 13:44:02 2006 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Sun Sep 3 23:14:57 2006 @@ -20,8 +20,6 @@ #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Transforms/Scalar.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/ADT/Statistic.h" #include using namespace llvm; @@ -33,9 +31,6 @@ int X86TargetMachineModule = 0; namespace { - cl::opt DisableOutput("disable-x86-llc-output", cl::Hidden, - cl::desc("Disable the X86 asm printer, for use " - "when profiling the code generator.")); // Register the target. RegisterTarget X("x86", " IA-32 (Pentium and above)"); } @@ -79,121 +74,38 @@ setRelocationModel(Reloc::PIC_); } +//===----------------------------------------------------------------------===// +// Pass Pipeline Configuration +//===----------------------------------------------------------------------===// -// addPassesToEmitFile - We currently use all of the same passes as the JIT -// does to emit statically compiled machine code. -bool X86TargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, - bool Fast) { - if (FileType != TargetMachine::AssemblyFile && - FileType != TargetMachine::ObjectFile) return true; - - // Run loop strength reduction before anything else. - if (!Fast) PM.add(createLoopStrengthReducePass(&TLInfo)); - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); - - // FIXME: Implement the invoke/unwind instructions! - PM.add(createLowerInvokePass()); - - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); - +bool X86TargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) { // Install an instruction selector. PM.add(createX86ISelDag(*this, Fast)); + return false; +} - // Print the instruction selected machine code... - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - // Perform register allocation to convert to a concrete x86 representation - PM.add(createRegisterAllocator()); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createX86FloatingPointStackifierPass()); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - // Insert prolog/epilog code. Eliminate abstract frame index references... - PM.add(createPrologEpilogCodeInserter()); - - if (PrintMachineCode) // Print the register-allocated code - PM.add(createX86CodePrinterPass(std::cerr, *this)); - - if (!DisableOutput) - switch (FileType) { - default: - assert(0 && "Unexpected filetype here!"); - case TargetMachine::AssemblyFile: - PM.add(createX86CodePrinterPass(Out, *this)); - break; - case TargetMachine::ObjectFile: - // FIXME: We only support emission of ELF files for now, this should check - // the target triple and decide on the format to write (e.g. COFF on - // win32 or Mach-O on darwin). - addX86ELFObjectWriterPass(PM, Out, *this); - break; - } - - // Delete machine code for this function - PM.add(createMachineCodeDeleter()); - - return false; // success! -} - -/// addPassesToJITCompile - Add passes to the specified pass manager to -/// implement a fast dynamic compiler for this target. Return true if this is -/// not supported for this target. -/// -void X86JITInfo::addPassesToJITCompile(FunctionPassManager &PM) { - // The JIT should use static relocation model. - TM.setRelocationModel(Reloc::Static); - - // Run loop strength reduction before anything else. - PM.add(createLoopStrengthReducePass(TM.getTargetLowering())); - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); - - // FIXME: Implement the invoke/unwind instructions! - PM.add(createLowerInvokePass()); - - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); - - // Install an instruction selector. - PM.add(createX86ISelDag(TM, false)); - - // Print the instruction selected machine code... - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - // Perform register allocation to convert to a concrete x86 representation - PM.add(createRegisterAllocator()); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - +bool X86TargetMachine::addPostRegAlloc(FunctionPassManager &PM, bool Fast) { PM.add(createX86FloatingPointStackifierPass()); + return true; // -print-machineinstr should print after this. +} - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - // Insert prolog/epilog code. Eliminate abstract frame index references... - PM.add(createPrologEpilogCodeInserter()); +bool X86TargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { + PM.add(createX86CodePrinterPass(Out, *this)); + return false; +} - if (PrintMachineCode) // Print the register-allocated code - PM.add(createX86CodePrinterPass(std::cerr, TM)); +bool X86TargetMachine::addObjectWriter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { + if (Subtarget.isTargetELF()) { + addX86ELFObjectWriterPass(PM, Out, *this); + return false; + } + return true; } -bool X86TargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM, - MachineCodeEmitter &MCE) { +bool X86TargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast, + MachineCodeEmitter &MCE) { PM.add(createX86CodeEmitterPass(*this, MCE)); - // Delete machine code for this function - PM.add(createMachineCodeDeleter()); return false; } Index: llvm/lib/Target/X86/X86TargetMachine.h diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.37 llvm/lib/Target/X86/X86TargetMachine.h:1.38 --- llvm/lib/Target/X86/X86TargetMachine.h:1.37 Tue May 30 16:45:53 2006 +++ llvm/lib/Target/X86/X86TargetMachine.h Sun Sep 3 23:14:57 2006 @@ -17,7 +17,6 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" -#include "llvm/PassManager.h" #include "X86.h" #include "X86InstrInfo.h" #include "X86JITInfo.h" @@ -26,7 +25,7 @@ namespace llvm { -class X86TargetMachine : public TargetMachine { +class X86TargetMachine : public LLVMTargetMachine { X86Subtarget Subtarget; const TargetData DataLayout; // Calculates type size & alignment TargetFrameInfo FrameInfo; @@ -48,14 +47,19 @@ } virtual const TargetData *getTargetData() const { return &DataLayout; } - virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM, - MachineCodeEmitter &MCE); - - virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, bool Fast); - static unsigned getModuleMatchQuality(const Module &M); static unsigned getJITMatchQuality(); + + + // Set up the pass pipeline. + virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); + virtual bool addPostRegAlloc(FunctionPassManager &PM, bool Fast); + virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out); + virtual bool addObjectWriter(FunctionPassManager &PM, bool Fast, + std::ostream &Out); + virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast, + MachineCodeEmitter &MCE); }; } // End llvm namespace From lattner at cs.uiuc.edu Sun Sep 3 23:15:26 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:15:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC.h PPCJITInfo.h PPCMachOWriter.cpp PPCTargetMachine.cpp PPCTargetMachine.h Message-ID: <200609040415.k844FQu5012968@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC.h updated: 1.31 -> 1.32 PPCJITInfo.h updated: 1.13 -> 1.14 PPCMachOWriter.cpp updated: 1.2 -> 1.3 PPCTargetMachine.cpp updated: 1.102 -> 1.103 PPCTargetMachine.h updated: 1.22 -> 1.23 --- Log message: Completely rearchitect the interface between targets and the pass manager. This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. --- Diffs of the changes: (+45 -108) PPC.h | 10 ++-- PPCJITInfo.h | 6 -- PPCMachOWriter.cpp | 2 PPCTargetMachine.cpp | 119 ++++++++++++--------------------------------------- PPCTargetMachine.h | 16 ++++-- 5 files changed, 45 insertions(+), 108 deletions(-) Index: llvm/lib/Target/PowerPC/PPC.h diff -u llvm/lib/Target/PowerPC/PPC.h:1.31 llvm/lib/Target/PowerPC/PPC.h:1.32 --- llvm/lib/Target/PowerPC/PPC.h:1.31 Wed Aug 23 16:08:52 2006 +++ llvm/lib/Target/PowerPC/PPC.h Sun Sep 3 23:14:57 2006 @@ -1,4 +1,4 @@ -//===-- PowerPC.h - Top-level interface for PowerPC representation -*- C++ -*-// +//===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,15 +12,15 @@ // //===----------------------------------------------------------------------===// -#ifndef TARGET_POWERPC_H -#define TARGET_POWERPC_H +#ifndef LLVM_TARGET_POWERPC_H +#define LLVM_TARGET_POWERPC_H #include namespace llvm { class PPCTargetMachine; -class PassManager; +class FunctionPassManager; class FunctionPass; class MachineCodeEmitter; @@ -29,7 +29,7 @@ FunctionPass *createDarwinAsmPrinter(std::ostream &OS, PPCTargetMachine &TM); FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, MachineCodeEmitter &MCE); -void addPPCMachOObjectWriterPass(PassManager &FPM, std::ostream &o, +void addPPCMachOObjectWriterPass(FunctionPassManager &FPM, std::ostream &o, PPCTargetMachine &tm); } // end namespace llvm; Index: llvm/lib/Target/PowerPC/PPCJITInfo.h diff -u llvm/lib/Target/PowerPC/PPCJITInfo.h:1.13 llvm/lib/Target/PowerPC/PPCJITInfo.h:1.14 --- llvm/lib/Target/PowerPC/PPCJITInfo.h:1.13 Mon Aug 28 21:30:59 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.h Sun Sep 3 23:14:57 2006 @@ -29,12 +29,6 @@ is64Bit = tmIs64Bit; } - /// addPassesToJITCompile - Add passes to the specified pass manager to - /// implement a fast dynamic compiler for this target. Return true if this - /// is not supported for this target. - /// - virtual void addPassesToJITCompile(FunctionPassManager &PM); - virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE); virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); virtual void relocate(void *Function, MachineRelocation *MR, Index: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp diff -u llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.2 llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.3 --- llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.2 Sun Aug 27 07:54:01 2006 +++ llvm/lib/Target/PowerPC/PPCMachOWriter.cpp Sun Sep 3 23:14:57 2006 @@ -33,7 +33,7 @@ /// addPPCMachOObjectWriterPass - Returns a pass that outputs the generated code /// as a Mach-O object file. /// -void llvm::addPPCMachOObjectWriterPass(PassManager &FPM, +void llvm::addPPCMachOObjectWriterPass(FunctionPassManager &FPM, std::ostream &O, PPCTargetMachine &TM) { PPCMachOWriter *EW = new PPCMachOWriter(O, TM); FPM.add(EW); Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.102 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.103 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.102 Sun Sep 3 13:44:02 2006 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Sun Sep 3 23:14:57 2006 @@ -12,19 +12,10 @@ //===----------------------------------------------------------------------===// #include "PPC.h" -#include "PPCFrameInfo.h" #include "PPCTargetMachine.h" -#include "PPCJITInfo.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Analysis/Verifier.h" -#include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/Passes.h" -#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetMachineRegistry.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Support/CommandLine.h" -#include using namespace llvm; namespace { @@ -106,99 +97,47 @@ : PPCTargetMachine(M, FS, true) { } -/// addPassesToEmitFile - Add passes to the specified pass manager to implement -/// a static compiler for this target. -/// -bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, - bool Fast) { - if (FileType != TargetMachine::AssemblyFile && - FileType != TargetMachine::ObjectFile) return true; - - // Run loop strength reduction before anything else. - if (!Fast) PM.add(createLoopStrengthReducePass(&TLInfo)); - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); - // FIXME: Implement the invoke/unwind instructions! - PM.add(createLowerInvokePass()); - - // Clean up after other passes, e.g. merging critical edges. - if (!Fast) PM.add(createCFGSimplificationPass()); - - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); +//===----------------------------------------------------------------------===// +// Pass Pipeline Configuration +//===----------------------------------------------------------------------===// +bool PPCTargetMachine::addInstSelector(FunctionPassManager &PM, bool Fast) { // Install an instruction selector. PM.add(createPPCISelDag(*this)); + return false; +} - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createRegisterAllocator()); - - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); - - PM.add(createPrologEpilogCodeInserter()); - - // Must run branch selection immediately preceding the asm printer +bool PPCTargetMachine::addPreEmitPass(FunctionPassManager &PM, bool Fast) { + + // Must run branch selection immediately preceding the asm printer. PM.add(createPPCBranchSelectionPass()); - - if (FileType == TargetMachine::AssemblyFile) - PM.add(createDarwinAsmPrinter(Out, *this)); - else - // FIXME: support PPC ELF files at some point - addPPCMachOObjectWriterPass(PM, Out, *this); - - PM.add(createMachineCodeDeleter()); return false; } -void PPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { - // The JIT should use the static relocation model. - TM.setRelocationModel(Reloc::Static); - - // Run loop strength reduction before anything else. - PM.add(createLoopStrengthReducePass(TM.getTargetLowering())); - - // FIXME: Implement efficient support for garbage collection intrinsics. - PM.add(createLowerGCPass()); - - // FIXME: Implement the invoke/unwind instructions! - PM.add(createLowerInvokePass()); - - // Clean up after other passes, e.g. merging critical edges. - PM.add(createCFGSimplificationPass()); - - // Make sure that no unreachable blocks are instruction selected. - PM.add(createUnreachableBlockEliminationPass()); - - // Install an instruction selector. - PM.add(createPPCISelDag(TM)); - - PM.add(createRegisterAllocator()); - PM.add(createPrologEpilogCodeInserter()); - - // Must run branch selection immediately preceding the asm printer - PM.add(createPPCBranchSelectionPass()); +bool PPCTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { + PM.add(createDarwinAsmPrinter(Out, *this)); + return false; +} - if (PrintMachineCode) - PM.add(createMachineFunctionPrinterPass(&std::cerr)); +bool PPCTargetMachine::addObjectWriter(FunctionPassManager &PM, bool Fast, + std::ostream &Out) { + // FIXME: support PPC ELF files at some point + addPPCMachOObjectWriterPass(PM, Out, *this); + return true; } -/// addPassesToEmitMachineCode - Add passes to the specified pass manager to get -/// machine code emitted. This uses a MachineCodeEmitter object to handle -/// actually outputting the machine code and resolving things like the address -/// of functions. This method should returns true if machine code emission is -/// not supported. -/// -bool PPCTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM, - MachineCodeEmitter &MCE) { - // Machine code emitter pass for PowerPC +bool PPCTargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast, + MachineCodeEmitter &MCE) { + // The JIT should use the static relocation model. + // FIXME: This should be moved to TargetJITInfo!! + setRelocationModel(Reloc::Static); + + + + // Machine code emitter pass for PowerPC. PM.add(createPPCCodeEmitterPass(*this, MCE)); - // Delete machine code for this function after emitting it - PM.add(createMachineCodeDeleter()); return false; } + Index: llvm/lib/Target/PowerPC/PPCTargetMachine.h diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.22 llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.23 --- llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.22 Thu Jun 15 20:37:27 2006 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.h Sun Sep 3 23:14:57 2006 @@ -28,7 +28,7 @@ /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets. /// -class PPCTargetMachine : public TargetMachine { +class PPCTargetMachine : public LLVMTargetMachine { PPCSubtarget Subtarget; const TargetData DataLayout; // Calculates type size & alignment PPCInstrInfo InstrInfo; @@ -55,12 +55,16 @@ return InstrItins; } - - virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, - CodeGenFileType FileType, bool Fast); - bool addPassesToEmitMachineCode(FunctionPassManager &PM, - MachineCodeEmitter &MCE); + // Pass Pipeline Configuration + virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); + virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast); + virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, + std::ostream &Out); + virtual bool addObjectWriter(FunctionPassManager &PM, bool Fast, + std::ostream &Out); + virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast, + MachineCodeEmitter &MCE); }; /// PPC32TargetMachine - PowerPC 32-bit target machine. From lattner at cs.uiuc.edu Sun Sep 3 23:16:23 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:16:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LLVMTargetMachine.cpp Message-ID: <200609040416.k844GN5d013044@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LLVMTargetMachine.cpp added (r1.1) --- Log message: new file --- Diffs of the changes: (+154 -0) LLVMTargetMachine.cpp | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 154 insertions(+) Index: llvm/lib/CodeGen/LLVMTargetMachine.cpp diff -c /dev/null llvm/lib/CodeGen/LLVMTargetMachine.cpp:1.1 *** /dev/null Sun Sep 3 23:16:19 2006 --- llvm/lib/CodeGen/LLVMTargetMachine.cpp Sun Sep 3 23:16:09 2006 *************** *** 0 **** --- 1,154 ---- + //===-- LLVMTargetMachine.cpp - Implement the LLVMTargetMachine class -----===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the LLVMTargetMachine class. + // + //===----------------------------------------------------------------------===// + + #include "llvm/Target/TargetMachine.h" + #include "llvm/PassManager.h" + #include "llvm/Pass.h" + #include "llvm/CodeGen/Passes.h" + #include "llvm/Target/TargetOptions.h" + #include "llvm/Transforms/Scalar.h" + #include + using namespace llvm; + + bool LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM, + std::ostream &Out, + CodeGenFileType FileType, + bool Fast) { + // Standard LLVM-Level Passes. + + // Run loop strength reduction before anything else. + if (!Fast) PM.add(createLoopStrengthReducePass(getTargetLowering())); + + // FIXME: Implement efficient support for garbage collection intrinsics. + PM.add(createLowerGCPass()); + + // FIXME: Implement the invoke/unwind instructions! + PM.add(createLowerInvokePass()); + + // Make sure that no unreachable blocks are instruction selected. + PM.add(createUnreachableBlockEliminationPass()); + + + // Ask the target for an isel. + if (addInstSelector(PM, Fast)) + return true; + + + // Print the instruction selected machine code... + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + // Perform register allocation to convert to a concrete x86 representation + PM.add(createRegisterAllocator()); + + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + + // Run post-ra passes. + if (addPostRegAlloc(PM, Fast) && PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + + // Insert prolog/epilog code. Eliminate abstract frame index references... + PM.add(createPrologEpilogCodeInserter()); + + if (PrintMachineCode) // Print the register-allocated code + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + + if (addPreEmitPass(PM, Fast) && PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + + switch (FileType) { + default: return true; + case TargetMachine::AssemblyFile: + if (addAssemblyEmitter(PM, Fast, Out)) + return true; + break; + case TargetMachine::ObjectFile: + if (addObjectWriter(PM, Fast, Out)) + return true; + break; + } + + // Delete machine code for this function + PM.add(createMachineCodeDeleter()); + + return false; // success! + } + + /// addPassesToEmitMachineCode - Add passes to the specified pass manager to + /// get machine code emitted. This uses a MachineCodeEmitter object to handle + /// actually outputting the machine code and resolving things like the address + /// of functions. This method should returns true if machine code emission is + /// not supported. + /// + bool LLVMTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM, + MachineCodeEmitter &MCE, + bool Fast) { + // Standard LLVM-Level Passes. + + // Run loop strength reduction before anything else. + if (!Fast) PM.add(createLoopStrengthReducePass(getTargetLowering())); + + // FIXME: Implement efficient support for garbage collection intrinsics. + PM.add(createLowerGCPass()); + + // FIXME: Implement the invoke/unwind instructions! + PM.add(createLowerInvokePass()); + + // Make sure that no unreachable blocks are instruction selected. + PM.add(createUnreachableBlockEliminationPass()); + + + // Ask the target for an isel. + if (addInstSelector(PM, Fast)) + return true; + + + // Print the instruction selected machine code... + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + // Perform register allocation to convert to a concrete x86 representation + PM.add(createRegisterAllocator()); + + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + + // Run post-ra passes. + if (addPostRegAlloc(PM, Fast) && PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + + // Insert prolog/epilog code. Eliminate abstract frame index references... + PM.add(createPrologEpilogCodeInserter()); + + if (PrintMachineCode) // Print the register-allocated code + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + + if (addPreEmitPass(PM, Fast) && PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + + addCodeEmitter(PM, Fast, MCE); + + // Delete machine code for this function + PM.add(createMachineCodeDeleter()); + + return false; // success! + } From lattner at cs.uiuc.edu Sun Sep 3 23:27:21 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:27:21 -0500 Subject: [llvm-commits] CVS: llvm/Makefile Message-ID: <200609040427.k844RLLT013305@zion.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.64 -> 1.65 --- Log message: Document build order dependencies. Make sure that llvm-config is built before tools. --- Diffs of the changes: (+12 -1) Makefile | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) Index: llvm/Makefile diff -u llvm/Makefile:1.64 llvm/Makefile:1.65 --- llvm/Makefile:1.64 Tue Aug 15 19:43:50 2006 +++ llvm/Makefile Sun Sep 3 23:27:07 2006 @@ -8,7 +8,18 @@ #===------------------------------------------------------------------------===# LEVEL := . -DIRS := lib/System lib/Support utils lib/VMCore lib tools runtime docs + +# Top-Level LLVM Build Stages: +# 1. Build lib/System and lib/Support, which are used by utils (tblgen). +# 2. Build utils, which is used by VMCore. +# 3. Build VMCore, which builds the Intrinsics.inc file used by libs. +# 4. Build libs, which are needed by llvm-config. +# 5. Build llvm-config, which determines inter-lib dependencies for tools. +# 6. Build tools, runtime, docs. +# +DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \ + tools runtime docs + OPTIONAL_DIRS := examples projects EXTRA_DIST := test llvm.spec include win32 Xcode From lattner at cs.uiuc.edu Sun Sep 3 23:47:36 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:47:36 -0500 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200609040447.k844la5S013746@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.400 -> 1.401 --- Log message: Add a new make option (LINK_COMPONENTS) which tools can use to specify what libraries they need. This uses llvm-config to link the tools. --- Diffs of the changes: (+14 -4) Makefile.rules | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.400 llvm/Makefile.rules:1.401 --- llvm/Makefile.rules:1.400 Sun Sep 3 20:02:25 2006 +++ llvm/Makefile.rules Sun Sep 3 23:47:21 2006 @@ -297,6 +297,7 @@ TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT) endif endif +LLVM_CONFIG := $(LLVMToolDir)/llvm-config ifndef GCCAS GCCAS := $(LLVMToolDir)/gccas$(EXEEXT) endif @@ -629,7 +630,6 @@ # JIT support for a library or a tool that runs JIT. #--------------------------------------------------------- ifeq ($(firstword $(LLVMLIBS)),config) -LLVM_CONFIG := $(LLVM_SRC_ROOT)/utils/llvm-config/llvm-config LLVMLIBS := $(shell $(LLVM_CONFIG) --libnames $(wordlist 2,9999,$(LLVMLIBS))) LLVMLIBS := $(patsubst lib%.a,%.a,$(LLVMLIBS)) LLVMLIBS := $(patsubst %.o,%,$(LLVMLIBS)) @@ -690,17 +690,27 @@ # Define various command line options pertaining to the # libraries needed when linking. There are "Proj" libs # (defined by the user's project) and "LLVM" libs (defined -# by the # LLVM project). +# by the LLVM project). #--------------------------------------------------------- +ifdef USEDLIBS ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions)) +ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS))) +ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs)) +endif + +ifdef LLVMLIBS LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS))) LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions)) -ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS))) LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS))) -ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs)) LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs)) +endif + +ifdef LINK_COMPONENTS +ProjLibsOptions := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS)) +ProjLibsPaths := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS)) +endif ############################################################################### # Library Build Rules: Four ways to build a library From lattner at cs.uiuc.edu Sun Sep 3 23:48:03 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:48:03 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-as/Makefile Message-ID: <200609040448.k844m3qJ013777@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-as: Makefile updated: 1.18 -> 1.19 --- Log message: Switch to using llvm-config to select components to link in. --- Diffs of the changes: (+2 -2) Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/tools/llvm-as/Makefile diff -u llvm/tools/llvm-as/Makefile:1.18 llvm/tools/llvm-as/Makefile:1.19 --- llvm/tools/llvm-as/Makefile:1.18 Thu Jul 6 19:46:18 2006 +++ llvm/tools/llvm-as/Makefile Sun Sep 3 23:47:49 2006 @@ -6,10 +6,10 @@ # the University of Illinois Open Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## + LEVEL = ../.. TOOLNAME = llvm-as -USEDLIBS = LLVMAsmParser.a LLVMBCWriter.a LLVMCore.a \ - LLVMSupport.a LLVMbzip2.a LLVMSystem.a +LINK_COMPONENTS := asmparser bcwriter REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Sun Sep 3 23:50:24 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 3 Sep 2006 23:50:24 -0500 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200609040450.k844oO3F013859@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.401 -> 1.402 --- Log message: Make LINK_COMPONENTS interact well with make clean --- Diffs of the changes: (+3 -1) Makefile.rules | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.401 llvm/Makefile.rules:1.402 --- llvm/Makefile.rules:1.401 Sun Sep 3 23:47:21 2006 +++ llvm/Makefile.rules Sun Sep 3 23:50:10 2006 @@ -707,10 +707,12 @@ LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs)) endif +ifneq ($(strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS)))),) ifdef LINK_COMPONENTS ProjLibsOptions := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS)) ProjLibsPaths := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS)) endif +endif ############################################################################### # Library Build Rules: Four ways to build a library @@ -1415,7 +1417,7 @@ ifndef DISABLE_AUTO_DEPENDENCIES # If its not one of the cleaning targets -ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),) +ifneq ($(strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS)))),) # Get the list of dependency files DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))