[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.180 - 1.181 --- Log message: Fix a performance regression. Use {p}shuf* when there are only two distinct elements in a build_vector. --- Diffs of the changes: (+17 -13) X86ISelLowering.cpp | 30 +- 1 files changed, 17 insertions(+), 13 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.180 llvm/lib/Target/X86/X86ISelLowering.cpp:1.181 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.180 Fri Apr 21 18:03:30 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sat Apr 22 01:21:46 2006 @@ -3274,22 +3274,26 @@ return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V[0], V[1], ShufMask); } -// Expand into a number of unpckl*. -// e.g. for v4f32 -// Step 1: unpcklps 0, 2 == X: ?, ?, 2, 0 -// : unpcklps 1, 3 == Y: ?, ?, 3, 1 -// Step 2: unpcklps X, Y ==3, 2, 1, 0 -SDOperand UnpckMask = getUnpacklMask(NumElems, DAG); -for (unsigned i = 0; i NumElems; ++i) - V[i] = DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, Op.getOperand(i)); -NumElems = 1; -while (NumElems != 0) { +if (Values.size() 2) { + // Expand into a number of unpckl*. + // e.g. for v4f32 + // Step 1: unpcklps 0, 2 == X: ?, ?, 2, 0 + // : unpcklps 1, 3 == Y: ?, ?, 3, 1 + // Step 2: unpcklps X, Y ==3, 2, 1, 0 + SDOperand UnpckMask = getUnpacklMask(NumElems, DAG); for (unsigned i = 0; i NumElems; ++i) -V[i] = DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V[i], V[i + NumElems], - UnpckMask); +V[i] = DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, Op.getOperand(i)); NumElems = 1; + while (NumElems != 0) { +for (unsigned i = 0; i NumElems; ++i) + V[i] = DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V[i], V[i + NumElems], + UnpckMask); +NumElems = 1; + } + return V[0]; } -return V[0]; + +return SDOperand(); } case ISD::EXTRACT_VECTOR_ELT: { if (!isaConstantSDNode(Op.getOperand(1))) ___ 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/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.181 - 1.182 --- Log message: Don't do all the lowering stuff for 2-wide build_vector's. Also, minor optimization for shuffle of undef. --- Diffs of the changes: (+5 -2) X86ISelLowering.cpp |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.181 llvm/lib/Target/X86/X86ISelLowering.cpp:1.182 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.181 Sat Apr 22 01:21:46 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sat Apr 22 03:34:05 2006 @@ -2977,8 +2977,8 @@ ShouldXformToMOVLP(V1.Val, PermMask.Val)) return CommuteVectorShuffle(Op, DAG); -bool V1IsSplat = isSplatVector(V1.Val); -bool V2IsSplat = isSplatVector(V2.Val); +bool V1IsSplat = isSplatVector(V1.Val) || V1.getOpcode() == ISD::UNDEF; +bool V2IsSplat = isSplatVector(V2.Val) || V2.getOpcode() == ISD::UNDEF; if (V1IsSplat !V2IsSplat) { Op = CommuteVectorShuffle(Op, DAG); V1 = Op.getOperand(0); @@ -3137,6 +3137,9 @@ return Op; unsigned NumElems = Op.getNumOperands(); +if (NumElems == 2) + return SDOperand(); + unsigned Half = NumElems/2; MVT::ValueType VT = Op.getValueType(); MVT::ValueType EVT = MVT::getVectorBaseType(VT); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.79 - 1.80 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+4 -1) ExecutionEngine.cpp |5 - 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.79 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.80 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.79 Sat Apr 22 00:02:46 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppSat Apr 22 13:53:45 2006 @@ -328,7 +328,10 @@ return Result; } -/// FIXME: document +/// StoreValueToMemory - Stores the data in Val of type Ty at address Ptr. Ptr +/// is the address of the memory at which to store Val, cast to GenericValue *. +/// It is not a pointer to a GenericValue containing the address at which to +/// store Val. /// void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, const Type *Ty) { ___ 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/AlphaAsmPrinter.cpp AlphaISelLowering.cpp
Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.33 - 1.34 AlphaISelLowering.cpp updated: 1.46 - 1.47 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+3 -7) AlphaAsmPrinter.cpp |9 ++--- AlphaISelLowering.cpp |1 + 2 files changed, 3 insertions(+), 7 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.33 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.34 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.33 Thu Mar 9 00:14:35 2006 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Sat Apr 22 13:53:45 2006 @@ -115,14 +115,9 @@ abort(); return; - case MachineOperand::MO_MachineBasicBlock: { -MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); -O PrivateGlobalPrefix LBB - Mang-getValueName(MBBOp-getParent()-getFunction()) - _ MBBOp-getNumber() \t CommentString - MBBOp-getBasicBlock()-getName(); + case MachineOperand::MO_MachineBasicBlock: +printBasicBlockLabel(MO.getMachineBasicBlock()); return; - } case MachineOperand::MO_ConstantPoolIndex: O PrivateGlobalPrefix CPI getFunctionNumber() _ Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.46 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.47 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.46Thu Apr 6 18:18:45 2006 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Sat Apr 22 13:53:45 2006 @@ -193,6 +193,7 @@ addRegisterClass(MVT::f64, Alpha::F8RCRegisterClass); addRegisterClass(MVT::f32, Alpha::F4RCRegisterClass); + setOperationAction(ISD::BRIND,MVT::i64, Expand); setOperationAction(ISD::BR_CC,MVT::Other, Expand); setOperationAction(ISD::SELECT_CC,MVT::Other, Expand); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.196 - 1.197 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+1 -0) DAGISelEmitter.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.196 llvm/utils/TableGen/DAGISelEmitter.cpp:1.197 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.196Wed Apr 19 15:36:09 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Sat Apr 22 13:53:45 2006 @@ -3225,6 +3225,7 @@ case ISD::TargetConstant:\n case ISD::TargetConstantPool:\n case ISD::TargetFrameIndex:\n +case ISD::TargetJumpTable:\n case ISD::TargetGlobalAddress: {\n Result = N;\n return;\n ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h AsmPrinter.h MachineCodeEmitter.h MachineFunction.h MachineInstr.h ScheduleDAG.h SelectionDAG.h SelectionDAGISel.h SelectionDAGNod
Changes in directory llvm/include/llvm/CodeGen: MachineJumpTableInfo.h added (r1.1) AsmPrinter.h updated: 1.31 - 1.32 MachineCodeEmitter.h updated: 1.28 - 1.29 MachineFunction.h updated: 1.58 - 1.59 MachineInstr.h updated: 1.167 - 1.168 ScheduleDAG.h updated: 1.22 - 1.23 SelectionDAG.h updated: 1.100 - 1.101 SelectionDAGISel.h updated: 1.12 - 1.13 SelectionDAGNodes.h updated: 1.129 - 1.130 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+181 -4) AsmPrinter.h | 14 + MachineCodeEmitter.h | 18 MachineFunction.h | 10 ++ MachineInstr.h | 18 +++- MachineJumpTableInfo.h | 73 + ScheduleDAG.h |1 SelectionDAG.h |5 ++- SelectionDAGISel.h | 20 - SelectionDAGNodes.h| 26 - 9 files changed, 181 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -c /dev/null llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.1 *** /dev/null Sat Apr 22 13:53:55 2006 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.hSat Apr 22 13:53:45 2006 *** *** 0 --- 1,73 + //===-- CodeGen/MachineJumpTableInfo.h - Abstract Jump Tables --*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Nate Begeman and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // The MachineJumpTableInfo class keeps track of jump tables referenced by + // lowered switch instructions in the MachineFunction. + // + // Instructions reference the address of these jump tables through the use of + // MO_JumpTableIndex values. When emitting assembly or machine code, these + // virtual address references are converted to refer to the address of the + // function jump tables. + // + //===--===// + + #ifndef LLVM_CODEGEN_MACHINEJUMPTABLEINFO_H + #define LLVM_CODEGEN_MACHINEJUMPTABLEINFO_H + + #include llvm/Target/TargetData.h + #include vector + #include iosfwd + + namespace llvm { + + class MachineBasicBlock; + + /// MachineJumpTableEntry - One jump table in the jump table info. + /// + struct MachineJumpTableEntry { + /// MBBs - The vector of basic blocks from which to create the jump table. + std::vectorMachineBasicBlock* MBBs; + + MachineJumpTableEntry(std::vectorMachineBasicBlock* M) : MBBs(M) {} + }; + + class MachineJumpTableInfo { + const TargetData TD; + std::vectorMachineJumpTableEntry JumpTables; + public: + MachineJumpTableInfo(const TargetData td) : TD(td) {} + + /// getJumpTableIndex - Create a new jump table or return an existing one. + /// + unsigned getJumpTableIndex(std::vectorMachineBasicBlock* DestBBs); + + /// isEmpty - Return true if there are no jump tables. + /// + bool isEmpty() const { return JumpTables.empty(); } + + const std::vectorMachineJumpTableEntry getJumpTables() const { + return JumpTables; + } + + unsigned getEntrySize() const { return TD.getPointerSize(); } + unsigned getAlignment() const { return TD.getPointerAlignment(); } + + /// print - Used by the MachineFunction printer to print information about + /// jump tables. Implemented in MachineFunction.cpp + /// + void print(std::ostream OS) const; + + /// dump - Call print(std::cerr) to be called from the debugger. + /// + void dump() const; + }; + + } // End llvm namespace + + #endif Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.31 llvm/include/llvm/CodeGen/AsmPrinter.h:1.32 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.31 Fri Feb 24 14:21:12 2006 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Sat Apr 22 13:53:45 2006 @@ -140,6 +140,10 @@ /// before emitting the constant pool for a function. const char *ConstantPoolSection; // Defaults to \t.section .rodata\n +/// JumpTableSection - This is the section that we SwitchToSection right +/// before emitting the jump tables for a function. +const char *JumpTableSection; // Defaults to \t.section .rodata\n + /// StaticCtorsSection - This is the directive that is emitted to switch to /// a section to emit the static constructor list. /// Defaults to \t.section .ctors,\aw\,@progbits. @@ -231,6 +235,11 @@ /// void EmitConstantPool(MachineConstantPool *MCP); +/// EmitJumpTableInfo - Print assembly representations of the jump tables +/// used by the
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCCodeEmitter.cpp PPCISelDAGToDAG.cpp PPCISelLowering.cpp PPCInstrInfo.td
Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.163 - 1.164 PPCCodeEmitter.cpp updated: 1.52 - 1.53 PPCISelDAGToDAG.cpp updated: 1.179 - 1.180 PPCISelLowering.cpp updated: 1.167 - 1.168 PPCInstrInfo.td updated: 1.217 - 1.218 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+79 -14) PPCAsmPrinter.cpp | 25 +++-- PPCCodeEmitter.cpp | 15 ++- PPCISelDAGToDAG.cpp | 15 +-- PPCISelLowering.cpp | 32 PPCInstrInfo.td |6 +- 5 files changed, 79 insertions(+), 14 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.163 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.164 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.163 Fri Apr 7 15:44:42 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Sat Apr 22 13:53:45 2006 @@ -233,6 +233,8 @@ printOperand(MI, OpNo+1); } +virtual void printBasicBlockLabel(const MachineBasicBlock *MBB) const; + virtual bool runOnMachineFunction(MachineFunction F) = 0; virtual bool doFinalization(Module M) = 0; @@ -277,6 +279,8 @@ Data64bitsDirective = 0; // we can't emit a 64-bit unit AlignmentIsInBytes = false;// Alignment is by power of 2. ConstantPoolSection = \t.const\t; + // FIXME: Conditionalize jump table section based on PIC + JumpTableSection = .const; LCOMMDirective = \t.lcomm\t; StaticCtorsSection = .mod_init_func; StaticDtorsSection = .mod_term_func; @@ -373,13 +377,14 @@ abort(); return; - case MachineOperand::MO_MachineBasicBlock: { -MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); -O PrivateGlobalPrefix BB getFunctionNumber() _ - MBBOp-getNumber() \t; MBBOp-getBasicBlock()-getName(); + case MachineOperand::MO_MachineBasicBlock: +printBasicBlockLabel(MO.getMachineBasicBlock()); +return; + case MachineOperand::MO_JumpTableIndex: +O PrivateGlobalPrefix JTI getFunctionNumber() + '_' MO.getJumpTableIndex(); +// FIXME: PIC relocation model return; - } - case MachineOperand::MO_ConstantPoolIndex: O PrivateGlobalPrefix CPI getFunctionNumber() '_' MO.getConstantPoolIndex(); @@ -500,6 +505,11 @@ return; } +void PPCAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB) const { + O PrivateGlobalPrefix BB getFunctionNumber() _ + MBB-getNumber() '\t' CommentString + MBB-getBasicBlock()-getName(); +} /// runOnMachineFunction - This uses the printMachineInstruction() /// method to print assembly for each instruction. @@ -514,6 +524,9 @@ // 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()) { Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.52 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.53 --- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.52 Sat Apr 22 01:17:56 2006 +++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Sat Apr 22 13:53:45 2006 @@ -34,7 +34,7 @@ // Tracks which instruction references which BasicBlock std::vectorstd::pairMachineBasicBlock*, unsigned* BBRefs; // Tracks where each BasicBlock starts -std::mapMachineBasicBlock*, long BBLocations; +std::mapMachineBasicBlock*, uint64_t BBLocations; /// getMachineOpValue - evaluates the MachineOperand of a given MachineInstr /// @@ -91,8 +91,10 @@ JIT relocation model must be set to static or default!); MCE.startFunction(MF); MCE.emitConstantPool(MF.getConstantPool()); + MCE.initJumpTableInfo(MF.getJumpTableInfo()); for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); BB != E; ++BB) emitBasicBlock(*BB); + MCE.emitJumpTableInfo(MF.getJumpTableInfo(), BBLocations); MCE.finishFunction(MF); // Resolve branches to BasicBlocks for the entire function @@ -192,10 +194,13 @@ } else if (MO.isMachineBasicBlock()) { unsigned* CurrPC = (unsigned*)(intptr_t)MCE.getCurrentPCValue(); BBRefs.push_back(std::make_pair(MO.getMachineBasicBlock(), CurrPC)); - } else if (MO.isConstantPoolIndex()) { -unsigned index = MO.getConstantPoolIndex(); + } else if (MO.isConstantPoolIndex() || MO.isJumpTableIndex()) { +if (MO.isConstantPoolIndex()) + rv = MCE.getConstantPoolEntryAddress(MO.getConstantPoolIndex()); +else + rv =
[llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td
Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.66 - 1.67 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+9 -0) TargetSelectionDAG.td |9 + 1 files changed, 9 insertions(+) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.66 llvm/lib/Target/TargetSelectionDAG.td:1.67 --- llvm/lib/Target/TargetSelectionDAG.td:1.66 Wed Apr 19 15:38:28 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Sat Apr 22 13:53:45 2006 @@ -150,6 +150,10 @@ SDTCisInt0, SDTCisVT1, OtherVT ]; +def SDTBrind : SDTypeProfile0, 1, [ // brind + SDTCisPtrTy0 +]; + def SDTRet : SDTypeProfile0, 0, []; // ret def SDTLoad : SDTypeProfile1, 1, [ // load @@ -217,6 +221,10 @@ ConstantPoolSDNode; def tconstpool : SDNodeISD::TargetConstantPool, SDTPtrLeaf, [], ConstantPoolSDNode; +def jumptable : SDNodeISD::JumpTable,SDTPtrLeaf, [], + JumpTableSDNode; +def tjumptable : SDNodeISD::TargetJumpTable, SDTPtrLeaf, [], + JumpTableSDNode; def frameindex : SDNodeISD::FrameIndex, SDTPtrLeaf, [], FrameIndexSDNode; def tframeindex : SDNodeISD::TargetFrameIndex, SDTPtrLeaf, [], @@ -293,6 +301,7 @@ def selectcc : SDNodeISD::SELECT_CC , SDTSelectCC; def brcond : SDNodeISD::BRCOND , SDTBrcond, [SDNPHasChain]; +def brind : SDNodeISD::BRIND , SDTBrind, [SDNPHasChain]; def br : SDNodeISD::BR , SDTBr, [SDNPHasChain]; def ret: SDNodeISD::RET, SDTRet,[SDNPHasChain]; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.82 - 1.83 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+82 -1) JITEmitter.cpp | 83 - 1 files changed, 82 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.82 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.83 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.82Wed Feb 8 22:49:59 2006 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Sat Apr 22 13:53:45 2006 @@ -20,7 +20,9 @@ #include llvm/CodeGen/MachineCodeEmitter.h #include llvm/CodeGen/MachineFunction.h #include llvm/CodeGen/MachineConstantPool.h +#include llvm/CodeGen/MachineJumpTableInfo.h #include llvm/CodeGen/MachineRelocation.h +#include llvm/ExecutionEngine/GenericValue.h #include llvm/Target/TargetData.h #include llvm/Target/TargetJITInfo.h #include llvm/Support/Debug.h @@ -430,7 +432,15 @@ /// ConstantPoolBase - A pointer to the first entry in the constant pool. /// void *ConstantPoolBase; - public: + +/// ConstantPool - The constant pool for the current function. +/// +MachineJumpTableInfo *JumpTable; + +/// JumpTableBase - A pointer to the first entry in the jump table. +/// +void *JumpTableBase; +public: JITEmitter(JIT jit) : MemMgr(jit.getJITInfo().needsGOT()) { TheJIT = jit; DEBUG(std::cerr @@ -441,6 +451,9 @@ virtual void startFunction(MachineFunction F); virtual void finishFunction(MachineFunction F); virtual void emitConstantPool(MachineConstantPool *MCP); +virtual void initJumpTableInfo(MachineJumpTableInfo *MJTI); +virtual void emitJumpTableInfo(MachineJumpTableInfo *MJTI, + std::mapMachineBasicBlock*,uint64_t MBBM); virtual void startFunctionStub(unsigned StubSize); virtual void* finishFunctionStub(const Function *F); virtual void emitByte(unsigned char B); @@ -454,6 +467,7 @@ virtual uint64_t getCurrentPCValue(); virtual uint64_t getCurrentPCOffset(); virtual uint64_t getConstantPoolEntryAddress(unsigned Entry); +virtual uint64_t getJumpTableEntryAddress(unsigned Entry); virtual unsigned char* allocateGlobal(unsigned size, unsigned alignment); private: @@ -583,6 +597,57 @@ } } +void JITEmitter::initJumpTableInfo(MachineJumpTableInfo *MJTI) { + const std::vectorMachineJumpTableEntry JT = MJTI-getJumpTables(); + if (JT.empty()) return; + + unsigned Size = 0; + unsigned EntrySize = MJTI-getEntrySize(); + for (unsigned i = 0, e = JT.size(); i != e; ++i) +Size += JT[i].MBBs.size() * EntrySize; + + // Just allocate space for all the jump tables now. We will fix up the actual + // MBB entries in the tables after we emit the code for each block, since then + // we will know the final locations of the MBBs in memory. + JumpTable = MJTI; + JumpTableBase = MemMgr.allocateConstant(Size, MJTI-getAlignment()); +} + +void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI, + std::mapMachineBasicBlock*,uint64_t MBBM){ + const std::vectorMachineJumpTableEntry JT = MJTI-getJumpTables(); + if (JT.empty()) return; + + unsigned Offset = 0; + unsigned EntrySize = MJTI-getEntrySize(); + + // For each jump table, map each target in the jump table to the address of + // an emitted MachineBasicBlock. + for (unsigned i = 0, e = JT.size(); i != e; ++i) { +const std::vectorMachineBasicBlock* MBBs = JT[i].MBBs; +for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi) { + uint64_t addr = MBBM[MBBs[mi]]; + GenericValue addrgv; + const Type *Ty; + if (EntrySize == 4) { +addrgv.UIntVal = addr; +Ty = Type::UIntTy; + } else if (EntrySize == 8) { +addrgv.ULongVal = addr; +Ty = Type::ULongTy; + } else { +assert(0 Unhandled jump table entry size!); +abort(); + } + // Store the address of the basic block for this jump table slot in the + // memory we allocated for the jump table in 'initJumpTableInfo' + void *ptr = (void *)((char *)JumpTableBase + Offset); + TheJIT-StoreValueToMemory(addrgv, (GenericValue *)ptr, Ty); + Offset += EntrySize; +} + } +} + void JITEmitter::startFunctionStub(unsigned StubSize) { SavedCurBlock = CurBlock; SavedCurByte = CurByte; CurByte = CurBlock = MemMgr.allocateStub(StubSize); @@ -621,6 +686,22 @@ ConstantPool-getConstants()[ConstantNum].Offset; } +// getJumpTableEntryAddress - Return the address of the JumpTable with index +// 'Index' in the jumpp table that was last
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp ELFWriter.cpp MachineCodeEmitter.cpp MachineFunction.cpp MachineInstr.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.58 - 1.59 ELFWriter.cpp updated: 1.17 - 1.18 MachineCodeEmitter.cpp updated: 1.25 - 1.26 MachineFunction.cpp updated: 1.87 - 1.88 MachineInstr.cpp updated: 1.110 - 1.111 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+96 -3) AsmPrinter.cpp | 38 ++ ELFWriter.cpp |5 - MachineCodeEmitter.cpp | 14 -- MachineFunction.cpp| 36 MachineInstr.cpp |6 ++ 5 files changed, 96 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.58 llvm/lib/CodeGen/AsmPrinter.cpp:1.59 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.58Tue Mar 7 16:00:35 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Sat Apr 22 13:53:45 2006 @@ -17,6 +17,7 @@ #include llvm/Constants.h #include llvm/Module.h #include llvm/CodeGen/MachineConstantPool.h +#include llvm/CodeGen/MachineJumpTableInfo.h #include llvm/Support/Mangler.h #include llvm/Support/MathExtras.h #include llvm/Target/TargetMachine.h @@ -46,6 +47,7 @@ AlignmentIsInBytes(true), SwitchToSectionDirective(\t.section\t), ConstantPoolSection(\t.section .rodata\n), + JumpTableSection(\t.section .rodata\n), StaticCtorsSection(\t.section .ctors,\aw\,@progbits), StaticDtorsSection(\t.section .dtors,\aw\,@progbits), LCOMMDirective(0), @@ -127,6 +129,33 @@ } } +/// EmitJumpTableInfo - Print assembly representations of the jump tables used +/// by the current function to the current output stream. +/// +void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI) { + const std::vectorMachineJumpTableEntry JT = MJTI-getJumpTables(); + if (JT.empty()) return; + const TargetData TD = TM.getTargetData(); + + // FIXME: someday we need to handle PIC jump tables + assert((TM.getRelocationModel() == Reloc::Static || + TM.getRelocationModel() == Reloc::DynamicNoPIC) + Unhandled relocation model emitting jump table information!); + + SwitchSection(JumpTableSection, 0); + EmitAlignment(Log2_32(TD.getPointerAlignment())); + for (unsigned i = 0, e = JT.size(); i != e; ++i) { +O PrivateGlobalPrefix JTI getFunctionNumber() '_' i + :\n; +const std::vectorMachineBasicBlock* JTBBs = JT[i].MBBs; +for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) { + O Data32bitsDirective ' '; + printBasicBlockLabel(JTBBs[ii]); + O '\n'; +} + } +} + /// EmitSpecialLLVMGlobal - Check to see if the specified global is a /// special global used by LLVM. If so, emit it and return true, otherwise /// do nothing and return false. @@ -654,3 +683,12 @@ // Target doesn't support this yet! return true; } + +/// printBasicBlockLabel - This method prints the label for the specified +/// MachineBasicBlock +void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB) const { + O PrivateGlobalPrefix LBB + Mang-getValueName(MBB-getParent()-getFunction()) + _ MBB-getNumber() '\t' CommentString + MBB-getBasicBlock()-getName(); +} Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.17 llvm/lib/CodeGen/ELFWriter.cpp:1.18 --- llvm/lib/CodeGen/ELFWriter.cpp:1.17 Wed Dec 28 00:29:02 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Sat Apr 22 13:53:45 2006 @@ -84,7 +84,10 @@ assert(0 CP not implementated yet!); return 0; } - +virtual uint64_t getJumpTableEntryAddress(unsigned Index) { + assert(0 JT not implementated yet!); + return 0; +} virtual unsigned char* allocateGlobal(unsigned size, unsigned alignment) { assert(0 Globals not implemented yet!); return 0; Index: llvm/lib/CodeGen/MachineCodeEmitter.cpp diff -u llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.25 llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.26 --- llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.25Tue Dec 27 20:44:35 2005 +++ llvm/lib/CodeGen/MachineCodeEmitter.cpp Sat Apr 22 13:53:45 2006 @@ -56,6 +56,7 @@ { return 0; } uint64_t getConstantPoolEntryAddress(unsigned Num) { return 0; } +uint64_t getJumpTableEntryAddress(unsigned Num) { return 0; } uint64_t getCurrentPCValue() { return 0; } uint64_t getCurrentPCOffset() { return 0; } }; @@ -97,7 +98,14 @@ void emitConstantPool(MachineConstantPool *MCP) { MCE.emitConstantPool(MCP); } - +void initJumpTableInfo(MachineJumpTableInfo *MJTI) { + MCE.initJumpTableInfo(MJTI); +} +void emitJumpTableInfo(MachineJumpTableInfo *MJTI, + std::mapMachineBasicBlock*,uint64_t MBBM) { + MCE.emitJumpTableInfo(MJTI,
[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp SparcISelDAGToDAG.cpp
Changes in directory llvm/lib/Target/Sparc: SparcAsmPrinter.cpp updated: 1.57 - 1.58 SparcISelDAGToDAG.cpp updated: 1.91 - 1.92 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+3 -6) SparcAsmPrinter.cpp |8 ++-- SparcISelDAGToDAG.cpp |1 + 2 files changed, 3 insertions(+), 6 deletions(-) Index: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp diff -u llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.57 llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.58 --- llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.57 Thu Mar 9 00:14:35 2006 +++ llvm/lib/Target/Sparc/SparcAsmPrinter.cpp Sat Apr 22 13:53:45 2006 @@ -163,13 +163,9 @@ case MachineOperand::MO_UnextendedImmed: O (int)MO.getImmedValue(); break; - case MachineOperand::MO_MachineBasicBlock: { -MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); -O .LBB Mang-getValueName(MBBOp-getParent()-getFunction()) - _ MBBOp-getNumber () \t! - MBBOp-getBasicBlock ()-getName (); + case MachineOperand::MO_MachineBasicBlock: +printBasicBlockLabel(MO.getMachineBasicBlock()); return; - } case MachineOperand::MO_PCRelativeDisp: std::cerr Shouldn't use addPCDisp() when building Sparc MachineInstrs; abort (); Index: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp diff -u llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.91 llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.92 --- llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.91Sun Mar 26 19:32:24 2006 +++ llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Sat Apr 22 13:53:45 2006 @@ -167,6 +167,7 @@ // Sparc doesn't have BRCOND either, it has BR_CC. setOperationAction(ISD::BRCOND, MVT::Other, Expand); + setOperationAction(ISD::BRIND, MVT::i32, Expand); setOperationAction(ISD::BR_CC, MVT::i32, Custom); setOperationAction(ISD::BR_CC, MVT::f32, Custom); setOperationAction(ISD::BR_CC, MVT::f64, Custom); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/IA64/IA64AsmPrinter.cpp IA64ISelLowering.cpp
Changes in directory llvm/lib/Target/IA64: IA64AsmPrinter.cpp updated: 1.25 - 1.26 IA64ISelLowering.cpp updated: 1.36 - 1.37 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+3 -7) IA64AsmPrinter.cpp |9 ++--- IA64ISelLowering.cpp |1 + 2 files changed, 3 insertions(+), 7 deletions(-) Index: llvm/lib/Target/IA64/IA64AsmPrinter.cpp diff -u llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.25 llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.26 --- llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.25Mon Mar 13 17:20:37 2006 +++ llvm/lib/Target/IA64/IA64AsmPrinter.cpp Sat Apr 22 13:53:45 2006 @@ -189,14 +189,9 @@ case MachineOperand::MO_UnextendedImmed: O /*(unsigned int)*/MO.getImmedValue(); return; - case MachineOperand::MO_MachineBasicBlock: { -MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); -O PrivateGlobalPrefix LBB - Mang-getValueName(MBBOp-getParent()-getFunction()) - _ MBBOp-getNumber () \t// - MBBOp-getBasicBlock ()-getName (); + case MachineOperand::MO_MachineBasicBlock: +printBasicBlockLabel(MO.getMachineBasicBlock()); return; - } case MachineOperand::MO_PCRelativeDisp: std::cerr Shouldn't use addPCDisp() when building IA64 MachineInstrs; abort (); Index: llvm/lib/Target/IA64/IA64ISelLowering.cpp diff -u llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.36 llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.37 --- llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.36 Thu Mar 16 19:40:33 2006 +++ llvm/lib/Target/IA64/IA64ISelLowering.cpp Sat Apr 22 13:53:45 2006 @@ -35,6 +35,7 @@ // register class for predicate registers addRegisterClass(MVT::i1, IA64::PRRegisterClass); + setOperationAction(ISD::BRIND, MVT::i64, Expand); setOperationAction(ISD::BR_CC, MVT::Other, Expand); setOperationAction(ISD::FP_ROUND_INREG , MVT::f32 , Expand); ___ 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/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86CodeEmitter.cpp X86ISelLowering.cpp X86InstrInfo.td X86IntelAsmPrinter.cpp
Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.33 - 1.34 X86AsmPrinter.cpp updated: 1.172 - 1.173 X86AsmPrinter.h updated: 1.14 - 1.15 X86CodeEmitter.cpp updated: 1.93 - 1.94 X86ISelLowering.cpp updated: 1.182 - 1.183 X86InstrInfo.td updated: 1.260 - 1.261 X86IntelAsmPrinter.cpp updated: 1.26 - 1.27 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+71 -26) X86ATTAsmPrinter.cpp | 20 +--- X86AsmPrinter.cpp |9 + X86AsmPrinter.h|2 ++ X86CodeEmitter.cpp | 24 +++- X86ISelLowering.cpp| 19 +-- X86InstrInfo.td| 14 +- X86IntelAsmPrinter.cpp |9 ++--- 7 files changed, 71 insertions(+), 26 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.33 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.34 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.33 Fri Apr 7 15:44:42 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppSat Apr 22 13:53:45 2006 @@ -38,6 +38,9 @@ // 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()) { @@ -120,18 +123,21 @@ O '$'; O (int)MO.getImmedValue(); return; - case MachineOperand::MO_MachineBasicBlock: { -MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); -O PrivateGlobalPrefix BB - Mang-getValueName(MBBOp-getParent()-getFunction()) - _ MBBOp-getNumber () \t# - MBBOp-getBasicBlock ()-getName (); + case MachineOperand::MO_MachineBasicBlock: +printBasicBlockLabel(MO.getMachineBasicBlock()); return; - } case MachineOperand::MO_PCRelativeDisp: std::cerr Shouldn't use addPCDisp() when building X86 MachineInstrs; abort (); return; + case MachineOperand::MO_JumpTableIndex: { +bool isMemOp = Modifier !strcmp(Modifier, mem); +if (!isMemOp) O '$'; +O PrivateGlobalPrefix JTI getFunctionNumber() _ + MO.getJumpTableIndex(); +// FIXME: PIC relocation model +return; + } case MachineOperand::MO_ConstantPoolIndex: { bool isMemOp = Modifier !strcmp(Modifier, mem); if (!isMemOp) O '$'; Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.172 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.173 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.172 Thu Mar 23 12:09:44 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Sat Apr 22 13:53:45 2006 @@ -54,6 +54,7 @@ ZeroDirective = \t.space\t; // .space N emits N zeros. PrivateGlobalPrefix = L; // Marker for constant pool idxs ConstantPoolSection = \t.const\n; +JumpTableSection = \t.const\n; // FIXME: depends on PIC mode LCOMMDirective = \t.lcomm\t; COMMDirectiveTakesAlignment = false; HasDotTypeDotSizeDirective = false; @@ -205,6 +206,14 @@ return false; // success } +void X86SharedAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB) + const { + O PrivateGlobalPrefix BB + Mang-getValueName(MBB-getParent()-getFunction()) + _ MBB-getNumber() '\t' CommentString + MBB-getBasicBlock()-getName(); +} + /// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code /// for a MachineFunction to the given output stream, using the given target /// machine description. Index: llvm/lib/Target/X86/X86AsmPrinter.h diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.14 llvm/lib/Target/X86/X86AsmPrinter.h:1.15 --- llvm/lib/Target/X86/X86AsmPrinter.h:1.14Mon Mar 13 17:20:37 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.h Sat Apr 22 13:53:45 2006 @@ -88,6 +88,8 @@ MI-getOperand(Op+3).isGlobalAddress() || MI-getOperand(Op+3).isConstantPoolIndex()); } + + virtual void printBasicBlockLabel(const MachineBasicBlock *MBB) const; }; } // end namespace llvm Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.93 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.94 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.93 Tue Mar 21 20:52:03 2006 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Sat Apr 22 13:53:45 2006 @@ -35,8 +35,8 @@ class Emitter : public MachineFunctionPass { const X86InstrInfo *II; MachineCodeEmitter MCE; -std::mapconst MachineBasicBlock*, unsigned BasicBlockAddrs; -std::vectorstd::pairconst MachineBasicBlock *, unsigned BBRefs; +std::mapMachineBasicBlock*, uint64_t BasicBlockAddrs; +
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ScheduleDAG.cpp SelectionDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.369 - 1.370 ScheduleDAG.cpp updated: 1.81 - 1.82 SelectionDAG.cpp updated: 1.301 - 1.302 SelectionDAGISel.cpp updated: 1.223 - 1.224 --- Log message: JumpTable support! What this represents is working asm and jit support for x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. --- Diffs of the changes: (+185 -8) LegalizeDAG.cpp | 20 ++- ScheduleDAG.cpp |3 + SelectionDAG.cpp | 26 + SelectionDAGISel.cpp | 144 --- 4 files changed, 185 insertions(+), 8 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.369 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.370 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.369 Wed Apr 19 18:17:50 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Apr 22 13:53:45 2006 @@ -510,6 +510,7 @@ case ISD::Register: case ISD::BasicBlock: case ISD::TargetFrameIndex: + case ISD::TargetJumpTable: case ISD::TargetConstant: case ISD::TargetConstantFP: case ISD::TargetConstantPool: @@ -552,7 +553,8 @@ abort(); case ISD::GlobalAddress: case ISD::ExternalSymbol: - case ISD::ConstantPool: // Nothing to do. + case ISD::ConstantPool: + case ISD::JumpTable: // Nothing to do. switch (TLI.getOperationAction(Node-getOpcode(), Node-getValueType(0))) { default: assert(0 This action is not supported yet!); case TargetLowering::Custom: @@ -1183,7 +1185,21 @@ Result = DAG.UpdateNodeOperands(Result, Tmp1, Node-getOperand(1)); break; - + case ISD::BRIND: +Tmp1 = LegalizeOp(Node-getOperand(0)); // Legalize the chain. +// Ensure that libcalls are emitted before a branch. +Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END); +Tmp1 = LegalizeOp(Tmp1); +LastCALLSEQ_END = DAG.getEntryNode(); + +switch (getTypeAction(Node-getOperand(1).getValueType())) { +default: assert(0 Indirect target must be legal type (pointer)!); +case Legal: + Tmp2 = LegalizeOp(Node-getOperand(1)); // Legalize the condition. + break; +} +Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2); +break; case ISD::BRCOND: Tmp1 = LegalizeOp(Node-getOperand(0)); // Legalize the chain. // Ensure that libcalls are emitted before a return. Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.81 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.82 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.81 Fri Mar 24 01:15:07 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Sat Apr 22 13:53:45 2006 @@ -117,6 +117,9 @@ } else if (FrameIndexSDNode *FI = dyn_castFrameIndexSDNode(Op)) { MI-addFrameIndexOperand(FI-getIndex()); + } else if (JumpTableSDNode *JT = + dyn_castJumpTableSDNode(Op)) { +MI-addJumpTableIndexOperand(JT-getIndex()); } else if (ConstantPoolSDNode *CP = dyn_castConstantPoolSDNode(Op)) { int Offset = CP-getOffset(); Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.301 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.302 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.301Thu Apr 20 00:39:12 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Apr 22 13:53:45 2006 @@ -387,6 +387,13 @@ case ISD::TargetFrameIndex: Erased = TargetFrameIndices.erase(castFrameIndexSDNode(N)-getIndex()); break; + case ISD::JumpTable: +Erased = JumpTableIndices.erase(castJumpTableSDNode(N)-getIndex()); +break; + case ISD::TargetJumpTable: +Erased = + TargetJumpTableIndices.erase(castJumpTableSDNode(N)-getIndex()); +break; case ISD::ConstantPool: Erased = ConstantPoolIndices. erase(std::make_pair(castConstantPoolSDNode(N)-get(), @@ -741,6 +748,22 @@ return SDOperand(N, 0); } +SDOperand SelectionDAG::getJumpTable(int JTI, MVT::ValueType VT) { + SDNode *N = JumpTableIndices[JTI]; + if (N) return SDOperand(N, 0); + N = new JumpTableSDNode(JTI, VT, false); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getTargetJumpTable(int JTI, MVT::ValueType VT) { + SDNode *N = TargetJumpTableIndices[JTI]; + if (N) return SDOperand(N, 0); + N = new JumpTableSDNode(JTI, VT, true); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + SDOperand SelectionDAG::getConstantPool(Constant *C, MVT::ValueType VT, unsigned Alignment, int Offset) { SDNode *N = ConstantPoolIndices[std::make_pair(C, @@ -2742,6 +2765,7 @@ case ISD::ConstantFP:return ConstantFP;
[llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td
Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.261 - 1.262 --- Log message: Optimized stores to the constant pool, while cool, are unnecessary. --- Diffs of the changes: (+0 -3) X86InstrInfo.td |3 --- 1 files changed, 3 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.261 llvm/lib/Target/X86/X86InstrInfo.td:1.262 --- llvm/lib/Target/X86/X86InstrInfo.td:1.261 Sat Apr 22 13:53:45 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Sat Apr 22 17:31:45 2006 @@ -2323,9 +2323,6 @@ def : Pat(add R32:$src1, (X86Wrapper texternalsym:$src2)), (ADD32ri R32:$src1, texternalsym:$src2); -// FIXME: can you really ever store to a constant pool? -def : Pat(store (X86Wrapper tconstpool:$src), addr:$dst), - (MOV32mi addr:$dst, tconstpool:$src); def : Pat(store (X86Wrapper tglobaladdr:$src), addr:$dst), (MOV32mi addr:$dst, tglobaladdr:$src); def : Pat(store (X86Wrapper texternalsym:$src), addr:$dst), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.224 - 1.225 --- Log message: Turn of jump tables for a bit, there are still some issues to work out with updating the machine CFG. --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.224 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.225 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.224Sat Apr 22 13:53:45 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Apr 22 18:51:56 2006 @@ -891,7 +891,7 @@ // FIXME: Make this work with 64 bit targets someday, possibly by always // doing differences there so that entries stay 32 bits. // FIXME: Make this work with PIC code - if (TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) + if (0 TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) TLI.getPointerTy() == MVT::i32 (Relocs == Reloc::Static || Relocs == Reloc::DynamicNoPIC) Cases.size() 3) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeEmitter.h MachineJumpTableInfo.h
Changes in directory llvm/include/llvm/CodeGen: MachineCodeEmitter.h updated: 1.29 - 1.30 MachineJumpTableInfo.h updated: 1.1 - 1.2 --- Log message: Code cleanup associated with jump tables, thanks to Chris for noticing these. --- Diffs of the changes: (+11 -9) MachineCodeEmitter.h | 12 ++-- MachineJumpTableInfo.h |8 +--- 2 files changed, 11 insertions(+), 9 deletions(-) Index: llvm/include/llvm/CodeGen/MachineCodeEmitter.h diff -u llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.29 llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.30 --- llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.29 Sat Apr 22 13:53:45 2006 +++ llvm/include/llvm/CodeGen/MachineCodeEmitter.h Sat Apr 22 18:52:35 2006 @@ -102,14 +102,14 @@ /// noted with this interface. virtual void addRelocation(const MachineRelocation MR) = 0; - // getConstantPoolEntryAddress - Return the address of the 'Index' entry in - // the constant pool that was last emitted with the 'emitConstantPool' method. - // + /// getConstantPoolEntryAddress - Return the address of the 'Index' entry in + /// the constant pool that was last emitted with the emitConstantPool method. + /// virtual uint64_t getConstantPoolEntryAddress(unsigned Index) = 0; - // getJumpTablelEntryAddress - Return the address of the jump table with index - // 'Index' in the function that last called initJumpTableInfo. - // + /// getJumpTableEntryAddress - Return the address of the jump table with index + /// 'Index' in the function that last called initJumpTableInfo. + /// virtual uint64_t getJumpTableEntryAddress(unsigned Index) = 0; // allocateGlobal - Allocate some space for a global variable. Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.1 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.2 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.1Sat Apr 22 13:53:45 2006 +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.hSat Apr 22 18:52:35 2006 @@ -20,7 +20,6 @@ #ifndef LLVM_CODEGEN_MACHINEJUMPTABLEINFO_H #define LLVM_CODEGEN_MACHINEJUMPTABLEINFO_H -#include llvm/Target/TargetData.h #include vector #include iosfwd @@ -55,8 +54,11 @@ return JumpTables; } - unsigned getEntrySize() const { return TD.getPointerSize(); } - unsigned getAlignment() const { return TD.getPointerAlignment(); } + /// getEntrySize - returns the size of an individual field in a jump table + unsigned getEntrySize() const; + + /// getAlignment - returns the target's preferred alignment for jump tables + unsigned getAlignment() const; /// print - Used by the MachineFunction printer to print information about /// jump tables. Implemented in MachineFunction.cpp ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp
Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.88 - 1.89 --- Log message: Code cleanup associated with jump tables, thanks to Chris for noticing these. --- Diffs of the changes: (+8 -0) MachineFunction.cpp |8 1 files changed, 8 insertions(+) Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.88 llvm/lib/CodeGen/MachineFunction.cpp:1.89 --- llvm/lib/CodeGen/MachineFunction.cpp:1.88 Sat Apr 22 13:53:45 2006 +++ llvm/lib/CodeGen/MachineFunction.cppSat Apr 22 18:52:35 2006 @@ -366,6 +366,14 @@ } } +unsigned MachineJumpTableInfo::getEntrySize() const { + return TD.getPointerSize(); +} + +unsigned MachineJumpTableInfo::getAlignment() const { + return TD.getPointerAlignment(); +} + void MachineJumpTableInfo::dump() const { print(std::cerr); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits