[llvm-commits] CVS: llvm/utils/GenLibDeps.pl
Changes in directory llvm/utils: GenLibDeps.pl updated: 1.8 - 1.9 --- Log message: Add a feature for debugging library dependency cycles, -why option. This implies -flat and will produce a list of all the symbols for each library that another library depends on. Run the output through c++filt for better readability. Also, don't generate a temporary file for storing the dependent library names. Perl can handle it in a %hash. --- Diffs of the changes: (+27 -16) GenLibDeps.pl | 43 +++ 1 files changed, 27 insertions(+), 16 deletions(-) Index: llvm/utils/GenLibDeps.pl diff -u llvm/utils/GenLibDeps.pl:1.8 llvm/utils/GenLibDeps.pl:1.9 --- llvm/utils/GenLibDeps.pl:1.8Fri May 12 21:48:45 2006 +++ llvm/utils/GenLibDeps.plTue Jul 25 14:12:06 2006 @@ -10,12 +10,15 @@ # # Parse arguments... +my $FLAT = 0; +my $WHY = 0; while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { shift; last if /^--$/; # Stop processing arguments on -- # List command line options here... if (/^-flat$/) { $FLAT = 1; next; } + if (/^-why/) { $WHY = 1; $FLAT = 1; next; } print Unknown option: $_ : ignoring!\n; } @@ -76,46 +79,54 @@ $lib_ns =~ s/(.*)\.[oa]/$1/; if ($FLAT) { print $lib:; +if ($WHY) { print \n; } } else { print dtb$lib/b/dtddul\n; } open UNDEFS, $nmPath -g -u $Directory/$lib | sed -e 's/^ *U //' | sort | uniq |; - open DEPENDS, -| sort | uniq GenLibDeps.out; + my %DepLibs; while (UNDEFS) { chomp; +my $lib_printed = 0; if (defined($libdefs{$_}) $libdefs{$_} ne $lib) { - print DEPENDS $libdefs{$_}\n; + $DepLibs{$libdefs{$_}} = [] unless exists $DepLibs{$libdefs{$_}}; + push(@{$DepLibs{$libdefs{$_}}}, $_); } elsif (defined($objdefs{$_}) $objdefs{$_} ne $lib) { $libroot = $lib; $libroot =~ s/lib(.*).a/$1/; if ($objdefs{$_} ne $libroot.o) { -print DEPENDS $objdefs{$_}\n; +$DepLibs{$objdefs{$_}} = [] unless exists $DepLibs{$objdefs{$_}}; +push(@{$DepLibs{$objdefs{$_}}}, $_); } } } close UNDEFS; - close DEPENDS; - open DF, GenLibDeps.out; - while (DF) { -chomp; + for my $key (sort keys %DepLibs) { if ($FLAT) { - print $_; + print $key; + if ($WHY) { +print \n; +my @syms = @{$DepLibs{$key}}; +foreach $sym (@syms) { + print $sym\n; +} + } } else { - print li$_/li\n; + print li$key/li\n; } -$suffix = substr($_,length($_)-1,1); -$_ =~ s/(.*)\.[oa]/$1/; +$suffix = substr($key,length($key)-1,1); +$key =~ s/(.*)\.[oa]/$1/; if ($suffix eq a) { - if (!$FLAT) { print DOT $lib_ns - $_ [ weight=0 ];\n }; + if (!$FLAT) { print DOT $lib_ns - $key [ weight=0 ];\n }; } else { - if (!$FLAT) { print DOT $lib_ns - $_ [ weight=10];\n }; + if (!$FLAT) { print DOT $lib_ns - $key [ weight=10];\n }; } } - close DF; if ($FLAT) { -print \n; +if (!$WHY) { + print \n; +} } else { print /ul/dd\n; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.16 - 1.17 --- Log message: implement function calling of functions with up to 4 arguments --- Diffs of the changes: (+45 -3) ARMISelDAGToDAG.cpp | 48 +--- 1 files changed, 45 insertions(+), 3 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.16 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.17 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.16Sat Jul 15 20:02:57 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Jul 25 15:17:19 2006 @@ -75,17 +75,38 @@ assert(isTailCall == false tail call not supported); SDOperand Callee = Op.getOperand(4); unsigned NumOps= (Op.getNumOperands() - 5) / 2; - assert(NumOps == 0); // Count how many bytes are to be pushed on the stack. Initially // only the link register. unsigned NumBytes = 4; + assert(NumOps = 4); //no args on the stack + // Adjust the stack pointer for the new arguments... // These operations are automatically eliminated by the prolog/epilog pass Chain = DAG.getCALLSEQ_START(Chain, DAG.getConstant(NumBytes, MVT::i32)); + static const unsigned regs[] = { +ARM::R0, ARM::R1, ARM::R2, ARM::R3 + }; + + std::vectorstd::pairunsigned, SDOperand RegsToPass; + + for (unsigned i = 0; i != NumOps; ++i) { +SDOperand Arg = Op.getOperand(5+2*i); +RegsToPass.push_back(std::make_pair(regs[i], Arg)); + } + + // Build a sequence of copy-to-reg nodes chained together with token chain + // and flag operands which copy the outgoing args into the appropriate regs. + SDOperand InFlag; + for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) { +Chain = DAG.getCopyToReg(Chain, RegsToPass[i].first, RegsToPass[i].second, + InFlag); +InFlag = Chain.getValue(1); + } + std::vectorMVT::ValueType NodeTys; NodeTys.push_back(MVT::Other); // Returns a chain NodeTys.push_back(MVT::Flag);// Returns a flag for retval copy to use. @@ -103,14 +124,35 @@ Ops.push_back(Callee); unsigned CallOpc = ARMISD::CALL; + if (InFlag.Val) +Ops.push_back(InFlag); Chain = DAG.getNode(CallOpc, NodeTys, Ops); + InFlag = Chain.getValue(1); + + std::vectorSDOperand ResultVals; + NodeTys.clear(); - assert(Op.Val-getValueType(0) == MVT::Other); + // If the call has results, copy the values out of the ret val registers. + switch (Op.Val-getValueType(0)) { + default: assert(0 Unexpected ret value!); + case MVT::Other: +break; + case MVT::i32: +Chain = DAG.getCopyFromReg(Chain, ARM::R0, MVT::i32, InFlag).getValue(1); +ResultVals.push_back(Chain.getValue(0)); +NodeTys.push_back(MVT::i32); + } Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain, DAG.getConstant(NumBytes, MVT::i32)); + NodeTys.push_back(MVT::Other); + + if (ResultVals.empty()) +return Chain; - return Chain; + ResultVals.push_back(Chain); + SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, NodeTys, ResultVals); + return Res.getValue(Op.ResNo); } static SDOperand LowerRET(SDOperand Op, SelectionDAG DAG) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/call.ll
Changes in directory llvm/test/Regression/CodeGen/ARM: call.ll added (r1.1) --- Log message: implement function calling of functions with up to 4 arguments --- Diffs of the changes: (+8 -0) call.ll |8 1 files changed, 8 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/call.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/call.ll:1.1 *** /dev/null Tue Jul 25 15:17:30 2006 --- llvm/test/Regression/CodeGen/ARM/call.llTue Jul 25 15:17:20 2006 *** *** 0 --- 1,8 + ; RUN: llvm-as %s | llc -march=arm + void %f() { + entry: + call void %g( int 1, int 2, int 3, int 4 ) + ret void + } + + declare void %g(int, int, int, int) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrSSE.td
Changes in directory llvm/lib/Target/X86: X86InstrInfo.cpp updated: 1.57 - 1.58 X86InstrSSE.td updated: 1.129 - 1.130 --- Log message: Can't commute shufps. The high / low parts elements come from different vectors. --- Diffs of the changes: (+1 -20) X86InstrInfo.cpp | 18 -- X86InstrSSE.td |3 +-- 2 files changed, 1 insertion(+), 20 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.57 llvm/lib/Target/X86/X86InstrInfo.cpp:1.58 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.57 Tue May 30 18:34:30 2006 +++ llvm/lib/Target/X86/X86InstrInfo.cppTue Jul 25 15:25:40 2006 @@ -207,24 +207,6 @@ /// MachineInstr *X86InstrInfo::commuteInstruction(MachineInstr *MI) const { switch (MI-getOpcode()) { - case X86::SHUFPSrri: { // A = SHUFPSrri B,C, M - A = SHUFPSrri C,B, rotl(M,4) -unsigned A = MI-getOperand(0).getReg(); -unsigned B = MI-getOperand(1).getReg(); -unsigned C = MI-getOperand(2).getReg(); -unsigned M = MI-getOperand(3).getImmedValue(); -if (B == C) return 0; -return BuildMI(X86::SHUFPSrri, 3, A).addReg(C).addReg(B). - addImm(((M 0xF) 4) | ((M 0xF0) 4)); - } - case X86::SHUFPDrri: { // A = SHUFPDrri B,C, M - A = SHUFPDrri C,B, rotl(M,1) -unsigned A = MI-getOperand(0).getReg(); -unsigned B = MI-getOperand(1).getReg(); -unsigned C = MI-getOperand(2).getReg(); -unsigned M = MI-getOperand(3).getImmedValue(); -if (B == C) return 0; -return BuildMI(X86::SHUFPDrri, 3, A).addReg(C).addReg(B). - addImm(((M 0x1) 1) | ((M 0x2) 1)); - } case X86::SHRD16rri8: // A = SHRD16rri8 B, C, I - A = SHLD16rri8 C, B, (16-I) case X86::SHLD16rri8: // A = SHLD16rri8 B, C, I - A = SHRD16rri8 C, B, (16-I) case X86::SHRD32rri8: // A = SHRD32rri8 B, C, I - A = SHLD32rri8 C, B, (32-I) Index: llvm/lib/Target/X86/X86InstrSSE.td diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.129 llvm/lib/Target/X86/X86InstrSSE.td:1.130 --- llvm/lib/Target/X86/X86InstrSSE.td:1.129Fri Jul 7 03:33:52 2006 +++ llvm/lib/Target/X86/X86InstrSSE.td Tue Jul 25 15:25:40 2006 @@ -1223,7 +1223,7 @@ // Shuffle and unpack instructions let isTwoAddress = 1 in { -let isCommutable = 1, isConvertibleToThreeAddress = 1 in // Convert to pshufd +let isConvertibleToThreeAddress = 1 in // Convert to pshufd def SHUFPSrri : PSIi80xC6, MRMSrcReg, (ops VR128:$dst, VR128:$src1, VR128:$src2, i32i8imm:$src3), shufps {$src3, $src2, $dst|$dst, $src2, $src3}, @@ -1236,7 +1236,6 @@ [(set VR128:$dst, (v4f32 (vector_shuffle VR128:$src1, (load addr:$src2), SHUFP_shuffle_mask:$src3)))]; -let isCommutable = 1 in def SHUFPDrri : PDIi80xC6, MRMSrcReg, (ops VR128:$dst, VR128:$src1, VR128:$src2, i8imm:$src3), shufpd {$src3, $src2, $dst|$dst, $src2, $src3}, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetJITInfo.h
Changes in directory llvm/include/llvm/Target: TargetJITInfo.h updated: 1.7 - 1.8 --- Log message: - Refactor the code that resolve basic block references to a TargetJITInfo method. - Added synchronizeICache() to TargetJITInfo. It is called after each block of code is emitted to flush the icache. This ensures correct execution on targets that have separate dcache and icache. - Added PPC / Mac OS X specific code to do icache flushing. --- Diffs of the changes: (+19 -0) TargetJITInfo.h | 19 +++ 1 files changed, 19 insertions(+) Index: llvm/include/llvm/Target/TargetJITInfo.h diff -u llvm/include/llvm/Target/TargetJITInfo.h:1.7 llvm/include/llvm/Target/TargetJITInfo.h:1.8 --- llvm/include/llvm/Target/TargetJITInfo.h:1.7Fri Jul 22 15:46:42 2005 +++ llvm/include/llvm/Target/TargetJITInfo.hTue Jul 25 15:40:54 2006 @@ -18,10 +18,12 @@ #define LLVM_TARGET_TARGETJITINFO_H #include cassert +#include vector namespace llvm { class Function; class FunctionPassManager; + class MachineBasicBlock; class MachineCodeEmitter; class MachineRelocation; @@ -81,6 +83,20 @@ assert(NumRelocs == 0 This target does not have relocations!); } +/// resolveBBRefs - Resolve branches to BasicBlocks for the JIT emitted +/// function. +virtual void resolveBBRefs(MachineCodeEmitter MCE) {} + +/// synchronizeICache - On some targets, the JIT emitted code must be +/// explicitly refetched to ensure correct execution. +virtual void synchronizeICache(const void *Addr, size_t len) {} + +/// addBBRef - Add a BasicBlock reference to be resolved after the function +/// is emitted. +void addBBRef(MachineBasicBlock *BB, intptr_t PC) { + BBRefs.push_back(std::make_pair(BB, PC)); +} + /// needsGOT - Allows a target to specify that it would like the // JIT to manage a GOT for it. bool needsGOT() const { return useGOT; } @@ -88,6 +104,9 @@ protected: bool useGOT; +// Tracks which instruction references which BasicBlock +std::vectorstd::pairMachineBasicBlock*, intptr_t BBRefs; + }; } // End llvm namespace ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/Alpha.h AlphaCodeEmitter.cpp AlphaJITInfo.cpp AlphaJITInfo.h AlphaTargetMachine.cpp
Changes in directory llvm/lib/Target/Alpha: Alpha.h updated: 1.5 - 1.6 AlphaCodeEmitter.cpp updated: 1.15 - 1.16 AlphaJITInfo.cpp updated: 1.9 - 1.10 AlphaJITInfo.h updated: 1.1 - 1.2 AlphaTargetMachine.cpp updated: 1.26 - 1.27 --- Log message: - Refactor the code that resolve basic block references to a TargetJITInfo method. - Added synchronizeICache() to TargetJITInfo. It is called after each block of code is emitted to flush the icache. This ensures correct execution on targets that have separate dcache and icache. - Added PPC / Mac OS X specific code to do icache flushing. --- Diffs of the changes: (+32 -25) Alpha.h|4 +++- AlphaCodeEmitter.cpp | 34 +++--- AlphaJITInfo.cpp | 16 AlphaJITInfo.h |1 + AlphaTargetMachine.cpp |2 +- 5 files changed, 32 insertions(+), 25 deletions(-) Index: llvm/lib/Target/Alpha/Alpha.h diff -u llvm/lib/Target/Alpha/Alpha.h:1.5 llvm/lib/Target/Alpha/Alpha.h:1.6 --- llvm/lib/Target/Alpha/Alpha.h:1.5 Wed Oct 19 19:28:31 2005 +++ llvm/lib/Target/Alpha/Alpha.h Tue Jul 25 15:40:54 2006 @@ -19,6 +19,7 @@ namespace llvm { + class AlphaTargetMachine; class FunctionPass; class TargetMachine; class MachineCodeEmitter; @@ -28,7 +29,8 @@ FunctionPass *createAlphaCodePrinterPass(std::ostream OS, TargetMachine TM); FunctionPass *createAlphaPatternInstructionSelector(TargetMachine TM); - FunctionPass *createAlphaCodeEmitterPass(MachineCodeEmitter MCE); + FunctionPass *createAlphaCodeEmitterPass(AlphaTargetMachine TM, + MachineCodeEmitter MCE); } // end namespace llvm; // Defines symbolic names for Alpha registers. This defines a mapping from Index: llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp diff -u llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.15 llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.16 --- llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.15 Wed May 3 15:30:20 2006 +++ llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp Tue Jul 25 15:40:54 2006 @@ -34,17 +34,19 @@ namespace { class AlphaCodeEmitter : public MachineFunctionPass { const AlphaInstrInfo *II; +TargetMachine TM; MachineCodeEmitter MCE; -std::vectorstd::pairMachineBasicBlock *, unsigned* BBRefs; /// getMachineOpValue - evaluates the MachineOperand of a given MachineInstr /// int getMachineOpValue(MachineInstr MI, MachineOperand MO); public: -explicit AlphaCodeEmitter(MachineCodeEmitter mce) : II(0), MCE(mce) {} -AlphaCodeEmitter(MachineCodeEmitter mce, const AlphaInstrInfo ii) -: II(ii), MCE(mce) {} +explicit AlphaCodeEmitter(TargetMachine tm, MachineCodeEmitter mce) + : II(0), TM(tm), MCE(mce) {} +AlphaCodeEmitter(TargetMachine tm, MachineCodeEmitter mce, + const AlphaInstrInfo ii) + : II(ii), TM(tm), MCE(mce) {} bool runOnMachineFunction(MachineFunction MF); @@ -68,34 +70,20 @@ /// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha code /// to the specified MCE object. -FunctionPass *llvm::createAlphaCodeEmitterPass(MachineCodeEmitter MCE) { - return new AlphaCodeEmitter(MCE); +FunctionPass *llvm::createAlphaCodeEmitterPass(AlphaTargetMachine TM, + MachineCodeEmitter MCE) { + return new AlphaCodeEmitter(TM, MCE); } bool AlphaCodeEmitter::runOnMachineFunction(MachineFunction MF) { II = ((AlphaTargetMachine)MF.getTarget()).getInstrInfo(); do { -BBRefs.clear(); - MCE.startFunction(MF); for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) emitBasicBlock(*I); } while (MCE.finishFunction(MF)); - // Resolve all forward branches now... - for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) { -unsigned* Location = - (unsigned*)MCE.getMachineBasicBlockAddress(BBRefs[i].first); -unsigned* Ref = (unsigned*)BBRefs[i].second; -intptr_t BranchTargetDisp = - (((unsigned char*)Location - (unsigned char*)Ref) 2) - 1; -DEBUG(std::cerr Fixup @ (void*)Ref to (void*)Location -Disp BranchTargetDisp -using(BranchTargetDisp ((1 22)-1)) \n); -*Ref |= (BranchTargetDisp ((1 21)-1)); - } - BBRefs.clear(); return false; } @@ -227,8 +215,8 @@ Reloc, MO.getConstantPoolIndex(), Offset)); } else if (MO.isMachineBasicBlock()) { -unsigned* CurrPC = (unsigned*)(intptr_t)MCE.getCurrentPCValue(); -BBRefs.push_back(std::make_pair(MO.getMachineBasicBlock(), CurrPC)); +TM.getJITInfo()-addBBRef(MO.getMachineBasicBlock(), + MCE.getCurrentPCValue()); }else { std::cerr ERROR: Unknown type of MachineOperand: MO \n; abort(); Index:
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp PPCJITInfo.cpp PPCJITInfo.h
Changes in directory llvm/lib/Target/PowerPC: PPCCodeEmitter.cpp updated: 1.63 - 1.64 PPCJITInfo.cpp updated: 1.24 - 1.25 PPCJITInfo.h updated: 1.9 - 1.10 --- Log message: - Refactor the code that resolve basic block references to a TargetJITInfo method. - Added synchronizeICache() to TargetJITInfo. It is called after each block of code is emitted to flush the icache. This ensures correct execution on targets that have separate dcache and icache. - Added PPC / Mac OS X specific code to do icache flushing. --- Diffs of the changes: (+43 -27) PPCCodeEmitter.cpp | 32 +--- PPCJITInfo.cpp | 35 +++ PPCJITInfo.h |3 +++ 3 files changed, 43 insertions(+), 27 deletions(-) Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.63 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.64 --- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.63 Wed Jul 12 16:23:20 2006 +++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Tue Jul 25 15:40:54 2006 @@ -32,9 +32,6 @@ TargetMachine TM; MachineCodeEmitter MCE; -// Tracks which instruction references which BasicBlock -std::vectorstd::pairMachineBasicBlock*, unsigned* BBRefs; - /// getMachineOpValue - evaluates the MachineOperand of a given MachineInstr /// int getMachineOpValue(MachineInstr MI, MachineOperand MO); @@ -80,39 +77,20 @@ return false; } +#ifdef __APPLE__ +extern C void sys_icache_invalidate(const void *Addr, size_t len); +#endif + bool PPCCodeEmitter::runOnMachineFunction(MachineFunction MF) { assert((MF.getTarget().getRelocationModel() != Reloc::Default || MF.getTarget().getRelocationModel() != Reloc::Static) JIT relocation model must be set to static or default!); do { -BBRefs.clear(); - MCE.startFunction(MF); for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); BB != E; ++BB) emitBasicBlock(*BB); } while (MCE.finishFunction(MF)); - // Resolve branches to BasicBlocks for the entire function - for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) { -intptr_t Location = MCE.getMachineBasicBlockAddress(BBRefs[i].first); -unsigned *Ref = BBRefs[i].second; -DEBUG(std::cerr Fixup @ (void*)Ref to (void*)Location - \n); -unsigned Instr = *Ref; -intptr_t BranchTargetDisp = (Location - (intptr_t)Ref) 2; - -switch (Instr 26) { -default: assert(0 Unknown branch user!); -case 18: // This is B or BL - *Ref |= (BranchTargetDisp ((1 24)-1)) 2; - break; -case 16: // This is BLT,BLE,BEQ,BGE,BGT,BNE, or other bcx instruction - *Ref |= (BranchTargetDisp ((1 14)-1)) 2; - break; -} - } - BBRefs.clear(); - return false; } @@ -203,7 +181,7 @@ Reloc, MO.getSymbolName(), 0)); } else if (MO.isMachineBasicBlock()) { unsigned* CurrPC = (unsigned*)(intptr_t)MCE.getCurrentPCValue(); -BBRefs.push_back(std::make_pair(MO.getMachineBasicBlock(), CurrPC)); +TM.getJITInfo()-addBBRef(MO.getMachineBasicBlock(), (intptr_t)CurrPC); } else if (MO.isConstantPoolIndex() || MO.isJumpTableIndex()) { if (MO.isConstantPoolIndex()) rv = MCE.getConstantPoolEntryAddress(MO.getConstantPoolIndex()); Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.24 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.25 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.24 Wed Jul 12 16:23:20 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Tue Jul 25 15:40:54 2006 @@ -16,7 +16,9 @@ #include PPCRelocations.h #include llvm/CodeGen/MachineCodeEmitter.h #include llvm/Config/alloca.h +#include llvm/Support/Debug.h #include set +#include iostream using namespace llvm; static TargetJITInfo::JITCompilerFn JITCompilerFunction; @@ -243,3 +245,36 @@ void PPCJITInfo::replaceMachineCodeForFunction(void *Old, void *New) { EmitBranchToAt(Old, New, false); } + +void PPCJITInfo::resolveBBRefs(MachineCodeEmitter MCE) { + // Resolve branches to BasicBlocks for the entire function + for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) { +intptr_t Location = MCE.getMachineBasicBlockAddress(BBRefs[i].first); +unsigned *Ref = (unsigned *)BBRefs[i].second; +DEBUG(std::cerr Fixup @ (void*)Ref to (void*)Location + \n); +unsigned Instr = *Ref; +intptr_t BranchTargetDisp = (Location - (intptr_t)Ref) 2; + +switch (Instr 26) { +default: assert(0 Unknown branch user!); +case 18: // This is B or BL + *Ref |= (BranchTargetDisp ((1 24)-1)) 2; + break; +case 16: // This is BLT,BLE,BEQ,BGE,BGT,BNE, or other bcx instruction + *Ref |= (BranchTargetDisp ((1 14)-1)) 2; + break; +} + } + BBRefs.clear(); +} + +#ifdef __APPLE__ +extern C void sys_icache_invalidate(const void *Addr, size_t len); +#endif
[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.106 - 1.107 --- Log message: - Refactor the code that resolve basic block references to a TargetJITInfo method. - Added synchronizeICache() to TargetJITInfo. It is called after each block of code is emitted to flush the icache. This ensures correct execution on targets that have separate dcache and icache. - Added PPC / Mac OS X specific code to do icache flushing. --- Diffs of the changes: (+16 -1) JITEmitter.cpp | 17 - 1 files changed, 16 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.106 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.107 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.106 Fri Jul 7 12:31:41 2006 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue Jul 25 15:40:54 2006 @@ -542,6 +542,10 @@ TheJIT-updateGlobalMapping(F, Stub); } + // Invalidate the icache if necessary. + TheJIT-getJITInfo(). +synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub); + DEBUG(std::cerr JIT: Stub emitted at [ Stub ] for function ' F-getName() '\n); @@ -559,6 +563,11 @@ if (Stub) return Stub; Stub = TheJIT-getJITInfo().emitFunctionStub(FnAddr, MCE); + + // Invalidate the icache if necessary. + TheJIT-getJITInfo(). +synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub); + DEBUG(std::cerr JIT: Stub emitted at [ Stub ] for external function at ' FnAddr '\n); return Stub; @@ -747,7 +756,7 @@ // About to start emitting the machine code for the function. emitAlignment(std::max(F.getFunction()-getAlignment(), 8U)); TheJIT-updateGlobalMapping(F.getFunction(), CurBufferPtr); - + MBBLocations.clear(); } @@ -825,6 +834,12 @@ } } + // Resolve BasicaBlock references. + TheJIT-getJITInfo().resolveBBRefs(*this); + + // Invalidate the icache if necessary. + TheJIT-getJITInfo().synchronizeICache(FnStart, FnEnd-FnStart); + DEBUG(std::cerr JIT: Finished CodeGen of [ (void*)FnStart ] Function: F.getFunction()-getName() : (FnEnd-FnStart) bytes of text, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86.h X86CodeEmitter.cpp X86ELFWriter.cpp X86JITInfo.cpp X86JITInfo.h X86TargetMachine.cpp
Changes in directory llvm/lib/Target/X86: X86.h updated: 1.45 - 1.46 X86CodeEmitter.cpp updated: 1.110 - 1.111 X86ELFWriter.cpp updated: 1.4 - 1.5 X86JITInfo.cpp updated: 1.23 - 1.24 X86JITInfo.h updated: 1.8 - 1.9 X86TargetMachine.cpp updated: 1.117 - 1.118 --- Log message: - Refactor the code that resolve basic block references to a TargetJITInfo method. - Added synchronizeICache() to TargetJITInfo. It is called after each block of code is emitted to flush the icache. This ensures correct execution on targets that have separate dcache and icache. - Added PPC / Mac OS X specific code to do icache flushing. --- Diffs of the changes: (+26 -19) X86.h|3 ++- X86CodeEmitter.cpp | 26 ++ X86ELFWriter.cpp |2 +- X86JITInfo.cpp | 10 ++ X86JITInfo.h |2 ++ X86TargetMachine.cpp |2 +- 6 files changed, 26 insertions(+), 19 deletions(-) Index: llvm/lib/Target/X86/X86.h diff -u llvm/lib/Target/X86/X86.h:1.45 llvm/lib/Target/X86/X86.h:1.46 --- llvm/lib/Target/X86/X86.h:1.45 Mon Mar 13 17:20:37 2006 +++ llvm/lib/Target/X86/X86.h Tue Jul 25 15:40:54 2006 @@ -44,7 +44,8 @@ /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code /// to the specified MCE object. -FunctionPass *createX86CodeEmitterPass(MachineCodeEmitter MCE); +FunctionPass *createX86CodeEmitterPass(X86TargetMachine TM, + MachineCodeEmitter MCE); /// addX86ELFObjectWriterPass - Add passes to the FPM that output the generated /// code as an ELF object file. Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.110 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.111 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.110Wed Jun 28 18:27:49 2006 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Tue Jul 25 15:40:54 2006 @@ -35,12 +35,14 @@ namespace { class VISIBILITY_HIDDEN Emitter : public MachineFunctionPass { const X86InstrInfo *II; +TargetMachine TM; MachineCodeEmitter MCE; -std::vectorstd::pairMachineBasicBlock *, unsigned BBRefs; public: -explicit Emitter(MachineCodeEmitter mce) : II(0), MCE(mce) {} -Emitter(MachineCodeEmitter mce, const X86InstrInfo ii) -: II(ii), MCE(mce) {} +explicit Emitter(TargetMachine tm, MachineCodeEmitter mce) + : II(0), TM(tm), MCE(mce) {} +Emitter(TargetMachine tm, MachineCodeEmitter mce, +const X86InstrInfo ii) + : II(ii), TM(tm), MCE(mce) {} bool runOnMachineFunction(MachineFunction MF); @@ -71,8 +73,9 @@ /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code /// to the specified MCE object. -FunctionPass *llvm::createX86CodeEmitterPass(MachineCodeEmitter MCE) { - return new Emitter(MCE); +FunctionPass *llvm::createX86CodeEmitterPass(X86TargetMachine TM, + MachineCodeEmitter MCE) { + return new Emitter(TM, MCE); } bool Emitter::runOnMachineFunction(MachineFunction MF) { @@ -82,8 +85,6 @@ II = ((X86TargetMachine)MF.getTarget()).getInstrInfo(); do { -BBRefs.clear(); - MCE.startFunction(MF); for (MachineFunction::iterator MBB = MF.begin(), E = MF.end(); MBB != E; ++MBB) { @@ -94,13 +95,6 @@ } } while (MCE.finishFunction(MF)); - // Resolve all forward branches now. - for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) { -unsigned Location = MCE.getMachineBasicBlockAddress(BBRefs[i].first); -unsigned Ref = BBRefs[i].second; -*((unsigned*)(intptr_t)Ref) = Location-Ref-4; - } - BBRefs.clear(); return false; } @@ -117,7 +111,7 @@ void Emitter::emitPCRelativeBlockAddress(MachineBasicBlock *MBB) { // Remember where this reference was and where it is to so we can // deal with it later. - BBRefs.push_back(std::make_pair(MBB, MCE.getCurrentPCValue())); + TM.getJITInfo()-addBBRef(MBB, MCE.getCurrentPCValue()); MCE.emitWordLE(0); } Index: llvm/lib/Target/X86/X86ELFWriter.cpp diff -u llvm/lib/Target/X86/X86ELFWriter.cpp:1.4 llvm/lib/Target/X86/X86ELFWriter.cpp:1.5 --- llvm/lib/Target/X86/X86ELFWriter.cpp:1.4Wed Jun 28 18:27:49 2006 +++ llvm/lib/Target/X86/X86ELFWriter.cppTue Jul 25 15:40:54 2006 @@ -35,5 +35,5 @@ std::ostream O, X86TargetMachine TM) { X86ELFWriter *EW = new X86ELFWriter(O, TM); FPM.add(EW); - FPM.add(createX86CodeEmitterPass(EW-getMachineCodeEmitter())); + FPM.add(createX86CodeEmitterPass(TM, EW-getMachineCodeEmitter())); } Index: llvm/lib/Target/X86/X86JITInfo.cpp diff -u llvm/lib/Target/X86/X86JITInfo.cpp:1.23 llvm/lib/Target/X86/X86JITInfo.cpp:1.24 --- llvm/lib/Target/X86/X86JITInfo.cpp:1.23 Wed Jul 5 02:09:13 2006 +++ llvm/lib/Target/X86/X86JITInfo.cpp Tue Jul 25 15:40:54 2006 @@ -203,3 +203,13 @@ } } } + +void X86JITInfo::resolveBBRefs(MachineCodeEmitter MCE) { + // Resolve all forward
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.178 - 1.179 --- Log message: Initialize some variables the compiler warns about. --- Diffs of the changes: (+2 -2) DAGCombiner.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.178 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.179 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.178 Fri Jul 21 03:25:53 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Jul 25 15:44:41 2006 @@ -2603,7 +2603,7 @@ bool isUnary = true; bool isSplat = true; int VecNum = -1; - unsigned BaseIdx; + unsigned BaseIdx = 0; for (unsigned i = 0; i != NumElts; ++i) if (ShufMask.getOperand(i).getOpcode() != ISD::UNDEF) { unsigned Idx = castConstantSDNode(ShufMask.getOperand(i))-getValue(); @@ -2722,7 +2722,7 @@ bool isUnary = true; bool isSplat = true; int VecNum = -1; - unsigned BaseIdx; + unsigned BaseIdx = 0; for (unsigned i = 0; i != NumElts; ++i) if (ShufMask.getOperand(i).getOpcode() != ISD::UNDEF) { unsigned Idx = castConstantSDNode(ShufMask.getOperand(i))-getValue(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.141 - 1.142 --- Log message: Moving this function to a permanent home to prevent a dependency cycle created by the inline heuristic. Was preventing llvm-gcc4 from building. --- Diffs of the changes: (+19 -0) Type.cpp | 19 +++ 1 files changed, 19 insertions(+) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.141 llvm/lib/VMCore/Type.cpp:1.142 --- llvm/lib/VMCore/Type.cpp:1.141 Wed Jun 28 16:38:54 2006 +++ llvm/lib/VMCore/Type.cppTue Jul 25 18:22:00 2006 @@ -33,6 +33,25 @@ AbstractTypeUser::~AbstractTypeUser() {} + +//===--===// +// Type PATypeHolder Implementation +//===--===// + +// This routine was moved here to resolve a cyclic dependency caused by +// inline heuristics. + +/// get - This implements the forwarding part of the union-find algorithm for +/// abstract types. Before every access to the Type*, we check to see if the +/// type we are pointing to is forwarding to a new type. If so, we drop our +/// reference to the type. +/// +Type* PATypeHolder::get() const { + const Type *NewTy = Ty-getForwardedType(); + if (!NewTy) return const_castType*(Ty); + return *const_castPATypeHolder*(this) = NewTy; +} + //===--===// // Type Class Implementation //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Type.h
Changes in directory llvm/include/llvm: Type.h updated: 1.87 - 1.88 --- Log message: Moving this function to a permanent home to prevent a dependency cycle created by the inline heuristic. Was preventing llvm-gcc4 from building. --- Diffs of the changes: (+0 -12) Type.h | 12 1 files changed, 12 deletions(-) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.87 llvm/include/llvm/Type.h:1.88 --- llvm/include/llvm/Type.h:1.87 Wed May 31 11:03:20 2006 +++ llvm/include/llvm/Type.hTue Jul 25 18:22:00 2006 @@ -401,18 +401,6 @@ Ty-dropRef(); } -/// get - This implements the forwarding part of the union-find algorithm for -/// abstract types. Before every access to the Type*, we check to see if the -/// type we are pointing to is forwarding to a new type. If so, we drop our -/// reference to the type. -/// -inline Type* PATypeHolder::get() const { - const Type *NewTy = Ty-getForwardedType(); - if (!NewTy) return const_castType*(Ty); - return *const_castPATypeHolder*(this) = NewTy; -} - - //===--===// // Provide specializations of GraphTraits to be able to treat a type as a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.cgi
Changes in directory nightlytest-serverside: NightlyTestAccept.cgi updated: 1.29 - 1.30 --- Log message: Fixed some syntax errors --- Diffs of the changes: (+6 -5) NightlyTestAccept.cgi | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.cgi diff -u nightlytest-serverside/NightlyTestAccept.cgi:1.29 nightlytest-serverside/NightlyTestAccept.cgi:1.30 --- nightlytest-serverside/NightlyTestAccept.cgi:1.29 Sun Jul 23 18:12:30 2006 +++ nightlytest-serverside/NightlyTestAccept.cgiTue Jul 25 19:15:04 2006 @@ -94,14 +94,16 @@ @ONE = split \n, $one; @TWO = split \n, $two; + $value=1; + my %hash_of_diff=(); foreach $x (@TWO){ - $hash_of_diff{$x}=1; + $hash_of_diff{$x}=$value; } $result=; foreach $x (@ONE){ - if($hash_of_diff{$x}!=1){ + if($hash_of_diff{$x}!=$value){ $result.=$x\n; } } @@ -381,8 +383,7 @@ if(%$row ($row-{'loc'} != $_[1] || $row-{'files'} != $_[2] || $row-{'dirs'} != $_[3])){ - my $e = $dbh-prepare(insert into code (added, loc, files, dirs) . - values (\$_[0]\, $_[1], $_[2], $_[3])); + my $e = $dbh-prepare(insert into code (added, loc, files, dirs) values (\$_[0]\, \$_[1]\, \$_[2]\, \$_[3]\)); $e-execute; } } @@ -431,7 +432,7 @@ $olden_tests= unless $olden_tests; my @OLDEN_TESTS = split $spliton, $singlesource_tests; -my $filesincvs = param('cvs_files_count'); +my $filesincvs = param('cvs_file_count'); my $dirsincvs = param('cvs_dir_count'); my $loc = param('lines_of_code'); my $nickname = param('nickname'); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: nightlytest-serverside/NightlyTester.php
Changes in directory nightlytest-serverside: NightlyTester.php updated: 1.2 - 1.3 --- Log message: Added support for pulling out .a and .o files --- Diffs of the changes: (+65 -2) NightlyTester.php | 67 -- 1 files changed, 65 insertions(+), 2 deletions(-) Index: nightlytest-serverside/NightlyTester.php diff -u nightlytest-serverside/NightlyTester.php:1.2 nightlytest-serverside/NightlyTester.php:1.3 --- nightlytest-serverside/NightlyTester.php:1.2Thu Jul 6 13:25:11 2006 +++ nightlytest-serverside/NightlyTester.phpTue Jul 25 20:09:24 2006 @@ -145,16 +145,79 @@ return $time; } +/* + * + * Purpose: get all the .a file sizes for a specific test + * Returns: An array with the name of the file being + * the index and the value being an array with the first + * element containing code size and the second element + * containing [debug|release] + * + */ +function get_a_files($mysql_link, $night_id){ + $result = mysql_query(select a_file_size from night WHERE id=$night_id) or die (mysql_error()); + $result=array(); + $files = array(); + $files = explode(\n, $result['a_file_size']); + foreach ($files as $f){ + preg_match(/(.+)\s+(.+)\s+(.+)/, $f, $matches) + $result[{$matches[0]] = array( {$matches[1], {$matches[2] ); + } + return $result; +} + +/* + * + * Purpose: get all the .o file sizes for a specific test + * Returns: An array with the name of the file being + * the index and the value being an array with the first + * element containing code size and the second element + * containing [debug|release] + * + */ +function get_o_files($mysql_link, $night_id){ + $result = mysql_query(select o_file_size from night WHERE id=$night_id) or die (mysql_error()); + $result=array(); + $files = array(); + $files = explode(\n, $result['o_file_size']); + foreach ($files as $f){ + preg_match(/(.+)\s+(.+)\s+(.+)/, $f, $matches) + $result[{$matches[0]] = array( {$matches[1], {$matches[2] ); + } + return $result; +} + +/* + * + * Purpose: Get a combined list of .a and .o file sizes + * Returns: + * + */ +function get_file_sizes($mysql_link, $night_id){ + $result = array(); + $result = merge(get_a_files($mysql_link, $night_id), get_o_files($mysql_link, $night_id)); + return $result; +} + + /* * * Example uses of each function * */ -/*$mysql_link = mysql_connect(127.0.0.1,llvm,ll2002vm); +$mysql_link = mysql_connect(127.0.0.1,llvm,ll2002vm); mysql_select_db(nightlytestresults); -$machine_info = getMachineInfo(21, $mysql_link); +$night_id = 534; + +$files = get_a_files($mysql_link, $night_id); + +foreach (array_keys($files) as $f){ + print $f = {$files['$f'][0]}br\n; +} + +/*$machine_info = getMachineInfo(21, $mysql_link); foreach (array_keys($machine_info) as $key){ print $key = {$machine_info[$key]}br\n; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits