From evan.cheng at apple.com Mon Jun 29 02:51:05 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 29 Jun 2009 07:51:05 -0000 Subject: [llvm-commits] [llvm] r74420 - in /llvm/trunk: lib/Target/ARM/ARMAddressingModes.h lib/Target/ARM/ARMConstantIslandPass.cpp lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMInstrFormats.td lib/Target/ARM/ARMInstrInfo.h lib/Target/ARM/ARMInstrInfo.td lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/ARMInstrThumb2.td lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp lib/Target/ARM/README.txt lib/Target/ARM/ThumbRegisterInfo.cpp test/CodeGen/ARM/ldr.ll test/CodeGen/Thumb2/thumb2-ldr.ll Message-ID: <200906290751.n5T7p61C030540@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 29 02:51:04 2009 New Revision: 74420 URL: http://llvm.org/viewvc/llvm-project?rev=74420&view=rev Log: Implement Thumb2 ldr. After much back and forth, I decided to deviate from ARM design and split LDR into 4 instructions (r + imm12, r + imm8, r + r << imm12, constantpool). The advantage of this is 1) it follows the latest ARM technical manual, and 2) makes it easier to reduce the width of the instruction later. The down side is this creates more inconsistency between the two sub-targets. We should split ARM LDR instruction in a similar fashion later. I've added a README entry for this. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrInfo.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/ARM/README.txt llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp llvm/trunk/test/CodeGen/ARM/ldr.ll Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAddressingModes.h?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMAddressingModes.h (original) +++ llvm/trunk/lib/Target/ARM/ARMAddressingModes.h Mon Jun 29 02:51:04 2009 @@ -305,7 +305,7 @@ /// abcdefgh abcdefgh abcdefgh abcdefgh control = 3 /// Return -1 if none of the above apply. /// See ARM Reference Manual A6.3.2. - static inline int getT2SOImmValSplat (unsigned V) { + static inline int getT2SOImmValSplat(unsigned V) { unsigned u, Vs, Imm; // control = 0 if ((V & 0xffffff00) == 0) Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Mon Jun 29 02:51:04 2009 @@ -447,21 +447,24 @@ Bits = 8; Scale = 4; // +-(offset_8*4) break; - case ARMII::AddrModeT1: + case ARMII::AddrModeT1_1: Bits = 5; // +offset_5 break; - case ARMII::AddrModeT2: + case ARMII::AddrModeT1_2: Bits = 5; Scale = 2; // +(offset_5*2) break; - case ARMII::AddrModeT4: + case ARMII::AddrModeT1_4: Bits = 5; Scale = 4; // +(offset_5*4) break; - case ARMII::AddrModeTs: + case ARMII::AddrModeT1_s: Bits = 8; Scale = 4; // +(offset_8*4) break; + case ARMII::AddrModeT2_pc: + Bits = 12; // +-offset_12 + break; } // Remember that this is a user of a CP entry. Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jun 29 02:51:04 2009 @@ -64,6 +64,8 @@ SDNode *Select(SDValue Op); virtual void InstructionSelect(); + bool SelectShifterOperandReg(SDValue Op, SDValue N, SDValue &A, + SDValue &B, SDValue &C); bool SelectAddrMode2(SDValue Op, SDValue N, SDValue &Base, SDValue &Offset, SDValue &Opc); bool SelectAddrMode2Offset(SDValue Op, SDValue N, @@ -92,10 +94,15 @@ bool SelectThumbAddrModeSP(SDValue Op, SDValue N, SDValue &Base, SDValue &OffImm); - bool SelectShifterOperandReg(SDValue Op, SDValue N, SDValue &A, - SDValue &B, SDValue &C); bool SelectT2ShifterOperandReg(SDValue Op, SDValue N, SDValue &BaseReg, SDValue &Opc); + bool SelectT2AddrModeImm12(SDValue Op, SDValue N, SDValue &Base, + SDValue &OffImm); + bool SelectT2AddrModeImm8(SDValue Op, SDValue N, SDValue &Base, + SDValue &OffImm); + bool SelectT2AddrModeSoReg(SDValue Op, SDValue N, SDValue &Base, + SDValue &OffReg, SDValue &ShImm); + // Include the pieces autogenerated from the target description. #include "ARMGenDAGISel.inc" @@ -116,6 +123,30 @@ CurDAG->RemoveDeadNodes(); } +bool ARMDAGToDAGISel::SelectShifterOperandReg(SDValue Op, + SDValue N, + SDValue &BaseReg, + SDValue &ShReg, + SDValue &Opc) { + ARM_AM::ShiftOpc ShOpcVal = ARM_AM::getShiftOpcForNode(N); + + // Don't match base register only case. That is matched to a separate + // lower complexity pattern with explicit register operand. + if (ShOpcVal == ARM_AM::no_shift) return false; + + BaseReg = N.getOperand(0); + unsigned ShImmVal = 0; + if (ConstantSDNode *RHS = dyn_cast(N.getOperand(1))) { + ShReg = CurDAG->getRegister(0, MVT::i32); + ShImmVal = RHS->getZExtValue() & 31; + } else { + ShReg = N.getOperand(1); + } + Opc = CurDAG->getTargetConstant(ARM_AM::getSORegOpc(ShOpcVal, ShImmVal), + MVT::i32); + return true; +} + bool ARMDAGToDAGISel::SelectAddrMode2(SDValue Op, SDValue N, SDValue &Base, SDValue &Offset, SDValue &Opc) { @@ -519,30 +550,6 @@ return false; } -bool ARMDAGToDAGISel::SelectShifterOperandReg(SDValue Op, - SDValue N, - SDValue &BaseReg, - SDValue &ShReg, - SDValue &Opc) { - ARM_AM::ShiftOpc ShOpcVal = ARM_AM::getShiftOpcForNode(N); - - // Don't match base register only case. That is matched to a separate - // lower complexity pattern with explicit register operand. - if (ShOpcVal == ARM_AM::no_shift) return false; - - BaseReg = N.getOperand(0); - unsigned ShImmVal = 0; - if (ConstantSDNode *RHS = dyn_cast(N.getOperand(1))) { - ShReg = CurDAG->getRegister(0, MVT::i32); - ShImmVal = RHS->getZExtValue() & 31; - } else { - ShReg = N.getOperand(1); - } - Opc = CurDAG->getTargetConstant(ARM_AM::getSORegOpc(ShOpcVal, ShImmVal), - MVT::i32); - return true; -} - bool ARMDAGToDAGISel::SelectT2ShifterOperandReg(SDValue Op, SDValue N, SDValue &BaseReg, SDValue &Opc) { @@ -563,6 +570,106 @@ return false; } +bool ARMDAGToDAGISel::SelectT2AddrModeImm12(SDValue Op, SDValue N, + SDValue &Base, SDValue &OffImm) { + // Match simple R + imm12 operands. + if (N.getOpcode() != ISD::ADD) + return false; + + if (ConstantSDNode *RHS = dyn_cast(N.getOperand(1))) { + int RHSC = (int)RHS->getZExtValue(); + if (RHSC >= 0 && RHSC < 0x1000) { // 12 bits. + Base = N.getOperand(0); + OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32); + return true; + } + } + + return false; +} + +bool ARMDAGToDAGISel::SelectT2AddrModeImm8(SDValue Op, SDValue N, + SDValue &Base, SDValue &OffImm) { + if (N.getOpcode() == ISD::ADD) { + if (ConstantSDNode *RHS = dyn_cast(N.getOperand(1))) { + int RHSC = (int)RHS->getZExtValue(); + if (RHSC < 0 && RHSC > -0x100) { // 8 bits. + Base = N.getOperand(0); + OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32); + return true; + } + } + } else if (N.getOpcode() == ISD::SUB) { + if (ConstantSDNode *RHS = dyn_cast(N.getOperand(1))) { + int RHSC = (int)RHS->getZExtValue(); + if (RHSC >= 0 && RHSC < 0x100) { // 8 bits. + Base = N.getOperand(0); + OffImm = CurDAG->getTargetConstant(-RHSC, MVT::i32); + return true; + } + } + } + + return false; +} + +bool ARMDAGToDAGISel::SelectT2AddrModeSoReg(SDValue Op, SDValue N, + SDValue &Base, + SDValue &OffReg, SDValue &ShImm) { + // Base only. + if (N.getOpcode() != ISD::ADD && N.getOpcode() != ISD::SUB) { + Base = N; + if (N.getOpcode() == ISD::FrameIndex) { + int FI = cast(N)->getIndex(); + Base = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy()); + } else if (N.getOpcode() == ARMISD::Wrapper) { + Base = N.getOperand(0); + if (Base.getOpcode() == ISD::TargetConstantPool) + return false; // We want to select t2LDRpci instead. + } + OffReg = CurDAG->getRegister(0, MVT::i32); + ShImm = CurDAG->getTargetConstant(0, MVT::i32); + return true; + } + + // Look for (R + R) or (R + (R << [1,2,3])). + unsigned ShAmt = 0; + Base = N.getOperand(0); + OffReg = N.getOperand(1); + + // Swap if it is ((R << c) + R). + ARM_AM::ShiftOpc ShOpcVal = ARM_AM::getShiftOpcForNode(OffReg); + if (ShOpcVal != ARM_AM::lsl) { + ShOpcVal = ARM_AM::getShiftOpcForNode(Base); + if (ShOpcVal == ARM_AM::lsl) + std::swap(Base, OffReg); + } + + if (ShOpcVal == ARM_AM::lsl) { + // Check to see if the RHS of the shift is a constant, if not, we can't fold + // it. + if (ConstantSDNode *Sh = dyn_cast(OffReg.getOperand(1))) { + ShAmt = Sh->getZExtValue(); + if (ShAmt >= 4) { + ShAmt = 0; + ShOpcVal = ARM_AM::no_shift; + } else + OffReg = OffReg.getOperand(0); + } else { + ShOpcVal = ARM_AM::no_shift; + } + } else if (SelectT2AddrModeImm12(Op, N, Base, ShImm) || + SelectT2AddrModeImm8 (Op, N, Base, ShImm)) + // Don't match if it's possible to match to one of the r +/- imm cases. + return false; + + ShImm = CurDAG->getTargetConstant(ShAmt, MVT::i32); + + return true; +} + +//===--------------------------------------------------------------------===// + /// getAL - Returns a ARMCC::AL immediate node. static inline SDValue getAL(SelectionDAG *CurDAG) { return CurDAG->getTargetConstant((uint64_t)ARMCC::AL, MVT::i32); Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Jun 29 02:51:04 2009 @@ -59,6 +59,47 @@ class UnaryDP { bit isUnaryDataProc = 1; } //===----------------------------------------------------------------------===// +// ARM Instruction flags. These need to match ARMInstrInfo.h. +// + +// Addressing mode. +class AddrMode val> { + bits<4> Value = val; +} +def AddrModeNone : AddrMode<0>; +def AddrMode1 : AddrMode<1>; +def AddrMode2 : AddrMode<2>; +def AddrMode3 : AddrMode<3>; +def AddrMode4 : AddrMode<4>; +def AddrMode5 : AddrMode<5>; +def AddrModeT1_1 : AddrMode<6>; +def AddrModeT1_2 : AddrMode<7>; +def AddrModeT1_4 : AddrMode<8>; +def AddrModeT1_s : AddrMode<9>; +def AddrModeT2_i12: AddrMode<10>; +def AddrModeT2_i8 : AddrMode<11>; +def AddrModeT2_so : AddrMode<12>; +def AddrModeT2_pc : AddrMode<13>; + +// Instruction size. +class SizeFlagVal val> { + bits<3> Value = val; +} +def SizeInvalid : SizeFlagVal<0>; // Unset. +def SizeSpecial : SizeFlagVal<1>; // Pseudo or special. +def Size8Bytes : SizeFlagVal<2>; +def Size4Bytes : SizeFlagVal<3>; +def Size2Bytes : SizeFlagVal<4>; + +// Load / store index mode. +class IndexMode val> { + bits<2> Value = val; +} +def IndexModeNone : IndexMode<0>; +def IndexModePre : IndexMode<1>; +def IndexModePost : IndexMode<2>; + +//===----------------------------------------------------------------------===// // ARM Instruction templates. // @@ -706,7 +747,6 @@ // Thumb Instruction Format Definitions. // - // TI - Thumb instruction. class ThumbI pattern> : ThumbI; -class TI1 pattern> - : ThumbI; -class TI2 pattern> - : ThumbI; -class TI4 pattern> - : ThumbI; -class TIs pattern> - : ThumbI; - -// Two-address instructions -class TIt pattern> - : ThumbI; // BL, BLX(1) are translated by assembler into two instructions class TIx2 pattern> @@ -764,6 +792,14 @@ class T1I pattern> : Thumb1I; +class T1I1 pattern> + : Thumb1I; +class T1I2 pattern> + : Thumb1I; +class T1I4 pattern> + : Thumb1I; +class T1Is pattern> + : Thumb1I; // Two-address instructions class T1It pattern> @@ -812,6 +848,14 @@ class T2I pattern> : Thumb2I; +class T2Ii12 pattern> + : Thumb2I; +class T2Ii8 pattern> + : Thumb2I; +class T2Iso pattern> + : Thumb2I; +class T2Ipc pattern> + : Thumb2I; class T2sI pattern> : Thumb2sI; Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Mon Jun 29 02:51:04 2009 @@ -39,10 +39,14 @@ AddrMode3 = 3, AddrMode4 = 4, AddrMode5 = 5, - AddrModeT1 = 6, - AddrModeT2 = 7, - AddrModeT4 = 8, - AddrModeTs = 9, // i8 * 4 for pc and sp relative data + AddrModeT1_1 = 6, + AddrModeT1_2 = 7, + AddrModeT1_4 = 8, + AddrModeT1_s = 9, // i8 * 4 for pc and sp relative data + AddrModeT2_i12= 10, + AddrModeT2_i8 = 11, + AddrModeT2_so = 12, + AddrModeT2_pc = 13, // +/- i12 for pc relative data // Size* - Flags to keep track of the size of an instruction. SizeShift = 4, Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Jun 29 02:51:04 2009 @@ -309,43 +309,6 @@ } //===----------------------------------------------------------------------===// -// ARM Instruction flags. These need to match ARMInstrInfo.h. -// - -// Addressing mode. -class AddrMode val> { - bits<4> Value = val; -} -def AddrModeNone : AddrMode<0>; -def AddrMode1 : AddrMode<1>; -def AddrMode2 : AddrMode<2>; -def AddrMode3 : AddrMode<3>; -def AddrMode4 : AddrMode<4>; -def AddrMode5 : AddrMode<5>; -def AddrModeT1 : AddrMode<6>; -def AddrModeT2 : AddrMode<7>; -def AddrModeT4 : AddrMode<8>; -def AddrModeTs : AddrMode<9>; - -// Instruction size. -class SizeFlagVal val> { - bits<3> Value = val; -} -def SizeInvalid : SizeFlagVal<0>; // Unset. -def SizeSpecial : SizeFlagVal<1>; // Pseudo or special. -def Size8Bytes : SizeFlagVal<2>; -def Size4Bytes : SizeFlagVal<3>; -def Size2Bytes : SizeFlagVal<4>; - -// Load / store index mode. -class IndexMode val> { - bits<2> Value = val; -} -def IndexModeNone : IndexMode<0>; -def IndexModePre : IndexMode<1>; -def IndexModePost : IndexMode<2>; - -//===----------------------------------------------------------------------===// include "ARMInstrFormats.td" Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Jun 29 02:51:04 2009 @@ -211,68 +211,68 @@ // let canFoldAsLoad = 1 in -def tLDR : TI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), +def tLDR : T1I4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), "ldr $dst, $addr", [(set tGPR:$dst, (load t_addrmode_s4:$addr))]>; -def tLDRB : TI1<(outs tGPR:$dst), (ins t_addrmode_s1:$addr), +def tLDRB : T1I1<(outs tGPR:$dst), (ins t_addrmode_s1:$addr), "ldrb $dst, $addr", [(set tGPR:$dst, (zextloadi8 t_addrmode_s1:$addr))]>; -def tLDRH : TI2<(outs tGPR:$dst), (ins t_addrmode_s2:$addr), +def tLDRH : T1I2<(outs tGPR:$dst), (ins t_addrmode_s2:$addr), "ldrh $dst, $addr", [(set tGPR:$dst, (zextloadi16 t_addrmode_s2:$addr))]>; -def tLDRSB : TI1<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), +def tLDRSB : T1I1<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), "ldrsb $dst, $addr", [(set tGPR:$dst, (sextloadi8 t_addrmode_rr:$addr))]>; -def tLDRSH : TI2<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), +def tLDRSH : T1I2<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), "ldrsh $dst, $addr", [(set tGPR:$dst, (sextloadi16 t_addrmode_rr:$addr))]>; let canFoldAsLoad = 1 in -def tLDRspi : TIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), +def tLDRspi : T1Is<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), "ldr $dst, $addr", [(set tGPR:$dst, (load t_addrmode_sp:$addr))]>; // Special instruction for restore. It cannot clobber condition register // when it's expanded by eliminateCallFramePseudoInstr(). let canFoldAsLoad = 1, mayLoad = 1 in -def tRestore : TIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), +def tRestore : T1Is<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), "ldr $dst, $addr", []>; // Load tconstpool let canFoldAsLoad = 1 in -def tLDRpci : TIs<(outs tGPR:$dst), (ins i32imm:$addr), +def tLDRpci : T1Is<(outs tGPR:$dst), (ins i32imm:$addr), "ldr $dst, $addr", [(set tGPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>; // Special LDR for loads from non-pc-relative constpools. let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in -def tLDRcp : TIs<(outs tGPR:$dst), (ins i32imm:$addr), +def tLDRcp : T1Is<(outs tGPR:$dst), (ins i32imm:$addr), "ldr $dst, $addr", []>; -def tSTR : TI4<(outs), (ins tGPR:$src, t_addrmode_s4:$addr), +def tSTR : T1I4<(outs), (ins tGPR:$src, t_addrmode_s4:$addr), "str $src, $addr", [(store tGPR:$src, t_addrmode_s4:$addr)]>; -def tSTRB : TI1<(outs), (ins tGPR:$src, t_addrmode_s1:$addr), +def tSTRB : T1I1<(outs), (ins tGPR:$src, t_addrmode_s1:$addr), "strb $src, $addr", [(truncstorei8 tGPR:$src, t_addrmode_s1:$addr)]>; -def tSTRH : TI2<(outs), (ins tGPR:$src, t_addrmode_s2:$addr), +def tSTRH : T1I2<(outs), (ins tGPR:$src, t_addrmode_s2:$addr), "strh $src, $addr", [(truncstorei16 tGPR:$src, t_addrmode_s2:$addr)]>; -def tSTRspi : TIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), +def tSTRspi : T1Is<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), "str $src, $addr", [(store tGPR:$src, t_addrmode_sp:$addr)]>; let mayStore = 1 in { // Special instruction for spill. It cannot clobber condition register // when it's expanded by eliminateCallFramePseudoInstr(). -def tSpill : TIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), +def tSpill : T1Is<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), "str $src, $addr", []>; } Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Jun 29 02:51:04 2009 @@ -127,6 +127,30 @@ }], t2_hi16>; +// Define Thumb2 specific addressing modes. + +// t2addrmode_imm12 := reg + imm12 +def t2addrmode_imm12 : Operand, + ComplexPattern { + let PrintMethod = "printT2AddrModeImm12Operand"; + let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm); +} + +// t2addrmode_imm8 := reg - imm8 +def t2addrmode_imm8 : Operand, + ComplexPattern { + let PrintMethod = "printT2AddrModeImm8Operand"; + let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm); +} + +// t2addrmode_so_reg := reg + reg << imm2 +def t2addrmode_so_reg : Operand, + ComplexPattern { + let PrintMethod = "printT2AddrModeSoRegOperand"; + let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm); +} + + //===----------------------------------------------------------------------===// // Multiclass helpers... // @@ -409,6 +433,26 @@ // Load / store Instructions. // +// Load +let canFoldAsLoad = 1 in { +def t2LDRi12 : T2Ii12<(outs GPR:$dst), (ins t2addrmode_imm12:$addr), + "ldr", " $dst, $addr", + [(set GPR:$dst, (load t2addrmode_imm12:$addr))]>; + +def t2LDRi8 : T2Ii8<(outs GPR:$dst), (ins t2addrmode_imm8:$addr), + "ldr", " $dst, $addr", + [(set GPR:$dst, (load t2addrmode_imm8:$addr))]>; + +def t2LDRs : T2Iso<(outs GPR:$dst), (ins t2addrmode_so_reg:$addr), + "ldr", " $dst, $addr", + [(set GPR:$dst, (load t2addrmode_so_reg:$addr))]>; + +// Load tconstpool +def t2LDRpci : T2Ipc<(outs GPR:$dst), (ins i32imm:$addr), + "ldr", " $dst, $addr", + [(set GPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>; +} // canFoldAsLoad + //===----------------------------------------------------------------------===// // Move Instructions. // Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Jun 29 02:51:04 2009 @@ -93,45 +93,48 @@ return "ARM Assembly Printer"; } - void printOperand(const MachineInstr *MI, int opNum, + void printOperand(const MachineInstr *MI, int OpNum, const char *Modifier = 0); - void printSOImmOperand(const MachineInstr *MI, int opNum); - void printSOImm2PartOperand(const MachineInstr *MI, int opNum); - void printSORegOperand(const MachineInstr *MI, int opNum); - void printAddrMode2Operand(const MachineInstr *MI, int OpNo); - void printAddrMode2OffsetOperand(const MachineInstr *MI, int OpNo); - void printAddrMode3Operand(const MachineInstr *MI, int OpNo); - void printAddrMode3OffsetOperand(const MachineInstr *MI, int OpNo); - void printAddrMode4Operand(const MachineInstr *MI, int OpNo, + void printSOImmOperand(const MachineInstr *MI, int OpNum); + void printSOImm2PartOperand(const MachineInstr *MI, int OpNum); + void printSORegOperand(const MachineInstr *MI, int OpNum); + void printAddrMode2Operand(const MachineInstr *MI, int OpNum); + void printAddrMode2OffsetOperand(const MachineInstr *MI, int OpNum); + void printAddrMode3Operand(const MachineInstr *MI, int OpNum); + void printAddrMode3OffsetOperand(const MachineInstr *MI, int OpNum); + void printAddrMode4Operand(const MachineInstr *MI, int OpNum, const char *Modifier = 0); - void printAddrMode5Operand(const MachineInstr *MI, int OpNo, + void printAddrMode5Operand(const MachineInstr *MI, int OpNum, const char *Modifier = 0); - void printAddrModePCOperand(const MachineInstr *MI, int OpNo, + void printAddrModePCOperand(const MachineInstr *MI, int OpNum, const char *Modifier = 0); - void printBitfieldInvMaskImmOperand (const MachineInstr *MI, int OpNo); + void printBitfieldInvMaskImmOperand (const MachineInstr *MI, int OpNum); - void printThumbAddrModeRROperand(const MachineInstr *MI, int OpNo); - void printThumbAddrModeRI5Operand(const MachineInstr *MI, int OpNo, + void printThumbAddrModeRROperand(const MachineInstr *MI, int OpNum); + void printThumbAddrModeRI5Operand(const MachineInstr *MI, int OpNum, unsigned Scale); - void printThumbAddrModeS1Operand(const MachineInstr *MI, int OpNo); - void printThumbAddrModeS2Operand(const MachineInstr *MI, int OpNo); - void printThumbAddrModeS4Operand(const MachineInstr *MI, int OpNo); - void printThumbAddrModeSPOperand(const MachineInstr *MI, int OpNo); + void printThumbAddrModeS1Operand(const MachineInstr *MI, int OpNum); + void printThumbAddrModeS2Operand(const MachineInstr *MI, int OpNum); + void printThumbAddrModeS4Operand(const MachineInstr *MI, int OpNum); + void printThumbAddrModeSPOperand(const MachineInstr *MI, int OpNum); - void printT2SOImmOperand(const MachineInstr *MI, int opNum); + void printT2SOImmOperand(const MachineInstr *MI, int OpNum); void printT2SOOperand(const MachineInstr *MI, int OpNum); - - void printPredicateOperand(const MachineInstr *MI, int opNum); - void printSBitModifierOperand(const MachineInstr *MI, int opNum); - void printPCLabel(const MachineInstr *MI, int opNum); - void printRegisterList(const MachineInstr *MI, int opNum); - void printCPInstOperand(const MachineInstr *MI, int opNum, + void printT2AddrModeImm12Operand(const MachineInstr *MI, int OpNum); + void printT2AddrModeImm8Operand(const MachineInstr *MI, int OpNum); + void printT2AddrModeSoRegOperand(const MachineInstr *MI, int OpNum); + + void printPredicateOperand(const MachineInstr *MI, int OpNum); + void printSBitModifierOperand(const MachineInstr *MI, int OpNum); + void printPCLabel(const MachineInstr *MI, int OpNum); + void printRegisterList(const MachineInstr *MI, int OpNum); + void printCPInstOperand(const MachineInstr *MI, int OpNum, const char *Modifier); - void printJTBlockOperand(const MachineInstr *MI, int opNum); + void printJTBlockOperand(const MachineInstr *MI, int OpNum); - virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, + virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode); - virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, + virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode); @@ -282,9 +285,9 @@ return false; } -void ARMAsmPrinter::printOperand(const MachineInstr *MI, int opNum, +void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum, const char *Modifier) { - const MachineOperand &MO = MI->getOperand(opNum); + const MachineOperand &MO = MI->getOperand(OpNum); switch (MO.getType()) { case MachineOperand::MO_Register: { unsigned Reg = MO.getReg(); @@ -606,6 +609,8 @@ O << "#" << lsb << ", #" << width; } +//===--------------------------------------------------------------------===// + void ARMAsmPrinter::printThumbAddrModeRROperand(const MachineInstr *MI, int Op) { const MachineOperand &MO1 = MI->getOperand(Op); @@ -659,6 +664,8 @@ O << "]"; } +//===--------------------------------------------------------------------===// + /// printT2SOImmOperand - T2SOImm is: /// 1. a 4-bit splat control value and 8 bit immediate value /// 2. a 5-bit rotate amount and a non-zero 8-bit immediate value @@ -694,47 +701,99 @@ O << "#" << ARM_AM::getSORegOffset(MO2.getImm()); } +void ARMAsmPrinter::printT2AddrModeImm12Operand(const MachineInstr *MI, + int OpNum) { + const MachineOperand &MO1 = MI->getOperand(OpNum); + const MachineOperand &MO2 = MI->getOperand(OpNum+1); + + O << "[" << TM.getRegisterInfo()->get(MO1.getReg()).AsmName; + + unsigned OffImm = MO2.getImm(); + if (OffImm) // Don't print +0. + O << ", #+" << OffImm; + O << "]"; +} + +void ARMAsmPrinter::printT2AddrModeImm8Operand(const MachineInstr *MI, + int OpNum) { + const MachineOperand &MO1 = MI->getOperand(OpNum); + const MachineOperand &MO2 = MI->getOperand(OpNum+1); + + O << "[" << TM.getRegisterInfo()->get(MO1.getReg()).AsmName; + + int32_t OffImm = (int32_t)MO2.getImm(); + // Don't print +0. + if (OffImm < 0) + O << ", #-" << -OffImm; + else if (OffImm > 0) + O << ", #+" << OffImm; + O << "]"; +} + +void ARMAsmPrinter::printT2AddrModeSoRegOperand(const MachineInstr *MI, + int OpNum) { + const MachineOperand &MO1 = MI->getOperand(OpNum); + const MachineOperand &MO2 = MI->getOperand(OpNum+1); + const MachineOperand &MO3 = MI->getOperand(OpNum+2); + + O << "[" << TM.getRegisterInfo()->get(MO1.getReg()).AsmName; + + if (MO2.getReg()) { + O << ", +" + << TM.getRegisterInfo()->get(MO2.getReg()).AsmName; -void ARMAsmPrinter::printPredicateOperand(const MachineInstr *MI, int opNum) { - ARMCC::CondCodes CC = (ARMCC::CondCodes)MI->getOperand(opNum).getImm(); + unsigned ShAmt = MO3.getImm(); + if (ShAmt) { + assert(ShAmt <= 3 && "Not a valid Thumb2 addressing mode!"); + O << ", lsl #" << ShAmt; + } + } + O << "]"; +} + + +//===--------------------------------------------------------------------===// + +void ARMAsmPrinter::printPredicateOperand(const MachineInstr *MI, int OpNum) { + ARMCC::CondCodes CC = (ARMCC::CondCodes)MI->getOperand(OpNum).getImm(); if (CC != ARMCC::AL) O << ARMCondCodeToString(CC); } -void ARMAsmPrinter::printSBitModifierOperand(const MachineInstr *MI, int opNum){ - unsigned Reg = MI->getOperand(opNum).getReg(); +void ARMAsmPrinter::printSBitModifierOperand(const MachineInstr *MI, int OpNum){ + unsigned Reg = MI->getOperand(OpNum).getReg(); if (Reg) { assert(Reg == ARM::CPSR && "Expect ARM CPSR register!"); O << 's'; } } -void ARMAsmPrinter::printPCLabel(const MachineInstr *MI, int opNum) { - int Id = (int)MI->getOperand(opNum).getImm(); +void ARMAsmPrinter::printPCLabel(const MachineInstr *MI, int OpNum) { + int Id = (int)MI->getOperand(OpNum).getImm(); O << TAI->getPrivateGlobalPrefix() << "PC" << Id; } -void ARMAsmPrinter::printRegisterList(const MachineInstr *MI, int opNum) { +void ARMAsmPrinter::printRegisterList(const MachineInstr *MI, int OpNum) { O << "{"; - for (unsigned i = opNum, e = MI->getNumOperands(); i != e; ++i) { + for (unsigned i = OpNum, e = MI->getNumOperands(); i != e; ++i) { printOperand(MI, i); if (i != e-1) O << ", "; } O << "}"; } -void ARMAsmPrinter::printCPInstOperand(const MachineInstr *MI, int OpNo, +void ARMAsmPrinter::printCPInstOperand(const MachineInstr *MI, int OpNum, const char *Modifier) { assert(Modifier && "This operand only works with a modifier!"); // There are two aspects to a CONSTANTPOOL_ENTRY operand, the label and the // data itself. if (!strcmp(Modifier, "label")) { - unsigned ID = MI->getOperand(OpNo).getImm(); + unsigned ID = MI->getOperand(OpNum).getImm(); O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_' << ID << ":\n"; } else { assert(!strcmp(Modifier, "cpentry") && "Unknown modifier for CPE"); - unsigned CPI = MI->getOperand(OpNo).getIndex(); + unsigned CPI = MI->getOperand(OpNum).getIndex(); const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPI]; @@ -746,9 +805,9 @@ } } -void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNo) { - const MachineOperand &MO1 = MI->getOperand(OpNo); - const MachineOperand &MO2 = MI->getOperand(OpNo+1); // Unique Id +void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) { + const MachineOperand &MO1 = MI->getOperand(OpNum); + const MachineOperand &MO2 = MI->getOperand(OpNum+1); // Unique Id unsigned JTI = MO1.getIndex(); O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_' << JTI << '_' << MO2.getImm() << ":\n"; @@ -787,7 +846,7 @@ } -bool ARMAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, +bool ARMAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode){ // Does this asm operand have a single letter operand modifier? if (ExtraCode && ExtraCode[0]) { @@ -797,10 +856,10 @@ default: return true; // Unknown modifier. case 'a': // Don't print "#" before a global var name or constant. case 'c': // Don't print "$" before a global var name or constant. - printOperand(MI, OpNo, "no_hash"); + printOperand(MI, OpNum, "no_hash"); return false; case 'P': // Print a VFP double precision register. - printOperand(MI, OpNo); + printOperand(MI, OpNum); return false; case 'Q': if (TM.getTargetData()->isLittleEndian()) @@ -812,24 +871,24 @@ // Fallthrough case 'H': // Write second word of DI / DF reference. // Verify that this operand has two consecutive registers. - if (!MI->getOperand(OpNo).isReg() || - OpNo+1 == MI->getNumOperands() || - !MI->getOperand(OpNo+1).isReg()) + if (!MI->getOperand(OpNum).isReg() || + OpNum+1 == MI->getNumOperands() || + !MI->getOperand(OpNum+1).isReg()) return true; - ++OpNo; // Return the high-part. + ++OpNum; // Return the high-part. } } - printOperand(MI, OpNo); + printOperand(MI, OpNum); return false; } bool ARMAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, - unsigned OpNo, unsigned AsmVariant, + unsigned OpNum, unsigned AsmVariant, const char *ExtraCode) { if (ExtraCode && ExtraCode[0]) return true; // Unknown modifier. - printAddrMode2Operand(MI, OpNo); + printAddrMode2Operand(MI, OpNum); return false; } Modified: llvm/trunk/lib/Target/ARM/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/README.txt?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/README.txt (original) +++ llvm/trunk/lib/Target/ARM/README.txt Mon Jun 29 02:51:04 2009 @@ -530,3 +530,10 @@ ARM::MOVCCr is commutable (by flipping the condition). But we need to implement ARMInstrInfo::commuteInstruction() to support it. + +//===---------------------------------------------------------------------===// + +Split out LDR (literal) from normal ARM LDR instruction. Also consider spliting +LDR into imm12 and so_reg forms. This allows us to clean up some code. e.g. +ARMLoadStoreOptimizer does not need to look at LDR (literal) and LDR (so_reg) +while ARMConstantIslandPass only need to worry about LDR (literal). Modified: llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp Mon Jun 29 02:51:04 2009 @@ -444,7 +444,7 @@ unsigned NumBits = 0; unsigned Scale = 1; switch (AddrMode) { - case ARMII::AddrModeTs: { + case ARMII::AddrModeT1_s: { ImmIdx = i+1; InstrOffs = MI.getOperand(ImmIdx).getImm(); NumBits = (FrameReg == ARM::SP) ? 8 : 5; @@ -472,7 +472,7 @@ } bool isThumSpillRestore = Opcode == ARM::tRestore || Opcode == ARM::tSpill; - if (AddrMode == ARMII::AddrModeTs) { + if (AddrMode == ARMII::AddrModeT1_s) { // Thumb tLDRspi, tSTRspi. These will change to instructions that use // a different base register. NumBits = 5; @@ -480,7 +480,7 @@ } // If this is a thumb spill / restore, we will be using a constpool load to // materialize the offset. - if (AddrMode == ARMII::AddrModeTs && isThumSpillRestore) + if (AddrMode == ARMII::AddrModeT1_s && isThumSpillRestore) ImmOp.ChangeToImmediate(0); else { // Otherwise, it didn't fit. Pull in what we can to simplify the immed. Modified: llvm/trunk/test/CodeGen/ARM/ldr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ldr.ll?rev=74420&r1=74419&r2=74420&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ldr.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ldr.ll Mon Jun 29 02:51:04 2009 @@ -1,23 +1,59 @@ -; RUN: llvm-as < %s | llc -march=arm | \ -; RUN: grep {ldr r0} | count 3 +; RUN: llvm-as < %s | llc -march=arm | grep {ldr r0} | count 7 +; RUN: llvm-as < %s | llc -march=arm | grep mov | grep 1 +; RUN: llvm-as < %s | llc -march=arm | not grep mvn +; RUN: llvm-as < %s | llc -march=arm | grep ldr | grep lsl +; RUN: llvm-as < %s | llc -march=arm | grep ldr | grep lsr define i32 @f1(i32* %v) { entry: - %tmp = load i32* %v ; [#uses=1] + %tmp = load i32* %v ret i32 %tmp } define i32 @f2(i32* %v) { entry: - %tmp2 = getelementptr i32* %v, i32 1023 ; [#uses=1] - %tmp = load i32* %tmp2 ; [#uses=1] + %tmp2 = getelementptr i32* %v, i32 1023 + %tmp = load i32* %tmp2 ret i32 %tmp } define i32 @f3(i32* %v) { entry: - %tmp2 = getelementptr i32* %v, i32 1024 ; [#uses=1] - %tmp = load i32* %tmp2 ; [#uses=1] + %tmp2 = getelementptr i32* %v, i32 1024 + %tmp = load i32* %tmp2 ret i32 %tmp } +define i32 @f4(i32 %base) { +entry: + %tmp1 = sub i32 %base, 128 + %tmp2 = inttoptr i32 %tmp1 to i32* + %tmp3 = load i32* %tmp2 + ret i32 %tmp3 +} + +define i32 @f5(i32 %base, i32 %offset) { +entry: + %tmp1 = add i32 %base, %offset + %tmp2 = inttoptr i32 %tmp1 to i32* + %tmp3 = load i32* %tmp2 + ret i32 %tmp3 +} + +define i32 @f6(i32 %base, i32 %offset) { +entry: + %tmp1 = shl i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i32* + %tmp4 = load i32* %tmp3 + ret i32 %tmp4 +} + +define i32 @f7(i32 %base, i32 %offset) { +entry: + %tmp1 = lshr i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i32* + %tmp4 = load i32* %tmp3 + ret i32 %tmp4 +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll?rev=74420&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll Mon Jun 29 02:51:04 2009 @@ -0,0 +1,59 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldr r0} | count 7 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldr | grep lsl +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr | not grep ldr + +define i32 @f1(i32* %v) { +entry: + %tmp = load i32* %v + ret i32 %tmp +} + +define i32 @f2(i32* %v) { +entry: + %tmp2 = getelementptr i32* %v, i32 1023 + %tmp = load i32* %tmp2 + ret i32 %tmp +} + +define i32 @f3(i32* %v) { +entry: + %tmp2 = getelementptr i32* %v, i32 1024 + %tmp = load i32* %tmp2 + ret i32 %tmp +} + +define i32 @f4(i32 %base) { +entry: + %tmp1 = sub i32 %base, 128 + %tmp2 = inttoptr i32 %tmp1 to i32* + %tmp3 = load i32* %tmp2 + ret i32 %tmp3 +} + +define i32 @f5(i32 %base, i32 %offset) { +entry: + %tmp1 = add i32 %base, %offset + %tmp2 = inttoptr i32 %tmp1 to i32* + %tmp3 = load i32* %tmp2 + ret i32 %tmp3 +} + +define i32 @f6(i32 %base, i32 %offset) { +entry: + %tmp1 = shl i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i32* + %tmp4 = load i32* %tmp3 + ret i32 %tmp4 +} + +define i32 @f7(i32 %base, i32 %offset) { +entry: + %tmp1 = lshr i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i32* + %tmp4 = load i32* %tmp3 + ret i32 %tmp4 +} From xerxes at zafena.se Mon Jun 29 07:47:21 2009 From: xerxes at zafena.se (=?ISO-8859-1?Q?Xerxes_R=E5nby?=) Date: Mon, 29 Jun 2009 14:47:21 +0200 Subject: [llvm-commits] [patch] cmake add ThumbRegisterInfo.cpp to llvm/lib/Target/ARM/CMakeLists.txt Message-ID: <4A48B7D9.6060605@zafena.se> problem: Scanning dependencies of target llc [ 97%] Building CXX object tools/llc/CMakeFiles/llc.dir/llc.cpp.o Linking CXX executable ../../bin/llc ../../lib/libLLVMARMCodeGen.a(ARMTargetMachine.cpp.o): In function `llvm::ThumbRegisterInfo::~ThumbRegisterInfo()': ARMTargetMachine.cpp:(.text._ZN4llvm17ThumbRegisterInfoD1Ev[llvm::ThumbRegisterInfo::~ThumbRegisterInfo()]+0x7): undefined reference to `vtable for llvm::ThumbRegisterInfo' ../../lib/libLLVMARMCodeGen.a(ThumbInstrInfo.cpp.o): In function `llvm::ThumbInstrInfo::ThumbInstrInfo(llvm::ARMSubtarget const&)': ThumbInstrInfo.cpp:(.text+0x12e7): undefined reference to `llvm::ThumbRegisterInfo::ThumbRegisterInfo(llvm::TargetInstrInfo const&, llvm::ARMSubtarget const&)' ../../lib/libLLVMARMCodeGen.a(ThumbInstrInfo.cpp.o): In function `llvm::ThumbInstrInfo::ThumbInstrInfo(llvm::ARMSubtarget const&)': ThumbInstrInfo.cpp:(.text+0x134d): undefined reference to `llvm::ThumbRegisterInfo::ThumbRegisterInfo(llvm::TargetInstrInfo const&, llvm::ARMSubtarget const&)' collect2: ld returnerade avslutningsstatus 1 make[2]: *** [bin/llc] Fel 1 make[1]: *** [tools/llc/CMakeFiles/llc.dir/all] Fel 2 make: *** [all] Fel 2 solution: Include the new file ThumbRegisterInfo.cpp to llvm/lib/Target/ARM/CMakeLists.txt to make sure ThumbRegisterInfo.cpp are compiled and linked in. Cheers Xerxes -------------- next part -------------- A non-text attachment was scrubbed... Name: 29jun_fix_arm.patch Type: text/x-patch Size: 383 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090629/7770352b/attachment.bin From baldrick at free.fr Mon Jun 29 08:11:39 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Jun 2009 13:11:39 -0000 Subject: [llvm-commits] [llvm] r74421 - /llvm/trunk/lib/Target/ARM/CMakeLists.txt Message-ID: <200906291311.n5TDBgN2016679@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 29 08:11:32 2009 New Revision: 74421 URL: http://llvm.org/viewvc/llvm-project?rev=74421&view=rev Log: Include the new file ThumbRegisterInfo.cpp to CMakeLists.txt to make sure ThumbRegisterInfo.cpp are compiled and linked in. Patch by Xerxes. Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/CMakeLists.txt?rev=74421&r1=74420&r2=74421&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/ARM/CMakeLists.txt Mon Jun 29 08:11:32 2009 @@ -25,4 +25,5 @@ ARMTargetAsmInfo.cpp ARMTargetMachine.cpp ThumbInstrInfo.cpp + ThumbRegisterInfo.cpp ) From xerxes at zafena.se Mon Jun 29 08:28:21 2009 From: xerxes at zafena.se (=?ISO-8859-1?Q?Xerxes_R=E5nby?=) Date: Mon, 29 Jun 2009 15:28:21 +0200 Subject: [llvm-commits] [llvm] r74284 - in /llvm/trunk: cmake/config-ix.cmake include/llvm/Config/config.h.cmake - cmake bug? In-Reply-To: <4A450A7C.6020009@zafena.se> References: <200906261435.n5QEZiEn011654@zion.cs.uiuc.edu> <4A450A7C.6020009@zafena.se> Message-ID: <4A48C175.6070005@zafena.se> Added PR4476 for this cmake issue http://llvm.org/bugs/show_bug.cgi?id=4476 Xerxes R?nby skrev: > Hi Doug. > > Im having some issues with these two test when implemented using > check_symbol_exists(), they both fail when they should not. > cd llvm > svn up > cd .. > mkdir llvm-build > cd llvm-build > cmake ../llvm > ... > -- Looking for pthread_create in pthread > -- Looking for pthread_create in pthread - found > ... > -- Looking for pthread_mutex_lock > -- Looking for pthread_mutex_lock - found > -- Looking for pthread_rwlock_init > -- Looking for pthread_rwlock_init - not found. > -- Looking for pthread_getspecific > -- Looking for pthread_getspecific - not found. > > if i change config-ix.cmake to use check_library_exists() for the > tests then they both succeed on the same machine: > > -- Looking for pthread_create in pthread > -- Looking for pthread_create in pthread - found > -- Looking for pthread_getspecific in pthread > -- Looking for pthread_getspecific in pthread - found > -- Looking for pthread_rwlock_init in pthread > -- Looking for pthread_rwlock_init in pthread - found > ... > -- Looking for pthread_mutex_lock > -- Looking for pthread_mutex_lock - found > > Im a bit puzzled why check_symbol_exists() dont seem to work for these > two tests while working to find pthread_mutex_lock. > Could this be a cmake bug? > If i grep my /usr/include/pthread.h all the the symbols are there!: > > [xranby at pusspuss llvm-build]$ grep pthread_getspecific > /usr/include/pthread.h > extern void *pthread_getspecific (pthread_key_t __key) __THROW; > > [xranby at pusspuss llvm-build]$ grep pthread_rwlock_init > /usr/include/pthread.h > extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, > > [xranby at pusspuss llvm-build]$ grep pthread_mutex_lock > /usr/include/pthread.h > extern int pthread_mutex_lock (pthread_mutex_t *__mutex) > > > The attached patch fixes this issue by using check_library_exists() > for pthread_getspecific and pthread_rwlock_init test. > > Cheers > Xerxes > > Den 2009-06-26 16:35, Douglas Gregor skrev: >> Author: dgregor >> Date: Fri Jun 26 09:35:43 2009 >> New Revision: 74284 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74284&view=rev >> Log: >> CMake: add configure checks for pthread_rwlock_init and >> pthread_getspecific >> >> Modified: >> llvm/trunk/cmake/config-ix.cmake >> llvm/trunk/include/llvm/Config/config.h.cmake >> >> Modified: llvm/trunk/cmake/config-ix.cmake >> URL: >> http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=74284&r1=74283&r2=74284&view=diff >> >> >> ============================================================================== >> >> --- llvm/trunk/cmake/config-ix.cmake (original) >> +++ llvm/trunk/cmake/config-ix.cmake Fri Jun 26 09:35:43 2009 >> @@ -64,6 +64,8 @@ >> check_symbol_exists(malloc_zone_statistics malloc/malloc.h >> HAVE_MALLOC_ZONE_STATISTICS) >> check_symbol_exists(pthread_mutex_lock pthread.h >> HAVE_PTHREAD_MUTEX_LOCK) >> +check_symbol_exists(pthread_rwlock_init pthread.h >> HAVE_PTHREAD_RWLOCK_INIT) >> +check_symbol_exists(pthread_getspecific pthread.h >> HAVE_PTHREAD_GETSPECIFIC) >> check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) >> > > ------------------------------------------------------------------------ > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Mon Jun 29 08:36:37 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Jun 2009 13:36:37 -0000 Subject: [llvm-commits] [llvm] r74422 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp Message-ID: <200906291336.n5TDaiXG017391@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 29 08:36:13 2009 New Revision: 74422 URL: http://llvm.org/viewvc/llvm-project?rev=74422&view=rev Log: Add triple for OpenBSD. Modified: llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Triple.cpp Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=74422&r1=74421&r2=74422&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Mon Jun 29 08:36:13 2009 @@ -53,7 +53,8 @@ Darwin, DragonFly, FreeBSD, - Linux + Linux, + OpenBSD }; private: Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=74422&r1=74421&r2=74422&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Mon Jun 29 08:36:13 2009 @@ -48,6 +48,7 @@ case DragonFly: return "dragonfly"; case FreeBSD: return "freebsd"; case Linux: return "linux"; + case OpenBSD: return "openbsd"; } return ""; @@ -90,6 +91,8 @@ OS = FreeBSD; else if (memcmp(&OSName[0], "linux", 5) == 0) OS = Linux; + else if (memcmp(&OSName[0], "openbsd", 7) == 0) + OS = OpenBSD; else OS = UnknownOS; From david_goodwin at apple.com Mon Jun 29 10:33:34 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 29 Jun 2009 15:33:34 -0000 Subject: [llvm-commits] [llvm] r74423 - in /llvm/trunk: lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMISelLowering.h lib/Target/ARM/ARMInstrInfo.td lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-cmn.ll Message-ID: <200906291533.n5TFXnSX020994@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Jun 29 10:33:01 2009 New Revision: 74423 URL: http://llvm.org/viewvc/llvm-project?rev=74423&view=rev Log: Rename ARMcmpNZ to ARMcmpZ and use it to represent comparisons that set only the Z flag (i.e. eq and ne). Make ARMcmpZ commutative. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=74423&r1=74422&r2=74423&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jun 29 10:33:01 2009 @@ -402,7 +402,7 @@ case ARMISD::RET_FLAG: return "ARMISD::RET_FLAG"; case ARMISD::PIC_ADD: return "ARMISD::PIC_ADD"; case ARMISD::CMP: return "ARMISD::CMP"; - case ARMISD::CMPNZ: return "ARMISD::CMPNZ"; + case ARMISD::CMPZ: return "ARMISD::CMPZ"; case ARMISD::CMPFP: return "ARMISD::CMPFP"; case ARMISD::CMPFPw0: return "ARMISD::CMPFPw0"; case ARMISD::FMSTAT: return "ARMISD::FMSTAT"; @@ -1592,10 +1592,8 @@ break; case ARMCC::EQ: case ARMCC::NE: - case ARMCC::MI: - case ARMCC::PL: - // Uses only N and Z Flags - CompareType = ARMISD::CMPNZ; + // Uses only Z Flag + CompareType = ARMISD::CMPZ; break; } ARMCC = DAG.getConstant(CondCode, MVT::i32); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=74423&r1=74422&r2=74423&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Mon Jun 29 10:33:01 2009 @@ -45,7 +45,7 @@ PIC_ADD, // Add with a PC operand and a PIC label. CMP, // ARM compare instructions. - CMPNZ, // ARM compare that uses only N or Z flags. + CMPZ, // ARM compare that sets only Z flag. CMPFP, // ARM VFP compare instruction, sets FPSCR. CMPFPw0, // ARM VFP compare against zero instruction, sets FPSCR. FMSTAT, // ARM fmstat instruction. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=74423&r1=74422&r2=74423&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Jun 29 10:33:01 2009 @@ -75,8 +75,8 @@ def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp, [SDNPOutFlag]>; -def ARMcmpNZ : SDNode<"ARMISD::CMPNZ", SDT_ARMCmp, - [SDNPOutFlag]>; +def ARMcmpZ : SDNode<"ARMISD::CMPZ", SDT_ARMCmp, + [SDNPOutFlag,SDNPCommutative]>; def ARMpic_add : SDNode<"ARMISD::PIC_ADD", SDT_ARMPICAdd>; @@ -1272,19 +1272,19 @@ // Note that TST/TEQ don't set all the same flags that CMP does! defm TST : AI1_cmp_irs<0b1000, "tst", - BinOpFrag<(ARMcmpNZ (and node:$LHS, node:$RHS), 0)>, 1>; + BinOpFrag<(ARMcmpZ (and node:$LHS, node:$RHS), 0)>, 1>; defm TEQ : AI1_cmp_irs<0b1001, "teq", - BinOpFrag<(ARMcmpNZ (xor node:$LHS, node:$RHS), 0)>, 1>; + BinOpFrag<(ARMcmpZ (xor node:$LHS, node:$RHS), 0)>, 1>; -defm CMPnz : AI1_cmp_irs<0b1010, "cmp", - BinOpFrag<(ARMcmpNZ node:$LHS, node:$RHS)>>; -defm CMNnz : AI1_cmp_irs<0b1011, "cmn", - BinOpFrag<(ARMcmpNZ node:$LHS,(ineg node:$RHS))>>; +defm CMPz : AI1_cmp_irs<0b1010, "cmp", + BinOpFrag<(ARMcmpZ node:$LHS, node:$RHS)>>; +defm CMNz : AI1_cmp_irs<0b1011, "cmn", + BinOpFrag<(ARMcmpZ node:$LHS,(ineg node:$RHS))>>; def : ARMPat<(ARMcmp GPR:$src, so_imm_neg:$imm), (CMNri GPR:$src, so_imm_neg:$imm)>; -def : ARMPat<(ARMcmpNZ GPR:$src, so_imm_neg:$imm), +def : ARMPat<(ARMcmpZ GPR:$src, so_imm_neg:$imm), (CMNri GPR:$src, so_imm_neg:$imm)>; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=74423&r1=74422&r2=74423&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Jun 29 10:33:01 2009 @@ -362,9 +362,9 @@ def tCMN : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), "cmn $lhs, $rhs", [(ARMcmp tGPR:$lhs, (ineg tGPR:$rhs))]>; -def tCMNNZ : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), - "cmn $lhs, $rhs", - [(ARMcmpNZ tGPR:$lhs, (ineg tGPR:$rhs))]>; +def tCMNZ : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), + "cmn $lhs, $rhs", + [(ARMcmpZ tGPR:$lhs, (ineg tGPR:$rhs))]>; } // CMP immediate @@ -372,9 +372,9 @@ def tCMPi8 : T1I<(outs), (ins tGPR:$lhs, i32imm:$rhs), "cmp $lhs, $rhs", [(ARMcmp tGPR:$lhs, imm0_255:$rhs)]>; -def tCMPNZi8 : T1I<(outs), (ins tGPR:$lhs, i32imm:$rhs), - "cmp $lhs, $rhs", - [(ARMcmpNZ tGPR:$lhs, imm0_255:$rhs)]>; +def tCMPZi8 : T1I<(outs), (ins tGPR:$lhs, i32imm:$rhs), + "cmp $lhs, $rhs", + [(ARMcmpZ tGPR:$lhs, imm0_255:$rhs)]>; } @@ -383,9 +383,9 @@ def tCMPr : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), "cmp $lhs, $rhs", [(ARMcmp tGPR:$lhs, tGPR:$rhs)]>; -def tCMPNZr : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), - "cmp $lhs, $rhs", - [(ARMcmpNZ tGPR:$lhs, tGPR:$rhs)]>; +def tCMPZr : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), + "cmp $lhs, $rhs", + [(ARMcmpZ tGPR:$lhs, tGPR:$rhs)]>; } // TODO: A7-37: CMP(3) - cmp hi regs @@ -551,7 +551,7 @@ let isCommutable = 1, Defs = [CPSR] in def tTST : T1I<(outs), (ins tGPR:$lhs, tGPR:$rhs), "tst $lhs, $rhs", - [(ARMcmpNZ (and tGPR:$lhs, tGPR:$rhs), 0)]>; + [(ARMcmpZ (and tGPR:$lhs, tGPR:$rhs), 0)]>; // zero-extend byte def tUXTB : T1I<(outs tGPR:$dst), (ins tGPR:$src), Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74423&r1=74422&r2=74423&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Jun 29 10:33:01 2009 @@ -607,18 +607,18 @@ defm t2CMP : T2I_cmp_is<"cmp", BinOpFrag<(ARMcmp node:$LHS, node:$RHS)>>; -defm t2CMPnz : T2I_cmp_is<"cmp", - BinOpFrag<(ARMcmpNZ node:$LHS, node:$RHS)>>; +defm t2CMPz : T2I_cmp_is<"cmp", + BinOpFrag<(ARMcmpZ node:$LHS, node:$RHS)>>; defm t2CMN : T2I_cmp_is<"cmn", BinOpFrag<(ARMcmp node:$LHS,(ineg node:$RHS))>>; -defm t2CMNnz : T2I_cmp_is<"cmn", - BinOpFrag<(ARMcmpNZ node:$LHS,(ineg node:$RHS))>>; +defm t2CMNz : T2I_cmp_is<"cmn", + BinOpFrag<(ARMcmpZ node:$LHS,(ineg node:$RHS))>>; def : T2Pat<(ARMcmp GPR:$src, t2_so_imm_neg:$imm), (t2CMNri GPR:$src, t2_so_imm_neg:$imm)>; -def : T2Pat<(ARMcmpNZ GPR:$src, t2_so_imm_neg:$imm), +def : T2Pat<(ARMcmpZ GPR:$src, t2_so_imm_neg:$imm), (t2CMNri GPR:$src, t2_so_imm_neg:$imm)>; // FIXME: TST, TEQ, etc. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll?rev=74423&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll Mon Jun 29 10:33:01 2009 @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\]} | count 4 + +define i1 @f1(i32 %a, i32 %b) { + %nb = sub i32 0, %b + %tmp = icmp ne i32 %a, %nb + ret i1 %tmp +} + +define i1 @f2(i32 %a, i32 %b) { + %nb = sub i32 0, %b + %tmp = icmp ne i32 %nb, %a + ret i1 %tmp +} + +define i1 @f3(i32 %a, i32 %b) { + %nb = sub i32 0, %b + %tmp = icmp eq i32 %a, %nb + ret i1 %tmp +} + +define i1 @f4(i32 %a, i32 %b) { + %nb = sub i32 0, %b + %tmp = icmp eq i32 %nb, %a + ret i1 %tmp +} From brukman at cs.uiuc.edu Mon Jun 29 10:34:08 2009 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 29 Jun 2009 10:34:08 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/pubs.js Message-ID: <200906291534.n5TFY8RD021009@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: pubs.js updated: 1.45 -> 1.46 --- Log message: Fixed spacing and removed unnecessary backslash in paper title. --- Diffs of the changes: (+1 -1) pubs.js | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/pubs/pubs.js diff -u llvm-www/pubs/pubs.js:1.45 llvm-www/pubs/pubs.js:1.46 --- llvm-www/pubs/pubs.js:1.45 Sun Jun 28 16:12:34 2009 +++ llvm-www/pubs/pubs.js Mon Jun 29 10:27:34 2009 @@ -12,7 +12,7 @@ {url: '2009-06-PLDI-SoftBound.html', title: 'SoftBound: Highly Compatible and Complete Spatial Memory Safety for C', author: 'Santosh Nagarakatte, Jianzhou Zhao, Milo M K Martin and Steve Zdancewic', - published: "Proc. ACM SIGPLAN 2009 Conference on Programming Language Design \and Implementation (PLDI'09)", + published: "Proc. ACM SIGPLAN 2009 Conference on Programming Language Design and Implementation (PLDI'09)", location: "Dublin, Ireland", month: 6, year: 2009}, From bob.wilson at apple.com Mon Jun 29 10:57:52 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 29 Jun 2009 08:57:52 -0700 Subject: [llvm-commits] [llvm] r73919 - in /llvm/trunk: include/llvm/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ test/CodeGen/ARM/ In-Reply-To: References: <200906222327.n5MNR6TB005894@zion.cs.uiuc.edu> <305d6f60906221715r1adfafd6rde652f7d4df0c68f@mail.gmail.com> <41A29C22-6D98-48BC-BAAC-041B79A7A7E7@apple.com> <305d6f60906261411j5ccf3677p65ee3d6dd942afee@mail.gmail.com> <305d6f60906261726m11c4350bv25b77955015e72be@mail.gmail.com> Message-ID: On Jun 27, 2009, at 4:41 AM, Anton Korobeynikov wrote: >> Trivial patch attached. > Looks ok for me. Bob? Sure, I'm glad to see it is not more complicated than that. From gohman at apple.com Mon Jun 29 11:23:10 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Jun 2009 16:23:10 -0000 Subject: [llvm-commits] [test-suite] r74425 - in /test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs: gscolor.c gsimage.c iscan.c std.h zarray.c zpacked.c Message-ID: <200906291623.n5TGNAFD022740@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 29 11:23:09 2009 New Revision: 74425 URL: http://llvm.org/viewvc/llvm-project?rev=74425&view=rev Log: Fix several bugs in MultiSource/Benchmarks/MallocBench/gs. This is enough to get this test to execute as successfully on x86-64 as it does on x86-32. Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c?rev=74425&r1=74424&r2=74425&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c (original) +++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gscolor.c Mon Jun 29 11:23:09 2009 @@ -173,7 +173,7 @@ /* Convert the frequency to cell width and height */ { float cell_size = 72.0 / freq; gs_point pcwh; - gs_matrix imat; + gs_matrix imat = {}; int dev_w, dev_h; gs_deviceparams(gs_currentdevice(pgs), &imat, &dev_w, &dev_h); if ( (code = gs_distance_transform(cell_size, cell_size, Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c?rev=74425&r1=74424&r2=74425&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c (original) +++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/gsimage.c Mon Jun 29 11:23:09 2009 @@ -32,6 +32,7 @@ #include "gzcolor.h" /* requires gxdevice.h */ #include "gzpath.h" #include "gximage.h" +#include /* Exported size of enumerator */ int gs_image_enum_sizeof = sizeof(gs_image_enum); @@ -108,19 +109,19 @@ /* Common setup for image and imagemask. */ /* Note that the mask tables depend on the end-orientation of the CPU. */ /* We can't simply define them as byte arrays, because */ -/* they might not wind up properly long- or short-aligned. */ +/* they might not wind up properly 32-bit or 16-bit-aligned. */ #define map4tox(a,b,c,d)\ 0, a, b, a+b, c, a+c, b+c, a+b+c,\ d, a+d, b+d, a+b+d, c+d, a+c+d, b+c+d, a+b+c+d #if big_endian -private unsigned long map_4_to_32[16] = +private uint32_t map_4_to_32[16] = { map4tox(0xffL, 0xff00L, 0xff0000L, 0xff000000L) }; -private unsigned short map_4_to_16[16] = +private uint16_t map_4_to_16[16] = { map4tox(0x55, 0xaa, 0x5500, 0xaa00) }; #else /* !big_endian */ -private unsigned long map_4_to_32[16] = +private uint32_t map_4_to_32[16] = { map4tox(0xff000000L, 0xff0000L, 0xff00L, 0xffL) }; -private unsigned short map_4_to_16[16] = +private uint16_t map_4_to_16[16] = { map4tox(0x5500, 0xaa00, 0x55, 0xaa) }; #endif private int @@ -321,7 +322,7 @@ private void image_unpack_0(gs_image_enum *penum, byte *bptr, register byte *data, uint dsize) -{ register unsigned long *bufp = (unsigned long *)bptr; +{ register uint32_t *bufp = (uint32_t *)bptr; int left = dsize; while ( left-- ) { register unsigned b = *data++; @@ -351,7 +352,7 @@ private void image_unpack_1(gs_image_enum *penum, byte *bptr, register byte *data, uint dsize) -{ register unsigned short *bufp = (unsigned short *)bptr; +{ register uint16_t *bufp = (uint16_t *)bptr; int left = dsize; while ( left-- ) { register unsigned b = *data++; Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c?rev=74425&r1=74424&r2=74425&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c (original) +++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/iscan.c Mon Jun 29 11:23:09 2009 @@ -30,6 +30,7 @@ #include "store.h" #include "stream.h" #include "scanchar.h" +#include /* Array packing flag */ int array_packing; @@ -78,10 +79,10 @@ private int dynamic_grow(register dynamic_area *pda) { uint num = pda->num_elts; - uint size = num * pda->elt_size; - uint new_num; + uintptr_t size = num * pda->elt_size; + uintptr_t new_num; uint pos = pda->next - pda->base; - size = (size < 10 ? 20 : size >= (max_uint >> 1) ? max_uint : size << 1); + size = (size < 10 ? 20 : size >= (max_uint >> 1) ? UINTPTR_MAX : size << 1); new_num = size / pda->elt_size; if ( pda->is_dynamic ) { pda->base = alloc_grow(pda->base, num, new_num, pda->elt_size, "scanner"); Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h?rev=74425&r1=74424&r2=74425&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/std.h Mon Jun 29 11:23:09 2009 @@ -73,11 +73,11 @@ typedef unsigned long ulong; /* Maximum values for the unsigned types. */ -/* The "+0" is to get around apparent bugs in the UTek compiler. */ -#define max_uchar ((uchar)0xff + (uchar)0) -#define max_ushort ((ushort)0xffff + (ushort)0) -#define max_uint ((uint)0xffffffff + (uint)0) -#define max_ulong ((ulong)0xffffffffL + (ulong)0) +#include +#define max_uchar UCHAR_MAX +#define max_ushort USHRT_MAX +#define max_uint UINT_MAX +#define max_ulong ULONG_MAX /* Define a reliable arithmetic right shift. */ #if (-2 >> 1) == -1 Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c?rev=74425&r1=74424&r2=74425&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c (original) +++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c Mon Jun 29 11:23:09 2009 @@ -26,6 +26,7 @@ #include "oper.h" #include "store.h" #include "sstorei.h" +#include /* The generic operators (copy, get, put, getinterval, putinterval, */ /* length, and forall) are implemented in zgeneric.c. */ @@ -63,7 +64,7 @@ /* astore */ int zastore(register ref *op) -{ uint size; +{ uintptr_t size; check_type(*op, t_array); check_write(*op); size = op->size; Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c?rev=74425&r1=74424&r2=74425&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c (original) +++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zpacked.c Mon Jun 29 11:23:09 2009 @@ -23,6 +23,7 @@ #include "errors.h" #include "oper.h" #include "store.h" +#include /* Import the array packing flag */ extern int array_packing; @@ -70,7 +71,7 @@ { int code = make_array(op, t_packedarray, a_read+a_execute, "packedarray"); if ( code < 0 ) return code; { /* Fill the array from the stack. */ - uint size = op->size; + uintptr_t size = op->size; if ( size > op - osbot ) return e_stackunderflow; refcpy(op->value.refs, op - size, size); op[-size] = *op; From devang.patel at gmail.com Mon Jun 29 11:24:55 2009 From: devang.patel at gmail.com (Devang Patel) Date: Mon, 29 Jun 2009 09:24:55 -0700 Subject: [llvm-commits] [llvm] r74400 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp In-Reply-To: <200906280016.n5S0G81I024417@zion.cs.uiuc.edu> References: <200906280016.n5S0G81I024417@zion.cs.uiuc.edu> Message-ID: <352a1fb20906290924j2ab14facsb1d481c4ba695a77@mail.gmail.com> Andreas, Here supporting only raw_ostream from llvm/Support interface is enough, no need to support direct std::ostream interface. - Devang On Sat, Jun 27, 2009 at 5:16 PM, Andreas Bolka wrote: > Author: abolka > Date: Sat Jun 27 19:16:08 2009 > New Revision: 74400 > > URL: http://llvm.org/viewvc/llvm-project?rev=74400&view=rev > Log: > LDA analysis output scaffolding. > > Modified: > ? ?llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h > ? ?llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp > > Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h?rev=74400&r1=74399&r2=74400&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h (original) > +++ llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Sat Jun 27 19:16:08 2009 > @@ -21,11 +21,12 @@ > ?#define LLVM_ANALYSIS_LOOP_DEPENDENCE_ANALYSIS_H > > ?#include "llvm/Analysis/LoopPass.h" > +#include "llvm/Support/raw_ostream.h" > +#include > > ?namespace llvm { > > ? class AnalysisUsage; > - ?class LoopPass; > ? class ScalarEvolution; > > ? class LoopDependenceAnalysis : public LoopPass { > @@ -39,6 +40,12 @@ > ? ? bool runOnLoop(Loop*, LPPassManager&); > > ? ? virtual void getAnalysisUsage(AnalysisUsage&) const; > + > + ? ?void print(raw_ostream&, const Module* = 0) const; > + ? ?virtual void print(std::ostream&, const Module* = 0) const; > + ? ?void print(std::ostream *OS, const Module *M = 0) const { > + ? ? ?if (OS) print(*OS, M); > + ? ?} > ? }; // class LoopDependenceAnalysis > > > > Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=74400&r1=74399&r2=74400&view=diff > > ============================================================================== > --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) > +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Sat Jun 27 19:16:08 2009 > @@ -43,5 +43,23 @@ > > ?void LoopDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { > ? AU.setPreservesAll(); > - ?AU.addRequired(); > + ?AU.addRequiredTransitive(); > +} > + > +static void PrintLoopInfo( > + ? ?raw_ostream &OS, const LoopDependenceAnalysis *LDA, const Loop *L) { > + ?if (!L->empty()) return; // ignore non-innermost loops > + > + ?OS << "Loop at depth " << L->getLoopDepth() << ", header block: "; > + ?WriteAsOperand(OS, L->getHeader(), false); > + ?OS << "\n"; > +} > + > +void LoopDependenceAnalysis::print(raw_ostream &OS, const Module*) const { > + ?PrintLoopInfo(OS, this, this->L); > +} > + > +void LoopDependenceAnalysis::print(std::ostream &OS, const Module *M) const { > + ?raw_os_ostream os(OS); > + ?print(os, M); > ?} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- - Devang From devang.patel at gmail.com Mon Jun 29 11:28:29 2009 From: devang.patel at gmail.com (Devang Patel) Date: Mon, 29 Jun 2009 09:28:29 -0700 Subject: [llvm-commits] [llvm] r74401 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp In-Reply-To: <200906280021.n5S0LMGW024672@zion.cs.uiuc.edu> References: <200906280021.n5S0LMGW024672@zion.cs.uiuc.edu> Message-ID: <352a1fb20906290928m32b60b2at3de88f145c5b6520@mail.gmail.com> Andreas, On Sat, Jun 27, 2009 at 5:21 PM, Andreas Bolka wrote: > + > +static inline bool isMemRefInstr(const Value *I) { > + ?return isa(I) || isa(I); > +} > + Pl. use Instruction::mayWriteToMemory() and Instruction::mayReadFromMemory() to check memory reference. - Devang From edwintorok at gmail.com Mon Jun 29 11:29:14 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 29 Jun 2009 19:29:14 +0300 Subject: [llvm-commits] [test-suite] r74425 - in /test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs: gscolor.c gsimage.c iscan.c std.h zarray.c zpacked.c In-Reply-To: <200906291623.n5TGNAFD022740@zion.cs.uiuc.edu> References: <200906291623.n5TGNAFD022740@zion.cs.uiuc.edu> Message-ID: <4A48EBDA.8040509@gmail.com> On 2009-06-29 19:23, Dan Gohman wrote: > Author: djg > Date: Mon Jun 29 11:23:09 2009 > New Revision: 74425 > > URL: http://llvm.org/viewvc/llvm-project?rev=74425&view=rev > Log: > Fix several bugs in MultiSource/Benchmarks/MallocBench/gs. This is enough > to get this test to execute as successfully on x86-64 as it does on x86-32. > Thanks Dan. Does this fix PR2913? Best regards, --Edwin From brukman at cs.uiuc.edu Mon Jun 29 11:43:45 2009 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 29 Jun 2009 11:43:45 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html pubs.js Message-ID: <200906291643.n5TGhjxt023422@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: index.html updated: 1.91 -> 1.92 pubs.js updated: 1.46 -> 1.47 --- Log message: Added a histogram of publications over years as a chart. --- Diffs of the changes: (+56 -3) index.html | 9 ++++++--- pubs.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) Index: llvm-www/pubs/index.html diff -u llvm-www/pubs/index.html:1.91 llvm-www/pubs/index.html:1.92 --- llvm-www/pubs/index.html:1.91 Fri Dec 26 12:43:11 2008 +++ llvm-www/pubs/index.html Mon Jun 29 11:39:50 2009 @@ -1,11 +1,14 @@
LLVM Related Publications
-
-
+ +
- + Index: llvm-www/pubs/pubs.js diff -u llvm-www/pubs/pubs.js:1.46 llvm-www/pubs/pubs.js:1.47 --- llvm-www/pubs/pubs.js:1.46 Mon Jun 29 10:27:34 2009 +++ llvm-www/pubs/pubs.js Mon Jun 29 11:39:51 2009 @@ -858,3 +858,53 @@ } } +/** + * Displays a histogram of publications by year as a chart, using Google Chart + * API. See http://code.google.com/apis/chart/ for more info. + * + * @param {string} id ID of the element that will serve as the parent of + * the chart. + */ +function displayPubsHistogram(id) { + var histogram = {}; + for (var i = 0; i < PUBS.length; ++i) { + var pub = PUBS[i]; + if (isDef(pub.year)) { + if (isDef(histogram[pub.year])) { + histogram[pub.year]++; + } else { + histogram[pub.year] = 1; + } + } + } + + // Sort the years in the histogram map to use for x-axis labels. + var sortedYears = []; + for (var year in histogram) { + sortedYears.push(year); + } + sortedYears.sort(function(a, b) { return a - b; }); + + // Get the data that corresponds to the sorted x-axis labels to be used as + // y-axis data. Also get the max count to use in chart scaling. + var countDataBySortedYear = []; + var maxCount = 0; + for (var i = 0; i < sortedYears.length; ++i) { + var count = histogram[sortedYears[i]]; + countDataBySortedYear.push(count); + maxCount = (count > maxCount) ? count : maxCount; + } + + var container = document.getElementById(id); + var image = document.createElement('img'); + image.src = 'http://www.google.com/chart?cht=bvs' + // vertical bars + '&chs=300x200' + // size + '&chtt=Histogram' + // title + '&chdl=Count' + // label in legend + '&chxt=x,y' + // axes + '&chxl=0:|' + sortedYears.join('|') + // x-axis labels + '&chxr=1,0,' + (maxCount + 5) + // y-axis range + '&chds=0,' + (maxCount + 5) + // scaling + '&chd=t:' + countDataBySortedYear.join(','); // chart data + container.appendChild(image); +} From greened at obbligato.org Mon Jun 29 11:47:30 2009 From: greened at obbligato.org (David Greene) Date: Mon, 29 Jun 2009 16:47:30 -0000 Subject: [llvm-commits] [llvm] r74427 - in /llvm/trunk: include/llvm/CodeGen/ValueTypes.h include/llvm/CodeGen/ValueTypes.td include/llvm/Intrinsics.td lib/Target/X86/X86ISelLowering.cpp lib/VMCore/ValueTypes.cpp utils/TableGen/CodeGenTarget.cpp Message-ID: <200906291647.n5TGlbGj023545@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 29 11:47:10 2009 New Revision: 74427 URL: http://llvm.org/viewvc/llvm-project?rev=74427&view=rev Log: Add more vector ValueTypes for AVX and other extended vector instruction sets. Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h llvm/trunk/include/llvm/CodeGen/ValueTypes.td llvm/trunk/include/llvm/Intrinsics.td llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/VMCore/ValueTypes.cpp llvm/trunk/utils/TableGen/CodeGenTarget.cpp Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=74427&r1=74426&r2=74427&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original) +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Mon Jun 29 11:47:10 2009 @@ -52,29 +52,34 @@ v2i8 = 14, // 2 x i8 v4i8 = 15, // 4 x i8 - v2i16 = 16, // 2 x i16 - v8i8 = 17, // 8 x i8 - v4i16 = 18, // 4 x i16 - v2i32 = 19, // 2 x i32 - v1i64 = 20, // 1 x i64 - v16i8 = 21, // 16 x i8 - v8i16 = 22, // 8 x i16 - v3i32 = 23, // 3 x i32 - v4i32 = 24, // 4 x i32 - v2i64 = 25, // 2 x i64 - - v2f32 = 26, // 2 x f32 - v3f32 = 27, // 3 x f32 - v4f32 = 28, // 4 x f32 - v2f64 = 29, // 2 x f64 - + v8i8 = 16, // 8 x i8 + v16i8 = 17, // 16 x i8 + v32i8 = 18, // 32 x i8 + v2i16 = 19, // 2 x i16 + v4i16 = 20, // 4 x i16 + v8i16 = 21, // 8 x i16 + v16i16 = 22, // 16 x i16 + v2i32 = 23, // 2 x i32 + v3i32 = 24, // 3 x i32 + v4i32 = 25, // 4 x i32 + v8i32 = 26, // 8 x i32 + v1i64 = 27, // 1 x i64 + v2i64 = 28, // 2 x i64 + v4i64 = 29, // 4 x i64 + + v2f32 = 30, // 2 x f32 + v3f32 = 31, // 3 x f32 + v4f32 = 32, // 4 x f32 + v8f32 = 33, // 8 x f32 + v2f64 = 34, // 2 x f64 + v4f64 = 35, // 4 x f64 + FIRST_VECTOR_VALUETYPE = v2i8, - LAST_VECTOR_VALUETYPE = v2f64, + LAST_VECTOR_VALUETYPE = v4f64, - LAST_VALUETYPE = 30, // This always remains at the end of the list. + LAST_VALUETYPE = 36, // This always remains at the end of the list. // This is the current maximum for LAST_VALUETYPE. - // Affects ValueTypeActions in TargetLowering.h. // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors // This value must be a multiple of 32. MAX_ALLOWED_VALUETYPE = 64, @@ -179,28 +184,34 @@ if (NumElements == 4) return v4i8; if (NumElements == 8) return v8i8; if (NumElements == 16) return v16i8; + if (NumElements == 32) return v32i8; break; case i16: if (NumElements == 2) return v2i16; if (NumElements == 4) return v4i16; if (NumElements == 8) return v8i16; + if (NumElements == 16) return v16i16; break; case i32: if (NumElements == 2) return v2i32; if (NumElements == 3) return v3i32; if (NumElements == 4) return v4i32; + if (NumElements == 8) return v8i32; break; case i64: if (NumElements == 1) return v1i64; if (NumElements == 2) return v2i64; + if (NumElements == 4) return v4i64; break; case f32: if (NumElements == 2) return v2f32; if (NumElements == 3) return v3f32; if (NumElements == 4) return v4f32; + if (NumElements == 8) return v8f32; break; case f64: if (NumElements == 2) return v2f64; + if (NumElements == 4) return v4f64; break; } return getExtendedVectorVT(VT, NumElements); @@ -235,15 +246,15 @@ /// isFloatingPoint - Return true if this is a FP, or a vector FP type. bool isFloatingPoint() const { return isSimple() ? - ((V >= f32 && V <= ppcf128) || (V >= v2f32 && V <= v2f64)) : - isExtendedFloatingPoint(); + ((V >= f32 && V <= ppcf128) || + (V >= v2f32 && V <= v4f64)) : isExtendedFloatingPoint(); } /// isInteger - Return true if this is an integer, or a vector integer type. bool isInteger() const { return isSimple() ? ((V >= FIRST_INTEGER_VALUETYPE && V <= LAST_INTEGER_VALUETYPE) || - (V >= v2i8 && V <= v2i64)) : isExtendedInteger(); + (V >= v2i8 && V <= v4i64)) : isExtendedInteger(); } /// isVector - Return true if this is a vector value type. @@ -268,6 +279,13 @@ isExtended128BitVector(); } + /// is256BitVector - Return true if this is a 256-bit vector type. + inline bool is256BitVector() const { + return isSimple() ? + (V==v8f32 || V==v4f64 || V==v32i8 || V==v16i16 || V==v8i32 || + V==v4i64) : isExtended256BitVector(); + } + /// isByteSized - Return true if the bit size is a multiple of 8. bool isByteSized() const { return (getSizeInBits() & 7) == 0; @@ -322,19 +340,25 @@ case v2i8 : case v4i8 : case v8i8 : - case v16i8: return i8; + case v16i8: + case v32i8: return i8; case v2i16: case v4i16: - case v8i16: return i16; + case v8i16: + case v16i16: return i16; case v2i32: case v3i32: - case v4i32: return i32; + case v4i32: + case v8i32: return i32; case v1i64: - case v2i64: return i64; + case v2i64: + case v4i64: return i64; case v2f32: case v3f32: - case v4f32: return f32; - case v2f64: return f64; + case v4f32: + case v8f32: return f32; + case v2f64: + case v4f64: return f64; } } @@ -345,13 +369,19 @@ switch (V) { default: return getExtendedVectorNumElements(); - case v16i8: return 16; + case v32i8: return 32; + case v16i8: + case v16i16: return 16; case v8i8 : - case v8i16: return 8; + case v8i16: + case v8i32: + case v8f32: return 8; case v4i8: case v4i16: case v4i32: - case v4f32: return 4; + case v4i64: + case v4f32: + case v4f64: return 4; case v3i32: case v3f32: return 3; case v2i8: @@ -402,6 +432,12 @@ case v2i64: case v4f32: case v2f64: return 128; + case v32i8: + case v16i16: + case v8i32: + case v4i64: + case v8f32: + case v4f64: return 256; } } @@ -478,6 +514,7 @@ bool isExtendedVector() const; bool isExtended64BitVector() const; bool isExtended128BitVector() const; + bool isExtended256BitVector() const; MVT getExtendedVectorElementType() const; unsigned getExtendedVectorNumElements() const; unsigned getExtendedSizeInBits() const; Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.td?rev=74427&r1=74426&r2=74427&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ValueTypes.td (original) +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.td Mon Jun 29 11:47:10 2009 @@ -33,25 +33,31 @@ def ppcf128: ValueType<128, 11>; // PPC 128-bit floating point value def FlagVT : ValueType<0 , 12>; // Condition code or machine flag def isVoid : ValueType<0 , 13>; // Produces no value + def v2i8 : ValueType<16 , 14>; // 2 x i8 vector value def v4i8 : ValueType<32 , 15>; // 4 x i8 vector value -def v2i16 : ValueType<32 , 16>; // 2 x i16 vector value -def v8i8 : ValueType<64 , 17>; // 8 x i8 vector value -def v4i16 : ValueType<64 , 18>; // 4 x i16 vector value -def v2i32 : ValueType<64 , 19>; // 2 x i32 vector value -def v1i64 : ValueType<64 , 20>; // 1 x i64 vector value - -def v16i8 : ValueType<128, 21>; // 16 x i8 vector value -def v8i16 : ValueType<128, 22>; // 8 x i16 vector value -def v3i32 : ValueType<96 , 23>; // 3 x i32 vector value -def v4i32 : ValueType<128, 24>; // 4 x i32 vector value -def v2i64 : ValueType<128, 25>; // 2 x i64 vector value - -def v2f32 : ValueType<64, 26>; // 2 x f32 vector value -def v3f32 : ValueType<96 , 27>; // 3 x f32 vector value -def v4f32 : ValueType<128, 28>; // 4 x f32 vector value -def v2f64 : ValueType<128, 29>; // 2 x f64 vector value - +def v8i8 : ValueType<64 , 16>; // 8 x i8 vector value +def v16i8 : ValueType<128, 17>; // 16 x i8 vector value +def v32i8 : ValueType<256, 18>; // 32 x i8 vector value +def v2i16 : ValueType<32 , 19>; // 2 x i16 vector value +def v4i16 : ValueType<64 , 20>; // 4 x i16 vector value +def v8i16 : ValueType<128, 21>; // 8 x i16 vector value +def v16i16 : ValueType<256, 22>; // 16 x i16 vector value +def v2i32 : ValueType<64 , 23>; // 2 x i32 vector value +def v3i32 : ValueType<96 , 24>; // 3 x i32 vector value +def v4i32 : ValueType<128, 25>; // 4 x i32 vector value +def v8i32 : ValueType<256, 26>; // 8 x f32 vector value +def v1i64 : ValueType<64 , 27>; // 1 x i64 vector value +def v2i64 : ValueType<128, 28>; // 2 x i64 vector value +def v4i64 : ValueType<256, 29>; // 4 x f64 vector value + +def v2f32 : ValueType<64, 30>; // 2 x f32 vector value +def v3f32 : ValueType<96 , 31>; // 3 x f32 vector value +def v4f32 : ValueType<128, 32>; // 4 x f32 vector value +def v8f32 : ValueType<256, 33>; // 8 x f32 vector value +def v2f64 : ValueType<128, 34>; // 2 x f64 vector value +def v4f64 : ValueType<256, 35>; // 4 x f64 vector value + // Pseudo valuetype mapped to the current pointer size to any address space. // Should only be used in TableGen. def iPTRAny : ValueType<0, 252>; Modified: llvm/trunk/include/llvm/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=74427&r1=74426&r2=74427&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.td (original) +++ llvm/trunk/include/llvm/Intrinsics.td Mon Jun 29 11:47:10 2009 @@ -110,22 +110,32 @@ def llvm_empty_ty : LLVMType; // { } def llvm_descriptor_ty : LLVMPointerType; // { }* +def llvm_v2i8_ty : LLVMType; // 2 x i8 +def llvm_v4i8_ty : LLVMType; // 4 x i8 +def llvm_v8i8_ty : LLVMType; // 8 x i8 def llvm_v16i8_ty : LLVMType; // 16 x i8 +def llvm_v32i8_ty : LLVMType; // 32 x i8 +def llvm_v2i16_ty : LLVMType; // 4 x i16 +def llvm_v4i16_ty : LLVMType; // 4 x i16 def llvm_v8i16_ty : LLVMType; // 8 x i16 -def llvm_v2i64_ty : LLVMType; // 2 x i64 +def llvm_v16i16_ty : LLVMType; // 16 x i16 def llvm_v2i32_ty : LLVMType; // 2 x i32 -def llvm_v1i64_ty : LLVMType; // 1 x i64 def llvm_v4i32_ty : LLVMType; // 4 x i32 +def llvm_v8i32_ty : LLVMType; // 8 x i32 +def llvm_v1i64_ty : LLVMType; // 1 x i64 +def llvm_v2i64_ty : LLVMType; // 2 x i64 +def llvm_v4i64_ty : LLVMType; // 4 x i64 + def llvm_v2f32_ty : LLVMType; // 2 x float +def llvm_v3f32_ty : LLVMType; // 3 x float def llvm_v4f32_ty : LLVMType; // 4 x float +def llvm_v8f32_ty : LLVMType; // 8 x float def llvm_v2f64_ty : LLVMType; // 2 x double - -// MMX Vector Types -def llvm_v8i8_ty : LLVMType; // 8 x i8 -def llvm_v4i16_ty : LLVMType; // 4 x i16 +def llvm_v4f64_ty : LLVMType; // 4 x double def llvm_vararg_ty : LLVMType; // this means vararg here + //===----------------------------------------------------------------------===// // Intrinsic Definitions. //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74427&r1=74426&r2=74427&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 29 11:47:10 2009 @@ -700,6 +700,9 @@ // Do not attempt to custom lower non-power-of-2 vectors if (!isPowerOf2_32(VT.getVectorNumElements())) continue; + // Do not attempt to custom lower non-128-bit vectors + if (!VT.is128BitVector()) + continue; setOperationAction(ISD::BUILD_VECTOR, VT, Custom); setOperationAction(ISD::VECTOR_SHUFFLE, VT, Custom); setOperationAction(ISD::EXTRACT_VECTOR_ELT, VT, Custom); @@ -718,17 +721,23 @@ } // Promote v16i8, v8i16, v4i32 load, select, and, or, xor to v2i64. - for (unsigned VT = (unsigned)MVT::v16i8; VT != (unsigned)MVT::v2i64; VT++) { - setOperationAction(ISD::AND, (MVT::SimpleValueType)VT, Promote); - AddPromotedToType (ISD::AND, (MVT::SimpleValueType)VT, MVT::v2i64); - setOperationAction(ISD::OR, (MVT::SimpleValueType)VT, Promote); - AddPromotedToType (ISD::OR, (MVT::SimpleValueType)VT, MVT::v2i64); - setOperationAction(ISD::XOR, (MVT::SimpleValueType)VT, Promote); - AddPromotedToType (ISD::XOR, (MVT::SimpleValueType)VT, MVT::v2i64); - setOperationAction(ISD::LOAD, (MVT::SimpleValueType)VT, Promote); - AddPromotedToType (ISD::LOAD, (MVT::SimpleValueType)VT, MVT::v2i64); - setOperationAction(ISD::SELECT, (MVT::SimpleValueType)VT, Promote); - AddPromotedToType (ISD::SELECT, (MVT::SimpleValueType)VT, MVT::v2i64); + for (unsigned i = (unsigned)MVT::v16i8; i != (unsigned)MVT::v2i64; i++) { + MVT VT = (MVT::SimpleValueType)i; + + // Do not attempt to promote non-128-bit vectors + if (!VT.is128BitVector()) { + continue; + } + setOperationAction(ISD::AND, VT, Promote); + AddPromotedToType (ISD::AND, VT, MVT::v2i64); + setOperationAction(ISD::OR, VT, Promote); + AddPromotedToType (ISD::OR, VT, MVT::v2i64); + setOperationAction(ISD::XOR, VT, Promote); + AddPromotedToType (ISD::XOR, VT, MVT::v2i64); + setOperationAction(ISD::LOAD, VT, Promote); + AddPromotedToType (ISD::LOAD, VT, MVT::v2i64); + setOperationAction(ISD::SELECT, VT, Promote); + AddPromotedToType (ISD::SELECT, VT, MVT::v2i64); } setTruncStoreAction(MVT::f64, MVT::f32, Expand); @@ -775,6 +784,109 @@ setOperationAction(ISD::VSETCC, MVT::v2i64, Custom); } + if (!UseSoftFloat && Subtarget->hasAVX()) { + setOperationAction(ISD::LOAD, MVT::v8f32, Legal); + setOperationAction(ISD::LOAD, MVT::v8i32, Legal); + setOperationAction(ISD::LOAD, MVT::v4f64, Legal); + setOperationAction(ISD::LOAD, MVT::v4i64, Legal); + setOperationAction(ISD::FADD, MVT::v8f32, Legal); + setOperationAction(ISD::FSUB, MVT::v8f32, Legal); + setOperationAction(ISD::FMUL, MVT::v8f32, Legal); + setOperationAction(ISD::FDIV, MVT::v8f32, Legal); + setOperationAction(ISD::FSQRT, MVT::v8f32, Legal); + setOperationAction(ISD::FNEG, MVT::v8f32, Custom); + //setOperationAction(ISD::BUILD_VECTOR, MVT::v8f32, Custom); + //setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v8f32, Custom); + //setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v8f32, Custom); + //setOperationAction(ISD::SELECT, MVT::v8f32, Custom); + //setOperationAction(ISD::VSETCC, MVT::v8f32, Custom); + + // Operations to consider commented out -v16i16 v32i8 + //setOperationAction(ISD::ADD, MVT::v16i16, Legal); + setOperationAction(ISD::ADD, MVT::v8i32, Custom); + setOperationAction(ISD::ADD, MVT::v4i64, Custom); + //setOperationAction(ISD::SUB, MVT::v32i8, Legal); + //setOperationAction(ISD::SUB, MVT::v16i16, Legal); + setOperationAction(ISD::SUB, MVT::v8i32, Custom); + setOperationAction(ISD::SUB, MVT::v4i64, Custom); + //setOperationAction(ISD::MUL, MVT::v16i16, Legal); + setOperationAction(ISD::FADD, MVT::v4f64, Legal); + setOperationAction(ISD::FSUB, MVT::v4f64, Legal); + setOperationAction(ISD::FMUL, MVT::v4f64, Legal); + setOperationAction(ISD::FDIV, MVT::v4f64, Legal); + setOperationAction(ISD::FSQRT, MVT::v4f64, Legal); + setOperationAction(ISD::FNEG, MVT::v4f64, Custom); + + setOperationAction(ISD::VSETCC, MVT::v4f64, Custom); + // setOperationAction(ISD::VSETCC, MVT::v32i8, Custom); + // setOperationAction(ISD::VSETCC, MVT::v16i16, Custom); + setOperationAction(ISD::VSETCC, MVT::v8i32, Custom); + + // setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v32i8, Custom); + // setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v16i16, Custom); + // setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v16i16, Custom); + setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v8i32, Custom); + setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v8f32, Custom); + + setOperationAction(ISD::BUILD_VECTOR, MVT::v4f64, Custom); + setOperationAction(ISD::BUILD_VECTOR, MVT::v4i64, Custom); + setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v4f64, Custom); + setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v4i64, Custom); + setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4f64, Custom); + setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v4f64, Custom); + +#if 0 + // Not sure we want to do this since there are no 256-bit integer + // operations in AVX + + // Custom lower build_vector, vector_shuffle, and extract_vector_elt. + // This includes 256-bit vectors + for (unsigned i = (unsigned)MVT::v16i8; i != (unsigned)MVT::v4i64; ++i) { + MVT VT = (MVT::SimpleValueType)i; + + // Do not attempt to custom lower non-power-of-2 vectors + if (!isPowerOf2_32(VT.getVectorNumElements())) + continue; + + setOperationAction(ISD::BUILD_VECTOR, VT, Custom); + setOperationAction(ISD::VECTOR_SHUFFLE, VT, Custom); + setOperationAction(ISD::EXTRACT_VECTOR_ELT, VT, Custom); + } + + if (Subtarget->is64Bit()) { + setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4i64, Custom); + setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v4i64, Custom); + } +#endif + +#if 0 + // Not sure we want to do this since there are no 256-bit integer + // operations in AVX + + // Promote v32i8, v16i16, v8i32 load, select, and, or, xor to v4i64. + // Including 256-bit vectors + for (unsigned i = (unsigned)MVT::v16i8; i != (unsigned)MVT::v4i64; i++) { + MVT VT = (MVT::SimpleValueType)i; + + if (!VT.is256BitVector()) { + continue; + } + setOperationAction(ISD::AND, VT, Promote); + AddPromotedToType (ISD::AND, VT, MVT::v4i64); + setOperationAction(ISD::OR, VT, Promote); + AddPromotedToType (ISD::OR, VT, MVT::v4i64); + setOperationAction(ISD::XOR, VT, Promote); + AddPromotedToType (ISD::XOR, VT, MVT::v4i64); + setOperationAction(ISD::LOAD, VT, Promote); + AddPromotedToType (ISD::LOAD, VT, MVT::v4i64); + setOperationAction(ISD::SELECT, VT, Promote); + AddPromotedToType (ISD::SELECT, VT, MVT::v4i64); + } + + setTruncStoreAction(MVT::f64, MVT::f32, Expand); +#endif + } + // We want to custom lower some of our intrinsics. setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom); Modified: llvm/trunk/lib/VMCore/ValueTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ValueTypes.cpp?rev=74427&r1=74426&r2=74427&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ValueTypes.cpp (original) +++ llvm/trunk/lib/VMCore/ValueTypes.cpp Mon Jun 29 11:47:10 2009 @@ -54,6 +54,10 @@ return isExtendedVector() && getSizeInBits() == 128; } +bool MVT::isExtended256BitVector() const { + return isExtendedVector() && getSizeInBits() == 256; +} + MVT MVT::getExtendedVectorElementType() const { assert(isExtended() && "Type is not extended!"); return MVT::getMVT(cast(LLVMTy)->getElementType()); @@ -101,20 +105,26 @@ case MVT::Flag: return "flag"; case MVT::v2i8: return "v2i8"; case MVT::v4i8: return "v4i8"; - case MVT::v2i16: return "v2i16"; case MVT::v8i8: return "v8i8"; - case MVT::v4i16: return "v4i16"; - case MVT::v2i32: return "v2i32"; - case MVT::v1i64: return "v1i64"; case MVT::v16i8: return "v16i8"; + case MVT::v32i8: return "v32i8"; + case MVT::v2i16: return "v2i16"; + case MVT::v4i16: return "v4i16"; case MVT::v8i16: return "v8i16"; + case MVT::v16i16: return "v16i16"; + case MVT::v2i32: return "v2i32"; + case MVT::v3i32: return "v3i32"; case MVT::v4i32: return "v4i32"; + case MVT::v8i32: return "v8i32"; + case MVT::v1i64: return "v1i64"; case MVT::v2i64: return "v2i64"; + case MVT::v4i64: return "v4i64"; case MVT::v2f32: return "v2f32"; + case MVT::v3f32: return "v3f32"; case MVT::v4f32: return "v4f32"; + case MVT::v8f32: return "v8f32"; case MVT::v2f64: return "v2f64"; - case MVT::v3i32: return "v3i32"; - case MVT::v3f32: return "v3f32"; + case MVT::v4f64: return "v4f64"; } } @@ -140,21 +150,27 @@ case MVT::ppcf128: return Type::PPC_FP128Ty; case MVT::v2i8: return VectorType::get(Type::Int8Ty, 2); case MVT::v4i8: return VectorType::get(Type::Int8Ty, 4); - case MVT::v2i16: return VectorType::get(Type::Int16Ty, 2); case MVT::v8i8: return VectorType::get(Type::Int8Ty, 8); + case MVT::v16i8: return VectorType::get(Type::Int8Ty, 16); + case MVT::v32i8: return VectorType::get(Type::Int8Ty, 32); + case MVT::v2i16: return VectorType::get(Type::Int16Ty, 2); case MVT::v4i16: return VectorType::get(Type::Int16Ty, 4); + case MVT::v8i16: return VectorType::get(Type::Int16Ty, 16); + case MVT::v16i16: return VectorType::get(Type::Int16Ty, 8); case MVT::v2i32: return VectorType::get(Type::Int32Ty, 2); - case MVT::v1i64: return VectorType::get(Type::Int64Ty, 1); - case MVT::v16i8: return VectorType::get(Type::Int8Ty, 16); - case MVT::v8i16: return VectorType::get(Type::Int16Ty, 8); + case MVT::v3i32: return VectorType::get(Type::Int32Ty, 3); case MVT::v4i32: return VectorType::get(Type::Int32Ty, 4); + case MVT::v8i32: return VectorType::get(Type::Int32Ty, 8); + case MVT::v1i64: return VectorType::get(Type::Int64Ty, 1); case MVT::v2i64: return VectorType::get(Type::Int64Ty, 2); + case MVT::v4i64: return VectorType::get(Type::Int64Ty, 4); case MVT::v2f32: return VectorType::get(Type::FloatTy, 2); + case MVT::v3f32: return VectorType::get(Type::FloatTy, 3); case MVT::v4f32: return VectorType::get(Type::FloatTy, 4); + case MVT::v8f32: return VectorType::get(Type::FloatTy, 8); case MVT::v2f64: return VectorType::get(Type::DoubleTy, 2); - case MVT::v3i32: return VectorType::get(Type::Int32Ty, 3); - case MVT::v3f32: return VectorType::get(Type::FloatTy, 3); - } + case MVT::v4f64: return VectorType::get(Type::DoubleTy, 4); + } } /// getMVT - Return the value type corresponding to the specified type. This Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=74427&r1=74426&r2=74427&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Mon Jun 29 11:47:10 2009 @@ -53,18 +53,24 @@ case MVT::isVoid:return "MVT::isVoid"; case MVT::v2i8: return "MVT::v2i8"; case MVT::v4i8: return "MVT::v4i8"; - case MVT::v2i16: return "MVT::v2i16"; case MVT::v8i8: return "MVT::v8i8"; - case MVT::v4i16: return "MVT::v4i16"; - case MVT::v2i32: return "MVT::v2i32"; - case MVT::v1i64: return "MVT::v1i64"; case MVT::v16i8: return "MVT::v16i8"; + case MVT::v32i8: return "MVT::v32i8"; + case MVT::v2i16: return "MVT::v2i16"; + case MVT::v4i16: return "MVT::v4i16"; case MVT::v8i16: return "MVT::v8i16"; + case MVT::v16i16: return "MVT::v16i16"; + case MVT::v2i32: return "MVT::v2i32"; case MVT::v4i32: return "MVT::v4i32"; + case MVT::v8i32: return "MVT::v8i32"; + case MVT::v1i64: return "MVT::v1i64"; case MVT::v2i64: return "MVT::v2i64"; + case MVT::v4i64: return "MVT::v4i64"; case MVT::v2f32: return "MVT::v2f32"; case MVT::v4f32: return "MVT::v4f32"; + case MVT::v8f32: return "MVT::v8f32"; case MVT::v2f64: return "MVT::v2f64"; + case MVT::v4f64: return "MVT::v4f64"; case MVT::v3i32: return "MVT::v3i32"; case MVT::v3f32: return "MVT::v3f32"; case MVT::iPTR: return "TLI.getPointerTy()"; @@ -93,18 +99,24 @@ case MVT::isVoid:return "MVT::isVoid"; case MVT::v2i8: return "MVT::v2i8"; case MVT::v4i8: return "MVT::v4i8"; - case MVT::v2i16: return "MVT::v2i16"; case MVT::v8i8: return "MVT::v8i8"; - case MVT::v4i16: return "MVT::v4i16"; - case MVT::v2i32: return "MVT::v2i32"; - case MVT::v1i64: return "MVT::v1i64"; case MVT::v16i8: return "MVT::v16i8"; + case MVT::v32i8: return "MVT::v32i8"; + case MVT::v2i16: return "MVT::v2i16"; + case MVT::v4i16: return "MVT::v4i16"; case MVT::v8i16: return "MVT::v8i16"; + case MVT::v16i16: return "MVT::v16i16"; + case MVT::v2i32: return "MVT::v2i32"; case MVT::v4i32: return "MVT::v4i32"; + case MVT::v8i32: return "MVT::v8i32"; + case MVT::v1i64: return "MVT::v1i64"; case MVT::v2i64: return "MVT::v2i64"; + case MVT::v4i64: return "MVT::v4i64"; case MVT::v2f32: return "MVT::v2f32"; case MVT::v4f32: return "MVT::v4f32"; + case MVT::v8f32: return "MVT::v8f32"; case MVT::v2f64: return "MVT::v2f64"; + case MVT::v4f64: return "MVT::v4f64"; case MVT::v3i32: return "MVT::v3i32"; case MVT::v3f32: return "MVT::v3f32"; case MVT::iPTR: return "MVT::iPTR"; From greened at obbligato.org Mon Jun 29 11:51:02 2009 From: greened at obbligato.org (David Greene) Date: Mon, 29 Jun 2009 16:51:02 -0000 Subject: [llvm-commits] [llvm] r74428 - /llvm/trunk/lib/Target/X86/X86Subtarget.h Message-ID: <200906291651.n5TGp26Q023651@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 29 11:51:01 2009 New Revision: 74428 URL: http://llvm.org/viewvc/llvm-project?rev=74428&view=rev Log: Fix a subtarget feature bug. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=74428&r1=74427&r2=74428&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Mon Jun 29 11:51:01 2009 @@ -142,7 +142,7 @@ bool hasSSE4A() const { return HasSSE4A; } bool has3DNow() const { return X863DNowLevel >= ThreeDNow; } bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; } - bool hasAVX() const { return hasAVX(); } + bool hasAVX() const { return HasAVX; } bool hasFMA3() const { return HasFMA3; } bool hasFMA4() const { return HasFMA4; } From greened at obbligato.org Mon Jun 29 11:54:07 2009 From: greened at obbligato.org (David Greene) Date: Mon, 29 Jun 2009 16:54:07 -0000 Subject: [llvm-commits] [llvm] r74429 - /llvm/trunk/lib/Target/X86/X86.td Message-ID: <200906291654.n5TGs7VZ023736@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 29 11:54:06 2009 New Revision: 74429 URL: http://llvm.org/viewvc/llvm-project?rev=74429&view=rev Log: Add processor descriptions for Istanbul and Shanghai. Modified: llvm/trunk/lib/Target/X86/X86.td Modified: llvm/trunk/lib/Target/X86/X86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev=74429&r1=74428&r2=74429&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.td (original) +++ llvm/trunk/lib/Target/X86/X86.td Mon Jun 29 11:54:06 2009 @@ -119,6 +119,10 @@ Feature3DNowA, Feature64Bit, FeatureSlowBTMem]>; def : Proc<"barcelona", [FeatureSSE3, FeatureSSE4A, Feature3DNowA, Feature64Bit, FeatureSlowBTMem]>; +def : Proc<"istanbul", [Feature3DNowA, Feature64Bit, FeatureSSE4A, + Feature3DNowA]>; +def : Proc<"shanghai", [Feature3DNowA, Feature64Bit, FeatureSSE4A, + Feature3DNowA]>; def : Proc<"winchip-c6", [FeatureMMX]>; def : Proc<"winchip2", [FeatureMMX, Feature3DNow]>; From sebastian.redl at getdesigned.at Mon Jun 29 12:12:17 2009 From: sebastian.redl at getdesigned.at (Sebastian Redl) Date: Mon, 29 Jun 2009 17:12:17 -0000 Subject: [llvm-commits] [llvm] r74430 - in /llvm/trunk/include/llvm: ADT/PointerUnion.h Bitcode/BitstreamReader.h Message-ID: <200906291712.n5THCItF024252@zion.cs.uiuc.edu> Author: cornedbee Date: Mon Jun 29 12:12:06 2009 New Revision: 74430 URL: http://llvm.org/viewvc/llvm-project?rev=74430&view=rev Log: Fix three MSVC 2008 warnings that completely clutter the build output. Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=74430&r1=74429&r2=74430&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/PointerUnion.h (original) +++ llvm/trunk/include/llvm/ADT/PointerUnion.h Mon Jun 29 12:12:06 2009 @@ -89,7 +89,7 @@ int is() const { int TyNo = ::llvm::getPointerUnionTypeNum((T*)0); assert(TyNo != -1 && "Type query could never succeed on PointerUnion!"); - return Val.getInt() == TyNo; + return static_cast(Val.getInt()) == TyNo; } /// get() - Return the value of the specified pointer type. If the Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=74430&r1=74429&r2=74430&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original) +++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Mon Jun 29 12:12:06 2009 @@ -324,7 +324,7 @@ uint64_t ReadVBR64(unsigned NumBits) { uint64_t Piece = Read(NumBits); - if ((Piece & (1U << (NumBits-1))) == 0) + if ((Piece & (uint64_t(1) << (NumBits-1))) == 0) return Piece; uint64_t Result = 0; @@ -332,7 +332,7 @@ while (1) { Result |= (Piece & ((1U << (NumBits-1))-1)) << NextBit; - if ((Piece & (1U << (NumBits-1))) == 0) + if ((Piece & (uint64_t(1) << (NumBits-1))) == 0) return Result; NextBit += NumBits-1; From gohman at apple.com Mon Jun 29 12:34:24 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Jun 2009 10:34:24 -0700 Subject: [llvm-commits] [test-suite] r74425 - in /test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs: gscolor.c gsimage.c iscan.c std.h zarray.c zpacked.c In-Reply-To: <4A48EBDA.8040509@gmail.com> References: <200906291623.n5TGNAFD022740@zion.cs.uiuc.edu> <4A48EBDA.8040509@gmail.com> Message-ID: <6AC58880-64FD-4FCB-B6D6-71DD92F2F282@apple.com> On Jun 29, 2009, at 9:29 AM, T?r?k Edwin wrote: > On 2009-06-29 19:23, Dan Gohman wrote: > >> Author: djg >> >> Date: Mon Jun 29 11:23:09 2009 >> >> New Revision: 74425 >> >> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74425&view=rev >> >> Log: >> >> Fix several bugs in MultiSource/Benchmarks/MallocBench/gs. This is >> enough >> >> to get this test to execute as successfully on x86-64 as it does on >> x86-32. >> >> >> > > Thanks Dan. Does this fix PR2913? Yes, thanks. Dan From jyasskin at google.com Mon Jun 29 12:52:33 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Mon, 29 Jun 2009 10:52:33 -0700 Subject: [llvm-commits] Adding a portable strerror*() wrapper, llvm::sys::StrError() Message-ID: My oprofile patch calls some functions that report errors through errno, and since strerror_r changes its behavior depending on GNU_SOURCE and other #defines, I figured it would be nice to have a portable wrapper in llvm/System/Errno.h. I included the windows version, strerror_s, even though I can't test it. This won't do quite the right thing on cmake builds--although it will run successfully--since cmake doesn't define HAVE_STRERROR*. I wasn't sure quite what to do with MakeErrStr. I'd be perfectly happy with that as the interface in Errno.h, but it does different things on Windows and Unix, and I didn't want a public function to be ambiguous like that. Tested with `make check` on Ubuntu and OS X. Jeffrey -------------- next part -------------- A non-text attachment was scrubbed... Name: errno.patch Type: text/x-patch Size: 11945 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090629/72c27ce7/attachment.bin From natebegeman at mac.com Mon Jun 29 12:56:23 2009 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 29 Jun 2009 10:56:23 -0700 Subject: [llvm-commits] [llvm] r74429 - /llvm/trunk/lib/Target/X86/X86.td In-Reply-To: <200906291654.n5TGs7VZ023736@zion.cs.uiuc.edu> References: <200906291654.n5TGs7VZ023736@zion.cs.uiuc.edu> Message-ID: On Jun 29, 2009, at 9:54 AM, David Greene wrote: > Author: greened > Date: Mon Jun 29 11:54:06 2009 > New Revision: 74429 > > URL: http://llvm.org/viewvc/llvm-project?rev=74429&view=rev > Log: > > Add processor descriptions for Istanbul and Shanghai. > > Modified: > llvm/trunk/lib/Target/X86/X86.td > > Modified: llvm/trunk/lib/Target/X86/X86.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev=74429&r1=74428&r2=74429&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86.td (original) > +++ llvm/trunk/lib/Target/X86/X86.td Mon Jun 29 11:54:06 2009 > @@ -119,6 +119,10 @@ > Feature3DNowA, Feature64Bit, > FeatureSlowBTMem]>; > def : Proc<"barcelona", [FeatureSSE3, FeatureSSE4A, > Feature3DNowA, Feature64Bit, > FeatureSlowBTMem]>; > +def : Proc<"istanbul", [Feature3DNowA, Feature64Bit, > FeatureSSE4A, > + Feature3DNowA]>; > +def : Proc<"shanghai", [Feature3DNowA, Feature64Bit, > FeatureSSE4A, > + Feature3DNowA]>; Is there some reason to have both, since they have the exact same feature strings? Typically we've avoided added every Intel variant that has the same features as a previous one. Nate From resistor at mac.com Mon Jun 29 13:04:54 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 29 Jun 2009 18:04:54 -0000 Subject: [llvm-commits] [llvm] r74435 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200906291804.n5TI4x7T026129@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 29 13:04:45 2009 New Revision: 74435 URL: http://llvm.org/viewvc/llvm-project?rev=74435&view=rev Log: Add a target-specific DAG combine on X86 to fold the common pattern of fence-atomic-fence down to just the atomic op. This is possible thanks to X86's relatively strong memory model, which guarantees that locked instructions (which are used to implement atomics) are implicit fences. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74435&r1=74434&r2=74435&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 29 13:04:45 2009 @@ -917,6 +917,7 @@ setTargetDAGCombine(ISD::SRA); setTargetDAGCombine(ISD::SRL); setTargetDAGCombine(ISD::STORE); + setTargetDAGCombine(ISD::MEMBARRIER); if (Subtarget->is64Bit()) setTargetDAGCombine(ISD::MUL); @@ -8566,6 +8567,58 @@ return SDValue(); } +// On X86 and X86-64, atomic operations are lowered to locked instructions. +// Locked instructions, in turn, have implicit fence semantics (all memory +// operations are flushed before issuing the locked instruction, and the +// are not buffered), so we can fold away the common pattern of +// fence-atomic-fence. +static SDValue PerformMEMBARRIERCombine(SDNode* N, SelectionDAG &DAG) { + SDValue atomic = N->getOperand(0); + switch (atomic.getOpcode()) { + case ISD::ATOMIC_CMP_SWAP: + case ISD::ATOMIC_SWAP: + case ISD::ATOMIC_LOAD_ADD: + case ISD::ATOMIC_LOAD_SUB: + case ISD::ATOMIC_LOAD_AND: + case ISD::ATOMIC_LOAD_OR: + case ISD::ATOMIC_LOAD_XOR: + case ISD::ATOMIC_LOAD_NAND: + case ISD::ATOMIC_LOAD_MIN: + case ISD::ATOMIC_LOAD_MAX: + case ISD::ATOMIC_LOAD_UMIN: + case ISD::ATOMIC_LOAD_UMAX: + break; + default: + return SDValue(); + } + + SDValue fence = atomic.getOperand(0); + if (fence.getOpcode() != ISD::MEMBARRIER) + return SDValue(); + + switch (atomic.getOpcode()) { + case ISD::ATOMIC_CMP_SWAP: + return DAG.UpdateNodeOperands(atomic, fence.getOperand(0), + atomic.getOperand(1), atomic.getOperand(2), + atomic.getOperand(3)); + case ISD::ATOMIC_SWAP: + case ISD::ATOMIC_LOAD_ADD: + case ISD::ATOMIC_LOAD_SUB: + case ISD::ATOMIC_LOAD_AND: + case ISD::ATOMIC_LOAD_OR: + case ISD::ATOMIC_LOAD_XOR: + case ISD::ATOMIC_LOAD_NAND: + case ISD::ATOMIC_LOAD_MIN: + case ISD::ATOMIC_LOAD_MAX: + case ISD::ATOMIC_LOAD_UMIN: + case ISD::ATOMIC_LOAD_UMAX: + return DAG.UpdateNodeOperands(atomic, fence.getOperand(0), + atomic.getOperand(1), atomic.getOperand(2)); + default: + return SDValue(); + } +} + SDValue X86TargetLowering::PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const { SelectionDAG &DAG = DCI.DAG; @@ -8584,6 +8637,7 @@ case X86ISD::FAND: return PerformFANDCombine(N, DAG); case X86ISD::BT: return PerformBTCombine(N, DAG, DCI); case X86ISD::VZEXT_MOVL: return PerformVZEXT_MOVLCombine(N, DAG); + case ISD::MEMBARRIER: return PerformMEMBARRIERCombine(N, DAG); } return SDValue(); From resistor at mac.com Mon Jun 29 13:07:30 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 29 Jun 2009 18:07:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74436 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906291807.n5TI7UeN026227@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 29 13:07:26 2009 New Revision: 74436 URL: http://llvm.org/viewvc/llvm-project?rev=74436&view=rev Log: It's not readily clear to me whether the semantics of GCC atomics require a flush of cached memory, or of all memory, so let's err on the side of caution for now. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74436&r1=74435&r2=74436&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jun 29 13:07:26 2009 @@ -4468,7 +4468,7 @@ C[2] = ConstantInt::get(Type::Int1Ty, sl); C[3] = ConstantInt::get(Type::Int1Ty, ss); // We assume like gcc appears to, that this only applies to cached memory. - C[4] = ConstantInt::get(Type::Int1Ty, false); + C[4] = ConstantInt::get(Type::Int1Ty, true); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memory_barrier), From resistor at mac.com Mon Jun 29 13:07:41 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 29 Jun 2009 11:07:41 -0700 Subject: [llvm-commits] [llvm] r74435 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <200906291804.n5TI4x7T026129@zion.cs.uiuc.edu> References: <200906291804.n5TI4x7T026129@zion.cs.uiuc.edu> Message-ID: Thanks to Dan for helping me with this patch. --Owen On Jun 29, 2009, at 11:04 AM, Owen Anderson wrote: > Author: resistor > Date: Mon Jun 29 13:04:45 2009 > New Revision: 74435 > > URL: http://llvm.org/viewvc/llvm-project?rev=74435&view=rev > Log: > Add a target-specific DAG combine on X86 to fold the common pattern of > fence-atomic-fence down to just the atomic op. This is possible > thanks to > X86's relatively strong memory model, which guarantees that locked > instructions > (which are used to implement atomics) are implicit fences. > > Modified: > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74435&r1=74434&r2=74435&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 29 > 13:04:45 2009 > @@ -917,6 +917,7 @@ > setTargetDAGCombine(ISD::SRA); > setTargetDAGCombine(ISD::SRL); > setTargetDAGCombine(ISD::STORE); > + setTargetDAGCombine(ISD::MEMBARRIER); > if (Subtarget->is64Bit()) > setTargetDAGCombine(ISD::MUL); > > @@ -8566,6 +8567,58 @@ > return SDValue(); > } > > +// On X86 and X86-64, atomic operations are lowered to locked > instructions. > +// Locked instructions, in turn, have implicit fence semantics (all > memory > +// operations are flushed before issuing the locked instruction, > and the > +// are not buffered), so we can fold away the common pattern of > +// fence-atomic-fence. > +static SDValue PerformMEMBARRIERCombine(SDNode* N, SelectionDAG > &DAG) { > + SDValue atomic = N->getOperand(0); > + switch (atomic.getOpcode()) { > + case ISD::ATOMIC_CMP_SWAP: > + case ISD::ATOMIC_SWAP: > + case ISD::ATOMIC_LOAD_ADD: > + case ISD::ATOMIC_LOAD_SUB: > + case ISD::ATOMIC_LOAD_AND: > + case ISD::ATOMIC_LOAD_OR: > + case ISD::ATOMIC_LOAD_XOR: > + case ISD::ATOMIC_LOAD_NAND: > + case ISD::ATOMIC_LOAD_MIN: > + case ISD::ATOMIC_LOAD_MAX: > + case ISD::ATOMIC_LOAD_UMIN: > + case ISD::ATOMIC_LOAD_UMAX: > + break; > + default: > + return SDValue(); > + } > + > + SDValue fence = atomic.getOperand(0); > + if (fence.getOpcode() != ISD::MEMBARRIER) > + return SDValue(); > + > + switch (atomic.getOpcode()) { > + case ISD::ATOMIC_CMP_SWAP: > + return DAG.UpdateNodeOperands(atomic, fence.getOperand(0), > + atomic.getOperand(1), > atomic.getOperand(2), > + atomic.getOperand(3)); > + case ISD::ATOMIC_SWAP: > + case ISD::ATOMIC_LOAD_ADD: > + case ISD::ATOMIC_LOAD_SUB: > + case ISD::ATOMIC_LOAD_AND: > + case ISD::ATOMIC_LOAD_OR: > + case ISD::ATOMIC_LOAD_XOR: > + case ISD::ATOMIC_LOAD_NAND: > + case ISD::ATOMIC_LOAD_MIN: > + case ISD::ATOMIC_LOAD_MAX: > + case ISD::ATOMIC_LOAD_UMIN: > + case ISD::ATOMIC_LOAD_UMAX: > + return DAG.UpdateNodeOperands(atomic, fence.getOperand(0), > + atomic.getOperand(1), > atomic.getOperand(2)); > + default: > + return SDValue(); > + } > +} > + > SDValue X86TargetLowering::PerformDAGCombine(SDNode *N, > DAGCombinerInfo &DCI) > const { > SelectionDAG &DAG = DCI.DAG; > @@ -8584,6 +8637,7 @@ > case X86ISD::FAND: return PerformFANDCombine(N, DAG); > case X86ISD::BT: return PerformBTCombine(N, DAG, DCI); > case X86ISD::VZEXT_MOVL: return PerformVZEXT_MOVLCombine(N, DAG); > + case ISD::MEMBARRIER: return PerformMEMBARRIERCombine(N, DAG); > } > > return SDValue(); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From edwintorok at gmail.com Mon Jun 29 13:09:51 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 29 Jun 2009 21:09:51 +0300 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html pubs.js In-Reply-To: <200906291643.n5TGhjxt023422@zion.cs.uiuc.edu> References: <200906291643.n5TGhjxt023422@zion.cs.uiuc.edu> Message-ID: <4A49036F.7010308@gmail.com> On 2009-06-29 19:43, Misha Brukman wrote: > Changes in directory llvm-www/pubs: > > index.html updated: 1.91 -> 1.92 > pubs.js updated: 1.46 -> 1.47 > --- > Log message: > > Added a histogram of publications over years as a chart. > Sounds cool, where can I see the histogram? It doesn't show up in my firefox. Best regards, --Edwin From dag at cray.com Mon Jun 29 13:14:13 2009 From: dag at cray.com (David Greene) Date: Mon, 29 Jun 2009 13:14:13 -0500 Subject: [llvm-commits] [llvm] r74429 - /llvm/trunk/lib/Target/X86/X86.td In-Reply-To: References: <200906291654.n5TGs7VZ023736@zion.cs.uiuc.edu> Message-ID: <200906291314.14524.dag@cray.com> On Monday 29 June 2009 12:56, Nate Begeman wrote: > On Jun 29, 2009, at 9:54 AM, David Greene wrote: > > Author: greened > > Date: Mon Jun 29 11:54:06 2009 > > New Revision: 74429 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=74429&view=rev > > Log: > > > > Add processor descriptions for Istanbul and Shanghai. > > > > Modified: > > llvm/trunk/lib/Target/X86/X86.td > > > > Modified: llvm/trunk/lib/Target/X86/X86.td > > URL: > > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev= > >74429&r1=74428&r2=74429&view=diff > > > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- llvm/trunk/lib/Target/X86/X86.td (original) > > +++ llvm/trunk/lib/Target/X86/X86.td Mon Jun 29 11:54:06 2009 > > @@ -119,6 +119,10 @@ > > Feature3DNowA, Feature64Bit, > > FeatureSlowBTMem]>; > > def : Proc<"barcelona", [FeatureSSE3, FeatureSSE4A, > > Feature3DNowA, Feature64Bit, > > FeatureSlowBTMem]>; > > +def : Proc<"istanbul", [Feature3DNowA, Feature64Bit, > > FeatureSSE4A, > > + Feature3DNowA]>; > > +def : Proc<"shanghai", [Feature3DNowA, Feature64Bit, > > FeatureSSE4A, > > + Feature3DNowA]>; > > Is there some reason to have both, since they have the exact same > feature strings? Typically we've avoided added every Intel variant > that has the same features as a previous one. They have different cache characteristics and core counts. That's actually one area where LLVM could use some work. Right now we're missing a lot of architectural detail. -Dave From gohman at apple.com Mon Jun 29 13:15:49 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Jun 2009 11:15:49 -0700 Subject: [llvm-commits] [PATCH] Avoid use after free in ScalarEvolution In-Reply-To: <4A476FAF.3020205@gmail.com> References: <4A16816C.7080405@gmail.com> <4AFCEFE6-6B21-4B33-998F-DACE37C5235E@apple.com> <4A369661.8050909@gmail.com> <2BDFCF40-1E6F-47E3-917D-E1148DE31CF7@apple.com> <4A374784.3030607@gmail.com> <4A476FAF.3020205@gmail.com> Message-ID: On Jun 28, 2009, at 6:27 AM, T?r?k Edwin wrote: > On 2009-06-16 10:19, T?r?k Edwin wrote: > >> On 2009-06-15 23:23, Dan Gohman wrote: >> >> >> >>> On Jun 15, 2009, at 11:43 AM, T?r?k Edwin wrote: >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>> On 2009-06-15 21:15, Dan Gohman wrote: >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>> Hi Edwin, >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> WritingAnLLVMPass.htm's description of releaseMemory says "This >>>>> >>>>> method >>>>> >>>>> >>>>> >>>>> is >>>>> >>>>> >>>>> >>>>> called after the run* method for the class, before the next call >>>>> of >>>>> >>>>> run* >>>>> >>>>> >>>>> >>>>> in your pass." This suggests that it's a bug in the PassManager >>>>> >>>>> for not >>>>> >>>>> >>>>> >>>>> calling releaseMemory for on-the-fly analyses. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> Would it be OK with you if I file a PR, and then try to provide a >>>> >>>> patch >>>> >>>> to do that? >>>> >>>> And also add an assertion before calling run() that checks that >>>> >>>> releaseMemory was called. >>>> >>>> >>>> >>>> >>>> >>> Sounds good to me. >>> >>> >>> >>> >>> >> >> >> I opened PR4398. >> >> >> > > I attached 2 patches to that bugreport (bugfix + testcase), please > review. > > http://llvm.org/bugs/attachment.cgi?id=3131 > http://llvm.org/bugs/attachment.cgi?id=3132 + if (!LQ.size()) // No loops, skip calling finalizers + return false; Please use LQ.empty() here instead of !LQ.size(). > +void FunctionPassManagerImpl::releaseMemoryOnTheFly() > +{ LLVM style has the brace on the same line as the function name. > + if (!wasRun) > + return; > + for (unsigned Index = 0; Index < getNumContainedManagers(); + +Index) { > + FPPassManager *FPPM = getContainedManager(Index); > + for (unsigned Index = 0; Index < FPPM->getNumContainedPasses (); ++Index) { > + FPPM->getContainedPass(Index)->releaseMemory(); > + } > + } > +} Should this set wasRun to true after freeing all the memory? + // Finalize on-the-fly passes + for (std::map::iterator + I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end(); + I != E; ++I) { + FunctionPassManagerImpl *FPP = I->second; + // We don't know when is the last time an on-the-fly pass is run, + // so we need to releaseMemory / finalize here + FPP->releaseMemoryOnTheFly(); + Changed |= FPP->doFinalization(M); + } Is it correct to call releaseMemoryOnTheFly before calling doInitialization? It seems like it should be the other way around. Dan From edwintorok at gmail.com Mon Jun 29 13:22:54 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 29 Jun 2009 21:22:54 +0300 Subject: [llvm-commits] [PATCH] Avoid use after free in ScalarEvolution In-Reply-To: References: <4A16816C.7080405@gmail.com> <4AFCEFE6-6B21-4B33-998F-DACE37C5235E@apple.com> <4A369661.8050909@gmail.com> <2BDFCF40-1E6F-47E3-917D-E1148DE31CF7@apple.com> <4A374784.3030607@gmail.com> <4A476FAF.3020205@gmail.com> Message-ID: <4A49067E.6070404@gmail.com> On 2009-06-29 21:15, Dan Gohman wrote: > + return false; > > Please use LQ.empty() here instead of !LQ.size(). > Fixed. > > +void FunctionPassManagerImpl::releaseMemoryOnTheFly() > > +{ > > LLVM style has the brace on the same line as the function name. > Fixed. > > + if (!wasRun) > > + return; > > + for (unsigned Index = 0; Index < getNumContainedManagers(); + > +Index) { > > + FPPassManager *FPPM = getContainedManager(Index); > > + for (unsigned Index = 0; Index < FPPM->getNumContainedPasses > (); ++Index) { > > + FPPM->getContainedPass(Index)->releaseMemory(); > > + } > > + } > > +} > > Should this set wasRun to true after freeing all the memory? > wasRun is already true, otherwise we would have returned early. wasRun only guards against calling releaseMemory() before the first run() call. > + // Finalize on-the-fly passes > + for (std::map::iterator > + I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end(); > + I != E; ++I) { > + FunctionPassManagerImpl *FPP = I->second; > + // We don't know when is the last time an on-the-fly pass is run, > + // so we need to releaseMemory / finalize here > + FPP->releaseMemoryOnTheFly(); > + Changed |= FPP->doFinalization(M); > + } > > Is it correct to call releaseMemoryOnTheFly before calling > doInitialization? It seems like it should be the other way > around. > No, you can't call it before doInitialization. releaseMemoryOnTheFly is called before doFinalization, that looks right to me. doInitialization is called above, always before releaseMemory. There is one situation where doInitialization is called, but run() isn't, then releaseMemoryOnTheFly then doFinalization. But that should be OK too, since then wasRun will be false, and releaseMemory won't be called. Best regards, --Edwin From gohman at apple.com Mon Jun 29 13:26:11 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Jun 2009 18:26:11 -0000 Subject: [llvm-commits] [llvm] r74437 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <200906291826.n5TIQM6G026851@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 29 13:25:52 2009 New Revision: 74437 URL: http://llvm.org/viewvc/llvm-project?rev=74437&view=rev Log: Simplify this code, and avoid using APInt(). This fixes (otherwise harmless) uninitialized value warnings that Duncan found with gcc-4.4. Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=74437&r1=74436&r2=74437&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 29 13:25:52 2009 @@ -1048,9 +1048,8 @@ SmallVector MulOps(Mul->op_begin()+1, Mul->op_end()); const SCEV* Key = SE.getMulExpr(MulOps); std::pair::iterator, bool> Pair = - M.insert(std::make_pair(Key, APInt())); + M.insert(std::make_pair(Key, NewScale)); if (Pair.second) { - Pair.first->second = NewScale; NewOps.push_back(Pair.first->first); } else { Pair.first->second += NewScale; @@ -1067,9 +1066,8 @@ } else { // An ordinary operand. Update the map. std::pair::iterator, bool> Pair = - M.insert(std::make_pair(Ops[i], APInt())); + M.insert(std::make_pair(Ops[i], Scale)); if (Pair.second) { - Pair.first->second = Scale; NewOps.push_back(Pair.first->first); } else { Pair.first->second += Scale; From andreas.bolka at gmx.net Mon Jun 29 13:31:49 2009 From: andreas.bolka at gmx.net (Andreas Bolka) Date: Mon, 29 Jun 2009 20:31:49 +0200 Subject: [llvm-commits] [llvm] r74401 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp In-Reply-To: <352a1fb20906290928m32b60b2at3de88f145c5b6520@mail.gmail.com> References: <200906280021.n5S0LMGW024672@zion.cs.uiuc.edu> <352a1fb20906290928m32b60b2at3de88f145c5b6520@mail.gmail.com> Message-ID: <1246300259-sup-5649@strider> On Mon Jun 29 18:28:29 +0200 2009, Devang Patel wrote: > On Sat, Jun 27, 2009 at 5:21 PM, Andreas Bolka wrote: > > + > > +static inline bool isMemRefInstr(const Value *I) { > > + ?return isa(I) || isa(I); > > +} > > + > > Pl. use Instruction::mayWriteToMemory() and > Instruction::mayReadFromMemory() to check memory reference. Ok. -- Andreas From andreas.bolka at gmx.net Mon Jun 29 13:34:43 2009 From: andreas.bolka at gmx.net (Andreas Bolka) Date: Mon, 29 Jun 2009 20:34:43 +0200 Subject: [llvm-commits] [llvm] r74400 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp In-Reply-To: <352a1fb20906290924j2ab14facsb1d481c4ba695a77@mail.gmail.com> References: <200906280016.n5S0G81I024417@zion.cs.uiuc.edu> <352a1fb20906290924j2ab14facsb1d481c4ba695a77@mail.gmail.com> Message-ID: <1246300323-sup-4843@strider> On Mon Jun 29 18:24:55 +0200 2009, Devang Patel wrote: > Here supporting only raw_ostream from llvm/Support interface is > enough, no need to support direct std::ostream interface. If I don't implement `virtual void print(std::ostream&, const Module*)`, I get a warning: lib/Analysis/LoopDependenceAnalysis.cpp:22: include/llvm/Pass.h:105: warning: ?virtual void llvm::Pass::print(std::ostream&, const llvm::Module*) const? was hidden include/llvm/Analysis/LoopDependenceAnalysis.h:49: warning: by ?void llvm::LoopDependenceAnalysis::print(llvm::raw_ostream&, const llvm::Module*) const? I'll drop the `void print(std::ostream*, const Module*)`. > On Sat, Jun 27, 2009 at 5:16 PM, Andreas Bolka wrote: > > --- llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h (original) > > +++ llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Sat Jun 27 19:16:08 2009 > > ? class LoopDependenceAnalysis : public LoopPass { > > @@ -39,6 +40,12 @@ > > ? ? bool runOnLoop(Loop*, LPPassManager&); > > > > ? ? virtual void getAnalysisUsage(AnalysisUsage&) const; > > + > > +? ?void print(raw_ostream&, const Module* = 0) const; > > +? ?virtual void print(std::ostream&, const Module* = 0) const; > > +? ?void print(std::ostream *OS, const Module *M = 0) const { > > +? ? ?if (OS) print(*OS, M); > > +? ?} > > ? }; // class LoopDependenceAnalysis -- Andreas From edwintorok at gmail.com Mon Jun 29 13:49:22 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Mon, 29 Jun 2009 18:49:22 -0000 Subject: [llvm-commits] [llvm] r74438 - in /llvm/trunk: lib/Analysis/LoopPass.cpp lib/VMCore/PassManager.cpp unittests/VMCore/Makefile unittests/VMCore/PassManagerTest.cpp Message-ID: <200906291849.n5TInWLv027569@zion.cs.uiuc.edu> Author: edwin Date: Mon Jun 29 13:49:09 2009 New Revision: 74438 URL: http://llvm.org/viewvc/llvm-project?rev=74438&view=rev Log: Call doInitialization(), releaseMemory(), and doFinalization() for on-the-fly passes as well. Also don't call finalizers for LoopPass if initialization was not called. Add a unittest that tests that these methods are called, in the proper order, and the correct number of times. Added: llvm/trunk/unittests/VMCore/PassManagerTest.cpp Modified: llvm/trunk/lib/Analysis/LoopPass.cpp llvm/trunk/lib/VMCore/PassManager.cpp llvm/trunk/unittests/VMCore/Makefile Modified: llvm/trunk/lib/Analysis/LoopPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=74438&r1=74437&r2=74438&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopPass.cpp (original) +++ llvm/trunk/lib/Analysis/LoopPass.cpp Mon Jun 29 13:49:09 2009 @@ -195,6 +195,9 @@ for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) addLoopIntoQueue(*I, LQ); + if (LQ.empty()) // No loops, skip calling finalizers + return false; + // Initialization for (std::deque::const_iterator I = LQ.begin(), E = LQ.end(); I != E; ++I) { Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=74438&r1=74437&r2=74438&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Jun 29 13:49:09 2009 @@ -165,11 +165,13 @@ class FunctionPassManagerImpl : public Pass, public PMDataManager, public PMTopLevelManager { +private: + bool wasRun; public: static char ID; explicit FunctionPassManagerImpl(int Depth) : Pass(&ID), PMDataManager(Depth), - PMTopLevelManager(TLM_Function) { } + PMTopLevelManager(TLM_Function), wasRun(false) { } /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass @@ -179,6 +181,10 @@ schedulePass(P); } + // Prepare for running an on the fly pass, freeing memory if needed + // from a previous run. + void releaseMemoryOnTheFly(); + /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. bool run(Function &F); @@ -1290,6 +1296,17 @@ } } +void FunctionPassManagerImpl::releaseMemoryOnTheFly() { + if (!wasRun) + return; + for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { + FPPassManager *FPPM = getContainedManager(Index); + for (unsigned Index = 0; Index < FPPM->getNumContainedPasses(); ++Index) { + FPPM->getContainedPass(Index)->releaseMemory(); + } + } +} + // Execute all the passes managed by this top level manager. // Return true if any function is modified by a pass. bool FunctionPassManagerImpl::run(Function &F) { @@ -1306,6 +1323,7 @@ for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) getContainedManager(Index)->cleanup(); + wasRun = true; return Changed; } @@ -1404,6 +1422,14 @@ MPPassManager::runOnModule(Module &M) { bool Changed = false; + // Initialize on-the-fly passes + for (std::map::iterator + I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end(); + I != E; ++I) { + FunctionPassManagerImpl *FPP = I->second; + Changed |= FPP->doInitialization(M); + } + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { ModulePass *MP = getContainedPass(Index); @@ -1430,6 +1456,17 @@ recordAvailableAnalysis(MP); removeDeadPasses(MP, M.getModuleIdentifier().c_str(), ON_MODULE_MSG); } + + // Finalize on-the-fly passes + for (std::map::iterator + I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end(); + I != E; ++I) { + FunctionPassManagerImpl *FPP = I->second; + // We don't know when is the last time an on-the-fly pass is run, + // so we need to releaseMemory / finalize here + FPP->releaseMemoryOnTheFly(); + Changed |= FPP->doFinalization(M); + } return Changed; } @@ -1466,6 +1503,7 @@ FunctionPassManagerImpl *FPP = OnTheFlyManagers[MP]; assert(FPP && "Unable to find on the fly pass"); + FPP->releaseMemoryOnTheFly(); FPP->run(F); return (dynamic_cast(FPP))->findAnalysisPass(PI); } Modified: llvm/trunk/unittests/VMCore/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/Makefile?rev=74438&r1=74437&r2=74438&view=diff ============================================================================== --- llvm/trunk/unittests/VMCore/Makefile (original) +++ llvm/trunk/unittests/VMCore/Makefile Mon Jun 29 13:49:09 2009 @@ -9,7 +9,7 @@ LEVEL = ../.. TESTNAME = VMCore -LINK_COMPONENTS := core support +LINK_COMPONENTS := core support target ipa include $(LEVEL)/Makefile.config include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest Added: llvm/trunk/unittests/VMCore/PassManagerTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/PassManagerTest.cpp?rev=74438&view=auto ============================================================================== --- llvm/trunk/unittests/VMCore/PassManagerTest.cpp (added) +++ llvm/trunk/unittests/VMCore/PassManagerTest.cpp Mon Jun 29 13:49:09 2009 @@ -0,0 +1,526 @@ +//===- llvm/unittest/VMCore/PassManager.cpp - Constants unit tests ------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Module.h" +#include "llvm/PassManager.h" +#include "llvm/Analysis/LoopInfo.h" +#include "llvm/Pass.h" +#include "llvm/Analysis/LoopPass.h" +#include "llvm/CallGraphSCCPass.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/DerivedTypes.h" +#include "llvm/Constants.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Function.h" +#include "llvm/CallingConv.h" +#include "llvm/BasicBlock.h" +#include "llvm/Instructions.h" +#include "llvm/InlineAsm.h" +#include "llvm/Support/MathExtras.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/PassManager.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Analysis/Verifier.h" +#include "llvm/Assembly/PrintModulePass.h" +#include "gtest/gtest.h" + +namespace llvm { + namespace { + // ND = no deps + // NM = no modifications + struct ModuleNDNM: public ModulePass { + public: + static char run; + static char ID; + ModuleNDNM() : ModulePass(&ID) {} + virtual bool runOnModule(Module &M) { + run++; + return false; + } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + }; + char ModuleNDNM::ID=0; + char ModuleNDNM::run=0; + + struct ModuleNDM : public ModulePass { + public: + static char run; + static char ID; + ModuleNDM() : ModulePass(&ID) {} + virtual bool runOnModule(Module &M) { + run++; + return true; + } + }; + char ModuleNDM::ID=0; + char ModuleNDM::run=0; + RegisterPass X("mndm","mndm",false,false); + + struct ModuleNDM2 : public ModulePass { + public: + static char run; + static char ID; + ModuleNDM2() : ModulePass(&ID) {} + virtual bool runOnModule(Module &M) { + run++; + return true; + } + }; + char ModuleNDM2::ID=0; + char ModuleNDM2::run=0; + + struct ModuleDNM : public ModulePass { + public: + static char run; + static char ID; + ModuleDNM() : ModulePass(&ID) {} + virtual bool runOnModule(Module &M) { + EXPECT_TRUE(getAnalysisIfAvailable()); + run++; + return false; + } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + AU.setPreservesAll(); + } + }; + char ModuleDNM::ID=0; + char ModuleDNM::run=0; + + template + struct PassTestBase : public P { + protected: + static int runc; + static bool initialized; + static bool finalized; + int allocated; + void run() { + EXPECT_EQ(true, initialized); + EXPECT_EQ(false, finalized); + EXPECT_EQ(0, allocated); + allocated++; + runc++; + } + public: + static char ID; + static void finishedOK(int run) { + EXPECT_GT(runc, 0); + EXPECT_EQ(true, initialized); + EXPECT_EQ(true, finalized); + EXPECT_EQ(run, runc); + } + PassTestBase() : P(&ID), allocated(0) { + initialized = false; + finalized = false; + runc = 0; + } + + virtual void releaseMemory() { + EXPECT_GT(runc, 0); + EXPECT_GT(allocated, 0); + allocated--; + } + }; + template char PassTestBase

::ID; + template int PassTestBase

::runc; + template bool PassTestBase

::initialized; + template bool PassTestBase

::finalized; + + template + struct PassTest : public PassTestBase

{ + public: + virtual bool doInitialization(T &t) { + EXPECT_EQ(false, PassTestBase

::initialized); + PassTestBase

::initialized = true; + return false; + } + virtual bool doFinalization(T &t) { + EXPECT_EQ(false, PassTestBase

::finalized); + PassTestBase

::finalized = true; + EXPECT_EQ(0, PassTestBase

::allocated); + return false; + } + }; + + struct CGPass : public PassTest { + public: + virtual bool runOnSCC(const std::vector &SCMM) { + EXPECT_TRUE(getAnalysisIfAvailable()); + run(); + return false; + } + }; + RegisterPass X1("cgp","cgp"); + + struct FPass : public PassTest { + public: + virtual bool runOnFunction(Function &F) { + // FIXME: PR4112 + // EXPECT_TRUE(getAnalysisIfAvailable()); + run(); + return false; + } + }; + RegisterPass X2("fp","fp"); + + struct LPass : public PassTestBase { + private: + static int initcount; + static int fincount; + public: + LPass() { + initcount = 0; fincount=0; + EXPECT_EQ(false, initialized); + } + static void finishedOK(int run, int finalized) { + PassTestBase::finishedOK(run); + EXPECT_EQ(run, initcount); + EXPECT_EQ(finalized, fincount); + } + virtual bool doInitialization(Loop* L, LPPassManager &LPM) { + initialized = true; + initcount++; + return false; + } + virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { + EXPECT_TRUE(getAnalysisIfAvailable()); + run(); + return false; + } + virtual bool doFinalization() { + fincount++; + finalized = true; + return false; + } + }; + int LPass::initcount=0; + int LPass::fincount=0; + RegisterPass X3("lp","lp"); + + struct BPass : public PassTestBase { + private: + static int inited; + static int fin; + public: + static void finishedOK(int run, int N) { + PassTestBase::finishedOK(run); + EXPECT_EQ(inited, N); + EXPECT_EQ(fin, N); + } + BPass() { + inited = 0; + fin = 0; + } + virtual bool doInitialization(Module &M) { + EXPECT_EQ(false, initialized); + initialized = true; + return false; + } + virtual bool doInitialization(Function &F) { + inited++; + return false; + } + virtual bool runOnBasicBlock(BasicBlock &BB) { + EXPECT_TRUE(getAnalysisIfAvailable()); + run(); + return false; + } + virtual bool doFinalization(Function &F) { + fin++; + return false; + } + virtual bool doFinalization(Module &M) { + EXPECT_EQ(false, finalized); + finalized = true; + EXPECT_EQ(0, allocated); + return false; + } + }; + int BPass::inited=0; + int BPass::fin=0; + RegisterPass X4("bp","bp"); + + struct OnTheFlyTest: public ModulePass { + public: + static char ID; + OnTheFlyTest() : ModulePass(&ID) {} + virtual bool runOnModule(Module &M) { + EXPECT_TRUE(getAnalysisIfAvailable()); + for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) { + Function &F = *I; + { + SCOPED_TRACE("Running on the fly function pass"); + getAnalysis(F); + } + } + return false; + } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + } + }; + char OnTheFlyTest::ID=0; + + TEST(PassManager, RunOnce) { + Module M("test-once"); + struct ModuleNDNM *mNDNM = new ModuleNDNM(); + struct ModuleDNM *mDNM = new ModuleDNM(); + struct ModuleNDM *mNDM = new ModuleNDM(); + struct ModuleNDM2 *mNDM2 = new ModuleNDM2(); + + mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0; + + PassManager Passes; + Passes.add(new TargetData(&M)); + Passes.add(mNDM2); + Passes.add(mNDM); + Passes.add(mNDNM); + Passes.add(mDNM); + + Passes.run(M); + // each pass must be run exactly once, since nothing invalidates them + EXPECT_EQ(1, mNDM->run); + EXPECT_EQ(1, mNDNM->run); + EXPECT_EQ(1, mDNM->run); + EXPECT_EQ(1, mNDM2->run); + } + + TEST(PassManager, ReRun) { + Module M("test-rerun"); + struct ModuleNDNM *mNDNM = new ModuleNDNM(); + struct ModuleDNM *mDNM = new ModuleDNM(); + struct ModuleNDM *mNDM = new ModuleNDM(); + struct ModuleNDM2 *mNDM2 = new ModuleNDM2(); + + mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0; + + PassManager Passes; + Passes.add(new TargetData(&M)); + Passes.add(mNDM); + Passes.add(mNDNM); + Passes.add(mNDM2);// invalidates mNDM needed by mDNM + Passes.add(mDNM); + + Passes.run(M); + // Some passes must be rerun because a pass that modified the + // module/function was run inbetween + EXPECT_EQ(2, mNDM->run); + EXPECT_EQ(1, mNDNM->run); + EXPECT_EQ(1, mNDM2->run); + EXPECT_EQ(1, mDNM->run); + } + + Module* makeLLVMModule(); + + template + void MemoryTestHelper(int run) { + Module *M = makeLLVMModule(); + T *P = new T(); + PassManager Passes; + Passes.add(new TargetData(M)); + Passes.add(P); + Passes.run(*M); + T::finishedOK(run); + } + + template + void MemoryTestHelper(int run, int N) { + Module *M = makeLLVMModule(); + T *P = new T(); + PassManager Passes; + Passes.add(new TargetData(M)); + Passes.add(P); + Passes.run(*M); + T::finishedOK(run, N); + delete M; + } + + TEST(PassManager, Memory) { + // SCC#1: test1->test2->test3->test1 + // SCC#2: test4 + // SCC#3: indirect call node + { + SCOPED_TRACE("Callgraph pass"); + MemoryTestHelper(3); + } + + { + SCOPED_TRACE("Function pass"); + MemoryTestHelper(4);// 4 functions + } + + { + SCOPED_TRACE("Loop pass"); + MemoryTestHelper(2, 1); //2 loops, 1 function + } + { + SCOPED_TRACE("Basic block pass"); + MemoryTestHelper(7, 4); //9 basic blocks + } + + } + + TEST(PassManager, MemoryOnTheFly) { + Module *M = makeLLVMModule(); + { + SCOPED_TRACE("Running OnTheFlyTest"); + struct OnTheFlyTest *O = new OnTheFlyTest(); + PassManager Passes; + Passes.add(new TargetData(M)); + Passes.add(O); + Passes.run(*M); + + FPass::finishedOK(4); + } + delete M; + } + + Module* makeLLVMModule() { + // Module Construction + Module* mod = new Module("test-mem"); + mod->setDataLayout("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" + "i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-" + "a0:0:64-s0:64:64-f80:128:128"); + mod->setTargetTriple("x86_64-unknown-linux-gnu"); + + // Type Definitions + std::vectorFuncTy_0_args; + FunctionType* FuncTy_0 = FunctionType::get( + /*Result=*/IntegerType::get(32), + /*Params=*/FuncTy_0_args, + /*isVarArg=*/false); + + std::vectorFuncTy_2_args; + FuncTy_2_args.push_back(IntegerType::get(1)); + FunctionType* FuncTy_2 = FunctionType::get( + /*Result=*/Type::VoidTy, + /*Params=*/FuncTy_2_args, + /*isVarArg=*/false); + + + // Function Declarations + + Function* func_test1 = Function::Create( + /*Type=*/FuncTy_0, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"test1", mod); + func_test1->setCallingConv(CallingConv::C); + AttrListPtr func_test1_PAL; + func_test1->setAttributes(func_test1_PAL); + + Function* func_test2 = Function::Create( + /*Type=*/FuncTy_0, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"test2", mod); + func_test2->setCallingConv(CallingConv::C); + AttrListPtr func_test2_PAL; + func_test2->setAttributes(func_test2_PAL); + + Function* func_test3 = Function::Create( + /*Type=*/FuncTy_0, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"test3", mod); + func_test3->setCallingConv(CallingConv::C); + AttrListPtr func_test3_PAL; + func_test3->setAttributes(func_test3_PAL); + + Function* func_test4 = Function::Create( + /*Type=*/FuncTy_2, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"test4", mod); + func_test4->setCallingConv(CallingConv::C); + AttrListPtr func_test4_PAL; + func_test4->setAttributes(func_test4_PAL); + + // Global Variable Declarations + + + // Constant Definitions + + // Global Variable Definitions + + // Function Definitions + + // Function: test1 (func_test1) + { + + BasicBlock* label_entry = BasicBlock::Create("entry",func_test1,0); + + // Block entry (label_entry) + CallInst* int32_3 = CallInst::Create(func_test2, "", label_entry); + int32_3->setCallingConv(CallingConv::C); + int32_3->setTailCall(false);AttrListPtr int32_3_PAL; + int32_3->setAttributes(int32_3_PAL); + + ReturnInst::Create(int32_3, label_entry); + + } + + // Function: test2 (func_test2) + { + + BasicBlock* label_entry_5 = BasicBlock::Create("entry",func_test2,0); + + // Block entry (label_entry_5) + CallInst* int32_6 = CallInst::Create(func_test3, "", label_entry_5); + int32_6->setCallingConv(CallingConv::C); + int32_6->setTailCall(false);AttrListPtr int32_6_PAL; + int32_6->setAttributes(int32_6_PAL); + + ReturnInst::Create(int32_6, label_entry_5); + + } + + // Function: test3 (func_test3) + { + + BasicBlock* label_entry_8 = BasicBlock::Create("entry",func_test3,0); + + // Block entry (label_entry_8) + CallInst* int32_9 = CallInst::Create(func_test1, "", label_entry_8); + int32_9->setCallingConv(CallingConv::C); + int32_9->setTailCall(false);AttrListPtr int32_9_PAL; + int32_9->setAttributes(int32_9_PAL); + + ReturnInst::Create(int32_9, label_entry_8); + + } + + // Function: test4 (func_test4) + { + Function::arg_iterator args = func_test4->arg_begin(); + Value* int1_f = args++; + int1_f->setName("f"); + + BasicBlock* label_entry_11 = BasicBlock::Create("entry",func_test4,0); + BasicBlock* label_bb = BasicBlock::Create("bb",func_test4,0); + BasicBlock* label_bb1 = BasicBlock::Create("bb1",func_test4,0); + BasicBlock* label_return = BasicBlock::Create("return",func_test4,0); + + // Block entry (label_entry_11) + BranchInst::Create(label_bb, label_entry_11); + + // Block bb (label_bb) + BranchInst::Create(label_bb, label_bb1, int1_f, label_bb); + + // Block bb1 (label_bb1) + BranchInst::Create(label_bb1, label_return, int1_f, label_bb1); + + // Block return (label_return) + ReturnInst::Create(label_return); + + } + return mod; + } + + } +} From a at bolka.at Mon Jun 29 13:51:14 2009 From: a at bolka.at (Andreas Bolka) Date: Mon, 29 Jun 2009 18:51:14 -0000 Subject: [llvm-commits] [llvm] r74439 - /llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Message-ID: <200906291851.n5TIpEkE027628@zion.cs.uiuc.edu> Author: abolka Date: Mon Jun 29 13:51:11 2009 New Revision: 74439 URL: http://llvm.org/viewvc/llvm-project?rev=74439&view=rev Log: Relax LDA memory instruction checks. Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=74439&r1=74438&r2=74439&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Mon Jun 29 13:51:11 2009 @@ -36,8 +36,9 @@ // Utility Functions //===----------------------------------------------------------------------===// -static inline bool IsMemRefInstr(const Value *I) { - return isa(I) || isa(I); +static inline bool IsMemRefInstr(const Value *V) { + const Instruction *I = dyn_cast(V); + return I && (I->mayReadFromMemory() || I->mayWriteToMemory()); } static void GetMemRefInstrs( @@ -56,8 +57,10 @@ bool LoopDependenceAnalysis::isDependencePair(const Value *x, const Value *y) const { - return IsMemRefInstr(x) && IsMemRefInstr(y) - && (isa(x) || isa(y)); + return IsMemRefInstr(x) && + IsMemRefInstr(y) && + (cast(x)->mayWriteToMemory() || + cast(y)->mayWriteToMemory()); } bool LoopDependenceAnalysis::depends(Value *src, Value *dst) { From andrelct at dcc.ufmg.br Mon Jun 29 14:39:55 2009 From: andrelct at dcc.ufmg.br (Andre Tavares) Date: Mon, 29 Jun 2009 16:39:55 -0300 Subject: [llvm-commits] SSI patch In-Reply-To: References: <4A4374C5.7090508@dcc.ufmg.br> <4A44CE73.2030907@dcc.ufmg.br> Message-ID: <4A49188B.8060804@dcc.ufmg.br> Eli Friedman wrote: > On Fri, Jun 26, 2009 at 6:34 AM, Andre Tavares wrote: > >> Changed them all from to SmallVector, and so on. I need >> SSI::created to have a record of what variables I have transformed to >> SSI, and if another pass asks to transform it, I will be able to not do >> anything because I already know it was transformed before. Without this >> I would have to try to transform it and see that it is not possible. >> > > Is attempting to transform a variable that was already transformed > expensive? If not, I don't see the point of caching it. > > It is not that expensive. It would run for every use of that variable and return. The problem is that I'm not sure that my insertion of sigma and phi is minimal. If it is not minimal it would include lots of sigma for the variable it is asked multiple times. I have to verify that my creation of sigma and phi is minimal before this. >> If we decide to make it an utility class, should I put all content in a >> .h file and forget about the .cpp? >> > > Any functions with an implementation longer than a couple of lines > should go into a .cpp file; this reduces compile times and code size, > and keeps the header cleaner. > > ok. > -Eli > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > -- Andre Tavares Master Student in Computer Science - UFMG - Brasil http://dcc.ufmg.br/~andrelct From andrelct at dcc.ufmg.br Mon Jun 29 14:42:13 2009 From: andrelct at dcc.ufmg.br (Andre Tavares) Date: Mon, 29 Jun 2009 16:42:13 -0300 Subject: [llvm-commits] SSI patch In-Reply-To: <4A46E82C.2070306@mxc.ca> References: <4A4374C5.7090508@dcc.ufmg.br> <4A44CE73.2030907@dcc.ufmg.br> <4A46E82C.2070306@mxc.ca> Message-ID: <4A491915.9060105@dcc.ufmg.br> Nick Lewycky wrote: > Andre Tavares wrote: > >> Hey Nick, Thanks for your response, my comments are below. >> >> Nick Lewycky wrote: >> >>> I haven't looked closely at the algorithm yet. What jumped out were a >>> number of stylistic concerns, first of all. We have a number of ADTs >>> in LLVM that we like more than C++ STL ones (see >>> http://llvm.org/docs/ProgrammersManual.html for why). You should use >>> SmallVector instead of std::vector&. For example, >>> "SSI::createSSI(SmallVectorImpl value) {", or possibly >>> make it take an Instruction** and a size. Similarly, std::set is >>> horrible in general, you should make SSI::created be a >>> SmallPtrSet. (Or remove SSI::created entirely in >>> favour of making createSSI take a set and tell the caller they're not >>> allowed to call createSSI on the same value twice.) >>> >>> >> Changed them all from to SmallVector, and so on. I need >> SSI::created to have a record of what variables I have transformed to >> SSI, and if another pass asks to transform it, I will be able to not do >> anything because I already know it was transformed before. Without this >> I would have to try to transform it and see that it is not possible. >> >> >> >>> You declare some global constants which should at least also be >>> static. You shouldn't evaluate X->size() on every iteration of a loop; >>> for example the "for" statement in isUsedInTerminator should be >>> written like "for (unsigned i = 0, e = TI->getNumOperands(); i != e; >>> ++i) {". This is done in a few other places as well. >>> >>> >> Totally agree. Fixed them all. >> >> >>> Some of your comments (SSI::insertPhiFunctions) are missing a space >>> after // and before the text. Please add it where missing. >>> >>> >> Fixed. >> >>> // TODO: We do modify the programs code, but we do not know which >>> // Passes we break. >>> void SSI::getAnalysisUsage(AnalysisUsage &AU) const { >>> AU.addRequired (); >>> AU.addRequired (); >>> AU.setPreservesAll(); >>> } >>> >>> If you don't know what you preserve, don't preserve anything. I think >>> your pass preserves the CFG (you don't modify any TerminatorInsts) so >>> you can mark it AU.setPreservesCFG(). >>> >>> bool SSI::runOnFunction(Function &F) { >>> DT_ = &getAnalysis (); >>> return false; >>> } >>> >>> This runOnFunction doesn't transform anything. That means that if I >>> run "opt -ssi_and_pass" over a .bc then no transform or analysis will >>> happen. That's okay -- opt -scalar-evolution does the same thing -- >>> but if you do this you should also supply a print() method where the >>> pass dumps out what it would have done (the results of its analysis on >>> every variable, in scalar-evolutions case). You can then read it with >>> "opt -analyze -ssi_and_pass". >>> >>> /// Test if the BasicBlock BB dominates any use or definition of value. >>> /// >>> bool SSI::dominateAny(BasicBlock * BB, Instruction * value) { >>> Value::use_iterator begin = value->use_begin(); >>> Value::use_iterator end = value->use_end(); >>> for (; begin != end; ++begin) { >>> Instruction * I = dyn_cast (*begin); >>> >>> Use cast instead of dyn_cast since we know >>> in advance that it must be an Instruction. >>> >>> BasicBlock * BB_father = I->getParent(); >>> if (DT_->dominates(BB, BB_father)) { >>> return true; >>> } >>> } >>> return false; >>> } >>> >> Fixed dyn_cast. >> >>> So overall this looks like a good start. I think we may want to move >>> createSSI out of the pass and into its own >>> lib/Transforms/Utils/SSI.cpp which takes the DominatorTree* and >>> DominatorFrontier*. This method could then be called from any pass >>> without having to declare it in advance in its own analysis usage. >>> Then the SSI pass would then exist for testing purposes; it could do >>> something like either collect the sensible instructions or maybe just >>> all non-void instructions and run createSSI over them. >>> >>> >> Nick, instead of moving only createSSI out of the pass, why don't we >> move SSI Pass to lib/Transforms/Utils/, and make it an utility class >> instead of a Pass? With this, we would not need to worry about >> getAnalysisUsage. >> >> If we decide to make it an utility class, should I put all content in a >> .h file and forget about the .cpp? >> > > I'm wondering whether we need it to be a class or if it can just be a > public method in the llvm:: namespace. The question there is whether it > has state that it needs to keep between runs, and as far as I can see > the answer is no. > > The one piece of state that's currently kept is SSI::created. How bad is > it if you're asked to create SSI on a variable that already has it? Is > it computationally expensive or a recipe for miscompiles and crashes? > Any reason we couldn't just make "don't re-SSI the same variable" the > caller's concern? Don't forget that the caller is IMHO likely to already > be keeping track of which variables have had SSI run on them making > SSI::created redundant. > > I answered this on Eli's email. About "don't re-SSI the same variable", this is not possible, because different client passes could ask to transform the same variable, and one does not know which variables the other converted. > Nick > > >>> I'll try to do a more thorough review soon. >>> >>> Nick >>> >>> 2009/6/25 Andre Tavares >> > >>> >>> Hello, >>> >>> I'm submiting a patch that will be responsible to create SSI >>> representation on demand. This representation conforms with the >>> current SSA, and will not break other optimizations. It only >>> inserts some phi functions on the code. A brief description is >>> below, and the code is attached. >>> >>> // This pass converts a list of variables to the Static Single >>> Information >>> // form. This is a program representation described by Scott >>> Ananian in his >>> // Master Thesis: "The Static Single Information Form (1999)". >>> // We are building an on-demand representation, that is, we do not >>> convert >>> // every single variable in the target function to SSI form. >>> Rather, we receive >>> // a list of target variables that must be converted. We also do not >>> // completely convert a target variable to the SSI format. >>> Instead, we only >>> // change the variable in the points where new information can be >>> attached >>> // to its live range, that is, at branch points. >>> >>> -- >>> Andre Tavares >>> Master Student in Computer Science - UFMG - Brasil >>> http://dcc.ufmg.br/~andrelct >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > -- Andre Tavares Master Student in Computer Science - UFMG - Brasil http://dcc.ufmg.br/~andrelct From daniel at zuster.org Mon Jun 29 14:51:03 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 19:51:03 -0000 Subject: [llvm-commits] [llvm] r74440 - in /llvm/trunk: include/llvm/MC/MCValue.h lib/MC/MCAsmStreamer.cpp Message-ID: <200906291951.n5TJp3Rp029364@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 14:51:00 2009 New Revision: 74440 URL: http://llvm.org/viewvc/llvm-project?rev=74440&view=rev Log: Rename MCValue::getCst to getConstant and add MCValue::isConstant. Modified: llvm/trunk/include/llvm/MC/MCValue.h llvm/trunk/lib/MC/MCAsmStreamer.cpp Modified: llvm/trunk/include/llvm/MC/MCValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCValue.h?rev=74440&r1=74439&r2=74440&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCValue.h (original) +++ llvm/trunk/include/llvm/MC/MCValue.h Mon Jun 29 14:51:00 2009 @@ -30,10 +30,11 @@ int64_t Cst; public: - int64_t getCst() const { return Cst; } + int64_t getConstant() const { return Cst; } MCSymbol *getSymA() const { return SymA; } MCSymbol *getSymB() const { return SymB; } - + + bool isConstant() const { return !SymA && !SymB; } static MCValue get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) { MCValue R; Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=74440&r1=74439&r2=74440&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Jun 29 14:51:00 2009 @@ -66,11 +66,11 @@ os << Value.getSymA()->getName(); if (Value.getSymB()) os << " - " << Value.getSymB()->getName(); - if (Value.getCst()) - os << " + " << Value.getCst(); + if (Value.getConstant()) + os << " + " << Value.getConstant(); } else { assert(!Value.getSymB() && "Invalid machine code value!"); - os << Value.getCst(); + os << Value.getConstant(); } return os; @@ -83,7 +83,7 @@ static inline MCValue truncateToSize(const MCValue &Value, unsigned Bytes) { return MCValue::get(Value.getSymA(), Value.getSymB(), - truncateToSize(Value.getCst(), Bytes)); + truncateToSize(Value.getConstant(), Bytes)); } void MCAsmStreamer::SwitchSection(MCSection *Section) { From brukman at gmail.com Mon Jun 29 14:53:05 2009 From: brukman at gmail.com (Misha Brukman) Date: Mon, 29 Jun 2009 15:53:05 -0400 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html pubs.js In-Reply-To: <4A49036F.7010308@gmail.com> References: <200906291643.n5TGhjxt023422@zion.cs.uiuc.edu> <4A49036F.7010308@gmail.com> Message-ID: 2009/6/29 T?r?k Edwin > On 2009-06-29 19:43, Misha Brukman wrote: > > Changes in directory llvm-www/pubs: > > > > index.html updated: 1.91 -> 1.92 > > pubs.js updated: 1.46 -> 1.47 > > --- > > Log message: > > > > Added a histogram of publications over years as a chart. > > > > Sounds cool, where can I see the histogram? > It doesn't show up in my firefox. http://llvm.org/pubs/ -- see top right of the page. Works for me in Firefox 3 on Linux. Or see this link for what it should look like. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090629/fb2f423f/attachment.html From baldrick at free.fr Mon Jun 29 14:55:21 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Jun 2009 21:55:21 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r74436 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200906291807.n5TI7UeN026227@zion.cs.uiuc.edu> References: <200906291807.n5TI7UeN026227@zion.cs.uiuc.edu> Message-ID: <4A491C29.7010907@free.fr> Hi Owen, > // We assume like gcc appears to, that this only applies to cached memory. > - C[4] = ConstantInt::get(Type::Int1Ty, false); > + C[4] = ConstantInt::get(Type::Int1Ty, true); please update the comment! Ciao, Duncan. From daniel at zuster.org Mon Jun 29 14:57:25 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 19:57:25 -0000 Subject: [llvm-commits] [llvm] r74441 - /llvm/trunk/unittests/MC/AsmStreamerTest.cpp Message-ID: <200906291957.n5TJvPiF029543@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 14:57:24 2009 New Revision: 74441 URL: http://llvm.org/viewvc/llvm-project?rev=74441&view=rev Log: Fix order of arguments to EXPECT_EQ Modified: llvm/trunk/unittests/MC/AsmStreamerTest.cpp Modified: llvm/trunk/unittests/MC/AsmStreamerTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/MC/AsmStreamerTest.cpp?rev=74441&r1=74440&r2=74441&view=diff ============================================================================== --- llvm/trunk/unittests/MC/AsmStreamerTest.cpp (original) +++ llvm/trunk/unittests/MC/AsmStreamerTest.cpp Mon Jun 29 14:57:24 2009 @@ -40,14 +40,14 @@ TEST(AsmStreamer, EmptyOutput) { StringAsmStreamer S; - EXPECT_EQ(S.getString(), ""); + EXPECT_EQ("", S.getString()); } TEST(AsmStreamer, Sections) { StringAsmStreamer S; MCSection *Sec0 = S.getContext().GetSection("foo"); S.getStreamer().SwitchSection(Sec0); - EXPECT_EQ(S.getString(), ".section foo\n"); + EXPECT_EQ(".section foo\n", S.getString()); } TEST(AsmStreamer, Values) { @@ -62,14 +62,13 @@ S.getStreamer().EmitValue(MCValue::get(A, B, 10), 2); S.getStreamer().EmitValue(MCValue::get(A, B, 10), 4); S.getStreamer().EmitValue(MCValue::get(A, B, 10), 8); - EXPECT_EQ(S.getString(), ".section foo\n\ + EXPECT_EQ(".section foo\n\ a:\n\ b:\n\ .byte a - b + 10\n\ .short a - b + 10\n\ .long a - b + 10\n\ -.quad a - b + 10\n\ -"); +.quad a - b + 10\n", S.getString()); } TEST(AsmStreamer, Align) { @@ -80,11 +79,10 @@ S.getStreamer().EmitValueToAlignment(4, /*Value=*/12, /*ValueSize=*/2); S.getStreamer().EmitValueToAlignment(8, /*Value=*/12, /*ValueSize=*/4, /*MaxBytesToEmit=*/24); - EXPECT_EQ(S.getString(), ".section foo\n\ + EXPECT_EQ(".section foo\n\ .p2align 2, 0\n\ .p2alignw 2, 12\n\ -.p2alignl 3, 12, 24\n\ -"); +.p2alignl 3, 12, 24\n", S.getString()); } TEST(AsmStreamer, Org) { @@ -94,10 +92,9 @@ MCSymbol *A = S.getContext().CreateSymbol("a"); S.getStreamer().EmitLabel(A); S.getStreamer().EmitValueToOffset(MCValue::get(A, 0, 4), 32); - EXPECT_EQ(S.getString(), ".section foo\n\ + EXPECT_EQ(".section foo\n\ a:\n\ -.org a + 4, 32\n\ -"); +.org a + 4, 32\n", S.getString()); } } From edwintorok at gmail.com Mon Jun 29 14:59:11 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Mon, 29 Jun 2009 19:59:11 -0000 Subject: [llvm-commits] [llvm] r74442 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp Message-ID: <200906291959.n5TJxBPe029603@zion.cs.uiuc.edu> Author: edwin Date: Mon Jun 29 14:59:10 2009 New Revision: 74442 URL: http://llvm.org/viewvc/llvm-project?rev=74442&view=rev Log: Initialize CurSection in constructor. Not doing so causes some unittests to fail, because CurSection is uninitialized. Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=74442&r1=74441&r2=74442&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Jun 29 14:59:10 2009 @@ -25,7 +25,7 @@ public: MCAsmStreamer(MCContext &Context, raw_ostream &_OS) - : MCStreamer(Context), OS(_OS) {} + : MCStreamer(Context), OS(_OS), CurSection(0) {} ~MCAsmStreamer() {} /// @name MCStreamer Interface From greened at obbligato.org Mon Jun 29 14:59:53 2009 From: greened at obbligato.org (David Greene) Date: Mon, 29 Jun 2009 19:59:53 -0000 Subject: [llvm-commits] [llvm] r74443 - /llvm/trunk/utils/TableGen/TGParser.cpp Message-ID: <200906291959.n5TJxrZL029631@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 29 14:59:52 2009 New Revision: 74443 URL: http://llvm.org/viewvc/llvm-project?rev=74443&view=rev Log: Improve TableGen error reporting. Modified: llvm/trunk/utils/TableGen/TGParser.cpp Modified: llvm/trunk/utils/TableGen/TGParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=74443&r1=74442&r2=74443&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.cpp (original) +++ llvm/trunk/utils/TableGen/TGParser.cpp Mon Jun 29 14:59:52 2009 @@ -1395,7 +1395,7 @@ std::vector TGParser::ParseValueList(Record *CurRec, Record *ArgsRec, RecTy *EltTy) { std::vector Result; RecTy *ItemType = EltTy; - int ArgN = 0; + unsigned int ArgN = 0; if (ArgsRec != 0 && EltTy == 0) { const std::vector &TArgs = ArgsRec->getTemplateArgs(); const RecordVal *RV = ArgsRec->getValue(TArgs[ArgN]); @@ -1411,6 +1411,10 @@ if (ArgsRec != 0 && EltTy == 0) { const std::vector &TArgs = ArgsRec->getTemplateArgs(); + if (ArgN >= TArgs.size()) { + TokError("too many template arguments"); + return std::vector(); + } const RecordVal *RV = ArgsRec->getValue(TArgs[ArgN]); assert(RV && "Template argument record not found??"); ItemType = RV->getType(); From greened at obbligato.org Mon Jun 29 15:05:39 2009 From: greened at obbligato.org (David Greene) Date: Mon, 29 Jun 2009 20:05:39 -0000 Subject: [llvm-commits] [llvm] r74444 - in /llvm/trunk: docs/TableGenFundamentals.html utils/TableGen/Record.cpp utils/TableGen/Record.h Message-ID: <200906292005.n5TK5gGn029811@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 29 15:05:29 2009 New Revision: 74444 URL: http://llvm.org/viewvc/llvm-project?rev=74444&view=rev Log: Implement !cast. Modified: llvm/trunk/docs/TableGenFundamentals.html llvm/trunk/utils/TableGen/Record.cpp llvm/trunk/utils/TableGen/Record.h Modified: llvm/trunk/docs/TableGenFundamentals.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=74444&r1=74443&r2=74444&view=diff ============================================================================== --- llvm/trunk/docs/TableGenFundamentals.html (original) +++ llvm/trunk/docs/TableGenFundamentals.html Mon Jun 29 15:05:29 2009 @@ -411,7 +411,8 @@

!cast(a)
A symbol of type type obtained by looking up the string 'a' in the symbol table. If the type of 'a' does not match type, TableGen -aborts with an error.
+aborts with an error. !cast is a special case in that the argument must +be an object defined by a 'def' construct.
!nameconcat<type>(a, b)
Shorthand for !cast(!strconcat(a, b))
!subst(a, b, c)
Modified: llvm/trunk/utils/TableGen/Record.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=74444&r1=74443&r2=74444&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.cpp (original) +++ llvm/trunk/utils/TableGen/Record.cpp Mon Jun 29 15:05:29 2009 @@ -537,52 +537,80 @@ switch (getOpcode()) { default: assert(0 && "Unknown unop"); case CAST: { - StringInit *LHSs = dynamic_cast(LHS); - if (LHSs) { - std::string Name = LHSs->getValue(); - - // From TGParser::ParseIDValue - if (CurRec) { - if (const RecordVal *RV = CurRec->getValue(Name)) { - if (RV->getType() != getType()) { - throw "type mismatch in nameconcat"; + if (getType()->getAsString() == "string") { + StringInit *LHSs = dynamic_cast(LHS); + if (LHSs) { + return LHSs; + } + + DefInit *LHSd = dynamic_cast(LHS); + if (LHSd) { + return new StringInit(LHSd->getDef()->getName()); + } + +// VarInit *LHSv = dynamic_cast(LHS); +// if (LHSv) { +// // If this is not a template arg, cast it +// if (!CurRec->isTemplateArg(LHSv->getName()) +// && !CurMultiClass) { +// return new StringInit(LHSv->getName()); +// } +// break; +// } + +// OpInit *LHSo = dynamic_cast(LHS); +// if (!LHSo) { +// return new StringInit(LHS->getAsString()); +// } + } + else { + StringInit *LHSs = dynamic_cast(LHS); + if (LHSs) { + std::string Name = LHSs->getValue(); + + // From TGParser::ParseIDValue + if (CurRec) { + if (const RecordVal *RV = CurRec->getValue(Name)) { + if (RV->getType() != getType()) { + throw "type mismatch in nameconcat"; + } + return new VarInit(Name, RV->getType()); } - return new VarInit(Name, RV->getType()); - } - - std::string TemplateArgName = CurRec->getName()+":"+Name; - if (CurRec->isTemplateArg(TemplateArgName)) { - const RecordVal *RV = CurRec->getValue(TemplateArgName); - assert(RV && "Template arg doesn't exist??"); - if (RV->getType() != getType()) { - throw "type mismatch in nameconcat"; - } + std::string TemplateArgName = CurRec->getName()+":"+Name; + if (CurRec->isTemplateArg(TemplateArgName)) { + const RecordVal *RV = CurRec->getValue(TemplateArgName); + assert(RV && "Template arg doesn't exist??"); + + if (RV->getType() != getType()) { + throw "type mismatch in nameconcat"; + } - return new VarInit(TemplateArgName, RV->getType()); + return new VarInit(TemplateArgName, RV->getType()); + } } - } - - if (CurMultiClass) { - std::string MCName = CurMultiClass->Rec.getName()+"::"+Name; - if (CurMultiClass->Rec.isTemplateArg(MCName)) { - const RecordVal *RV = CurMultiClass->Rec.getValue(MCName); - assert(RV && "Template arg doesn't exist??"); - if (RV->getType() != getType()) { - throw "type mismatch in nameconcat"; + if (CurMultiClass) { + std::string MCName = CurMultiClass->Rec.getName()+"::"+Name; + if (CurMultiClass->Rec.isTemplateArg(MCName)) { + const RecordVal *RV = CurMultiClass->Rec.getValue(MCName); + assert(RV && "Template arg doesn't exist??"); + + if (RV->getType() != getType()) { + throw "type mismatch in nameconcat"; + } + + return new VarInit(MCName, RV->getType()); } - - return new VarInit(MCName, RV->getType()); } - } - - if (Record *D = Records.getDef(Name)) - return new DefInit(D); + + if (Record *D = Records.getDef(Name)) + return new DefInit(D); - cerr << "Variable not defined: '" + Name + "'\n"; - assert(0 && "Variable not found"); - return 0; + cerr << "Variable not defined: '" + Name + "'\n"; + assert(0 && "Variable not found"); + return 0; + } } break; } @@ -654,6 +682,23 @@ return Result + "(" + LHS->getAsString() + ")"; } +RecTy *UnOpInit::getFieldType(const std::string &FieldName) const { + switch (getOpcode()) { + default: assert(0 && "Unknown unop"); + case CAST: { + RecordRecTy *RecordType = dynamic_cast(getType()); + if (RecordType) { + RecordVal *Field = RecordType->getRecord()->getValue(FieldName); + if (Field) { + return Field->getType(); + } + } + break; + } + } + return 0; +} + Init *BinOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) { switch (getOpcode()) { default: assert(0 && "Unknown binop"); Modified: llvm/trunk/utils/TableGen/Record.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=74444&r1=74443&r2=74444&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.h (original) +++ llvm/trunk/utils/TableGen/Record.h Mon Jun 29 15:05:29 2009 @@ -834,6 +834,12 @@ virtual Init *resolveReferences(Record &R, const RecordVal *RV); + /// getFieldType - This method is used to implement the FieldInit class. + /// Implementors of this method should return the type of the named field if + /// they are of record type. + /// + virtual RecTy *getFieldType(const std::string &FieldName) const; + virtual std::string getAsString() const; }; From greened at obbligato.org Mon Jun 29 15:07:18 2009 From: greened at obbligato.org (David Greene) Date: Mon, 29 Jun 2009 20:07:18 -0000 Subject: [llvm-commits] [llvm] r74445 - in /llvm/trunk/test/TableGen: ListArgs.td ListArgsSimple.td Message-ID: <200906292007.n5TK7IJu029871@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 29 15:07:17 2009 New Revision: 74445 URL: http://llvm.org/viewvc/llvm-project?rev=74445&view=rev Log: Add some tests of advanced TableGen list functionality. Added: llvm/trunk/test/TableGen/ListArgs.td llvm/trunk/test/TableGen/ListArgsSimple.td Added: llvm/trunk/test/TableGen/ListArgs.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/ListArgs.td?rev=74445&view=auto ============================================================================== --- llvm/trunk/test/TableGen/ListArgs.td (added) +++ llvm/trunk/test/TableGen/ListArgs.td Mon Jun 29 15:07:17 2009 @@ -0,0 +1,11 @@ +// RUN: tblgen %s + +class B v> { + list vals = v; +} + +class BB> vals> : B; +class BBB> vals> : BB; + +def OneB : BBB<[[1,2,3]]>; +def TwoB : BBB<[[1,2,3],[4,5,6]]>; Added: llvm/trunk/test/TableGen/ListArgsSimple.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/ListArgsSimple.td?rev=74445&view=auto ============================================================================== --- llvm/trunk/test/TableGen/ListArgsSimple.td (added) +++ llvm/trunk/test/TableGen/ListArgsSimple.td Mon Jun 29 15:07:17 2009 @@ -0,0 +1,8 @@ +// RUN: tblgen %s + +class B { + int val = v; +} + +class BB vals> : B; +class BBB vals> : BB; From edwintorok at gmail.com Mon Jun 29 15:09:23 2009 From: edwintorok at gmail.com (=?UTF-8?B?VMO2csO2ayBFZHdpbg==?=) Date: Mon, 29 Jun 2009 23:09:23 +0300 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html pubs.js In-Reply-To: References: <200906291643.n5TGhjxt023422@zion.cs.uiuc.edu> <4A49036F.7010308@gmail.com> Message-ID: <4A491F73.6040200@gmail.com> On 2009-06-29 22:53, Misha Brukman wrote: > 2009/6/29 T?r?k Edwin > > > On 2009-06-29 19:43, Misha Brukman wrote: > > Changes in directory llvm-www/pubs: > > > > index.html updated: 1.91 -> 1.92 > > pubs.js updated: 1.46 -> 1.47 > > --- > > Log message: > > > > Added a histogram of publications over years as a chart. > > > > Sounds cool, where can I see the histogram? > It doesn't show up in my firefox. > > > http://llvm.org/pubs/ -- see top right of the page. Works for me in > Firefox 3 on Linux. Firefox 3.0.11, Linux here too. Using chart.apis.google.com in the URL instead of google.com makes the image appear. I don't know why www.google.com/charts doesn't work (it does if I copy+paste the URL in a new tab). Best regards, --Edwin From rafael.espindola at gmail.com Mon Jun 29 15:30:11 2009 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 29 Jun 2009 20:30:11 -0000 Subject: [llvm-commits] [llvm] r74446 - in /llvm/trunk: lib/Target/X86/X86FloatingPoint.cpp test/CodeGen/X86/inline-asm-fpstack3.ll Message-ID: <200906292030.n5TKUEGg030491@zion.cs.uiuc.edu> Author: rafael Date: Mon Jun 29 15:29:59 2009 New Revision: 74446 URL: http://llvm.org/viewvc/llvm-project?rev=74446&view=rev Log: FIX PR 4459. Not sure I understand how the temp register gets used, but this fixes a bug and introduces no regressions. Added: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=74446&r1=74445&r2=74446&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Mon Jun 29 15:29:59 2009 @@ -996,7 +996,7 @@ // it is possible for FP0 to be alive after this instruction. if (!MI->killsRegister(X86::FP0)) { // Duplicate ST0 - duplicateToTop(0, 0, I); + duplicateToTop(0, 7 /*temp register*/, I); } --StackTop; // "Forget" we have something on the top of stack! break; Added: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll?rev=74446&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll (added) +++ llvm/trunk/test/CodeGen/X86/inline-asm-fpstack3.ll Mon Jun 29 15:29:59 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86 > %t +; RUN: grep {fld %%st(0)} %t +; PR4459 + +declare x86_fp80 @ceil(x86_fp80) + +declare void @test(x86_fp80) + +define void @test2(x86_fp80 %a) { +entry: + %0 = call x86_fp80 @ceil(x86_fp80 %a) + call void asm sideeffect "fistpl $0", "{st}"( x86_fp80 %0) + call void @test(x86_fp80 %0 ) + ret void +} From andrelct at dcc.ufmg.br Mon Jun 29 15:33:27 2009 From: andrelct at dcc.ufmg.br (Andre Tavares) Date: Mon, 29 Jun 2009 17:33:27 -0300 Subject: [llvm-commits] SSI patch In-Reply-To: <4A46F76E.4070704@mxc.ca> References: <4A4374C5.7090508@dcc.ufmg.br> <4A46F76E.4070704@mxc.ca> Message-ID: <4A492517.1040808@dcc.ufmg.br> Nick Lewycky wrote: > Andre Tavares wrote: > >> Hello, >> >> I'm submiting a patch that will be responsible to create SSI >> representation on demand. This representation conforms with the current >> SSA, and will not break other optimizations. It only inserts some phi >> functions on the code. A brief description is below, and the code is >> attached. >> >> // This pass converts a list of variables to the Static Single Information >> // form. This is a program representation described by Scott Ananian in his >> // Master Thesis: "The Static Single Information Form (1999)". >> // We are building an on-demand representation, that is, we do not convert >> // every single variable in the target function to SSI form. Rather, we >> receive >> // a list of target variables that must be converted. We also do not >> // completely convert a target variable to the SSI format. Instead, we only >> // change the variable in the points where new information can be attached >> // to its live range, that is, at branch points. >> > > // Test if there is a need to transform to SSI > if (needConstruction.count() > 0) { > > Use !needConstruction.empty() . > Yep, changed to any, as you mentioned below somewhere. > void SSI::insertSigmaFunctions(std::vector & value) { > for (unsigned i = 0; i < num_values; ++i) { > if (needConstruction[i]) { > > Just put "if (!needConstruction[i]) continue;" to avoid indenting > everything another level. > ok > for (; begin != end; ++begin) { > // Test if the Use of the Value is in a comparator > CmpInst * CI; > if ((CI = dyn_cast (begin)) && isUsedInTerminator(CI)) { > > How about: > for (; begin != end; ++begin) { > CmpInst *CI = dyn_cast(begin); > if (!CI || !isUsedInTerminator(CI)) { > instead? > ok. Isn't it without !. Like if (CI || !isUsedInTerminator(CI)) { > In insertPhiFunctions: > > std::set * BB_visited = new std::set(); > while (...) { ... > free(BB_visited); > } > > How about allocating std::set BB_visited on the stack and > calling BB_visited.clear() each iteration through the loop? > > Done already, just didn't send the latest version. Thanks. > // Test if has not yet visited this node and if the > // original definition dominates this node > if (BB_visited->insert(BB_dominated).second && value_original[i] > != BB_dominated > && DT_->dominates(value_original[i], BB_dominated) > && dominateAny(BB_dominated, value[i])) { > > I think the "value_original[i] != BB_dominated && > DT_->dominates(value_original[i], BB_dominated)" part can be rewritten > as "DT_->properlyDominates(value_original[i], BB_dominated)". > > Of coarse. Missed that. > Also, please fit the operators on the end of the line. > > In SSI::rename: > // For SSI_SIG (b = PHI(a)), b is a new definition to a. So we need to > "new definition *of a"? > // Then store bin the value_stack as the new definition of a. > Not sure what the means. > I mean that b is a sigma of a, so it is a new definition of a. But I changed that part to look better. > TerminatorInst * TI = BB->getTerminator(); > for (unsigned i = 0; i < TI->getNumSuccessors(); ++i) { > BasicBlock * BB_succ = TI->getSuccessor(i); > > Perhaps you wanted: > for (succ_iterator SI = succ_begin(BI), SE = succ_end(B); SI != SE; > ++SI) { > ? You need to #include "llvm/Support/CFG.h" for that. > > ok. > // This loop calls rename on all children from this block. This time > children > // refers to a successor block in the dominance tree. > > In other words, it calls rename on all immediately dominated blocks? > > yes. > if (defined->count() > 0) { > > Use "if (defined->any()) {". Count isn't particularly expensive but > any() is cheaper. > > > ok > void SSI::substituteUse(Instruction * I) { > for (unsigned i = 0; i < I->getNumOperands(); ++i) { > Value * operand = I->getOperand(i); > for (unsigned j = 0; j < num_values; ++j) { > if (operand == value_stack[j].front() && I != > value_stack[j].back()) { > > It's not clear to me what the if-statement is actually doing, and > whether it's any different from just using "if (i != j) continue;". > There are two for here. The outside for iterates in all operands of I, and the inside in all variables I received. The first part of the if is testing if the operand of the moment is the variable of the moment. I can't use "if (i != j) continue;", because i and j are used to iterate in different things. Was clear? > if ((I_phi = dyn_cast (I)) && (vs_phi = dyn_cast ( > value_stack[j].back())) && value_stack[j].back()->getParent() > == I->getParent()) { > > This needs to be line-flowed better. Here's my suggestion: > if ((I_phi = dyn_cast(I)) && > (vs_phi = dyn_cast (value_stack[j].back())) && > value_stack[j].back()->getParent() == I->getParent()) { > which keeps each 'phrase' on one line. > Changed to PHINode * I_phi = dyn_cast (I); PHINode * vs_phi = dyn_cast (value_stack[j].back()); if (I_phi && vs_phi && value_stack[j].back()->getParent() == I->getParent()) { > /// Test if the BasicBlock BB dominates any use or definition of value. > /// > bool SSI::dominateAny(BasicBlock * BB, Instruction * value) { > > This whole method should work by a) checking whether the Instruction > itself is dominator (if so, so are all non-phi uses, so return true > fast) else just loop over the users who are PHINodes and test them only. > > Don't get what you mean here. I have to test all users of the instruction not only the PHINodes, correct? This method is testing if the value is alive in BB. As there is no LiveVariableAnalysis here I used Dominance. > Break SSI::getPosition up into getPositionPhi and getPositionSigma. All > callers put a constant value into compare anyways, and there's no way > that copying an std::map like that can be cheap. > > ok > In SSI::isUsedInTerminator, we know that the comparison field of a > BranchInst or SwitchInst is going to be field 0. Just make sure > getNumOperands() != 0 then look at field 0. No loop needed. > > great. > Overall, looks good! I like your choice of Ananian's algorithm over > Singer's because it avoids requiring reverse dominfo (yay!). I didn't > see anything wrong with the algorithm details. > > The one thing to remember is that when placing sigma's in the first > place you use a very simple flow of "is it a CmpInst which flows to a > TerminatorInst". That's probably good enough for ABCD but not for a > GCC-like VRP algorithm. You don't need to worry about that though, > whoever tried to implement a GCC-like VRP gets to worry about it. > > Nick > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > -- Andre Tavares Master Student in Computer Science - UFMG - Brasil http://dcc.ufmg.br/~andrelct From gohman at apple.com Mon Jun 29 15:34:14 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Jun 2009 20:34:14 -0000 Subject: [llvm-commits] [llvm] r74447 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Transforms/IndVarSimplify/loop_evaluate9.ll Message-ID: <200906292034.n5TKYEDC030641@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 29 15:34:13 2009 New Revision: 74447 URL: http://llvm.org/viewvc/llvm-project?rev=74447&view=rev Log: Don't cache PHI exit values from exhaustive evaluations, because an individual exhaustive evaluation reflects only the exit value implied by an individual exit, which may differ from the actual exit value of the loop if there are other exits. This fixes PR4477. Added: llvm/trunk/test/Transforms/IndVarSimplify/loop_evaluate9.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=74447&r1=74446&r2=74447&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 29 15:34:13 2009 @@ -3521,7 +3521,6 @@ if (!CondVal) return getCouldNotCompute(); if (CondVal->getValue() == uint64_t(ExitWhen)) { - ConstantEvolutionLoopExitValue[PN] = PHIVal; ++NumBruteForceTripCountsComputed; return getConstant(Type::Int32Ty, IterationNum); } Added: llvm/trunk/test/Transforms/IndVarSimplify/loop_evaluate9.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/loop_evaluate9.ll?rev=74447&view=auto ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/loop_evaluate9.ll (added) +++ llvm/trunk/test/Transforms/IndVarSimplify/loop_evaluate9.ll Mon Jun 29 15:34:13 2009 @@ -0,0 +1,78 @@ +; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t +; RUN: grep {\[%\]tmp5.lcssa = phi i8 \\\[ 63, \[%\]cc70a02__complex_integers__Oadd.153.exit.i \\\]} %t +; RUN: grep {\[%\]tmp4.lcssa = phi i8 \\\[ -28, \[%\]cc70a02__complex_integers__Oadd.153.exit.i \\\]} %t +; PR4477 + +; Indvars should compute the exit values in loop. + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i386-pc-linux-gnu" + %struct.cc70a02__complex_integers__complex_type = type { i8, i8 } + at .str = internal constant [13 x i8] c"fc70a00.adb\00\00", align 1 ; <[13 x i8]*> [#uses=1] + +define void @_ada_cc70a02() { +entry: + br label %bb1.i + +bb1.i: ; preds = %bb2.i, %entry + %indvar.i = phi i32 [ 0, %entry ], [ %indvar.next.i, %bb2.i ] ; [#uses=2] + %result.0.i = phi i16 [ 0, %entry ], [ %ins36.i, %bb2.i ] ; [#uses=2] + %tmp38.i = trunc i16 %result.0.i to i8 ; [#uses=2] + %tmp = add i8 %tmp38.i, 96 ; [#uses=1] + %tmp1 = icmp ugt i8 %tmp, -56 ; [#uses=1] + br i1 %tmp1, label %bb.i.i, label %bb1.i.i + +bb.i.i: ; preds = %bb1.i + tail call void @__gnat_rcheck_12(i8* getelementptr ([13 x i8]* @.str, i32 0, i32 0), i32 24) noreturn + unreachable + +bb1.i.i: ; preds = %bb1.i + %tmp41.i = lshr i16 %result.0.i, 8 ; [#uses=1] + %tmp42.i = trunc i16 %tmp41.i to i8 ; [#uses=2] + %tmp2 = add i8 %tmp42.i, 109 ; [#uses=1] + %tmp3 = icmp ugt i8 %tmp2, -56 ; [#uses=1] + br i1 %tmp3, label %bb2.i.i, label %cc70a02__complex_integers__Oadd.153.exit.i + +bb2.i.i: ; preds = %bb1.i.i + tail call void @__gnat_rcheck_12(i8* getelementptr ([13 x i8]* @.str, i32 0, i32 0), i32 24) noreturn + unreachable + +cc70a02__complex_integers__Oadd.153.exit.i: ; preds = %bb1.i.i + %tmp4 = add i8 %tmp38.i, -4 ; [#uses=2] + %tmp5 = add i8 %tmp42.i, 9 ; [#uses=2] + %tmp25.i = zext i8 %tmp4 to i16 ; [#uses=1] + %tmp33.i = zext i8 %tmp5 to i16 ; [#uses=1] + %tmp34.i = shl i16 %tmp33.i, 8 ; [#uses=1] + %ins36.i = or i16 %tmp34.i, %tmp25.i ; [#uses=1] + %tmp6 = icmp eq i32 %indvar.i, 6 ; [#uses=1] + br i1 %tmp6, label %cc70a02__complex_multiplication.170.exit, label %bb2.i + +bb2.i: ; preds = %cc70a02__complex_integers__Oadd.153.exit.i + %indvar.next.i = add i32 %indvar.i, 1 ; [#uses=1] + br label %bb1.i + +cc70a02__complex_multiplication.170.exit: ; preds = %cc70a02__complex_integers__Oadd.153.exit.i + %tmp7 = icmp eq i8 %tmp4, -28 ; [#uses=1] + %tmp8 = icmp eq i8 %tmp5, 63 ; [#uses=1] + %or.cond = and i1 %tmp8, %tmp7 ; [#uses=1] + br i1 %or.cond, label %return, label %bb1 + +bb1: ; preds = %cc70a02__complex_multiplication.170.exit + tail call void @exit(i32 1) + ret void + +return: ; preds = %cc70a02__complex_multiplication.170.exit + ret void +} + +declare fastcc void @cc70a02__complex_integers__complex.164(%struct.cc70a02__complex_integers__complex_type* noalias nocapture sret, i8 signext, i8 signext) nounwind + +declare fastcc void @cc70a02__complex_integers__Osubtract.149(%struct.cc70a02__complex_integers__complex_type* noalias sret, %struct.cc70a02__complex_integers__complex_type* byval align 4) + +declare fastcc void @cc70a02__complex_integers__Oadd.153(%struct.cc70a02__complex_integers__complex_type* noalias sret, %struct.cc70a02__complex_integers__complex_type* byval align 4, %struct.cc70a02__complex_integers__complex_type* byval align 4) + +declare fastcc void @cc70a02__complex_multiplication.170(%struct.cc70a02__complex_integers__complex_type* noalias sret, %struct.cc70a02__complex_integers__complex_type* byval align 4) + +declare void @__gnat_rcheck_12(i8*, i32) noreturn + +declare void @exit(i32) From daniel at zuster.org Mon Jun 29 15:37:28 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 20:37:28 -0000 Subject: [llvm-commits] [llvm] r74448 - in /llvm/trunk: test/MC/AsmParser/exprs.s tools/llvm-mc/AsmLexer.cpp tools/llvm-mc/AsmLexer.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h tools/llvm-mc/MC-X86Specific.cpp Message-ID: <200906292037.n5TKbSQl030764@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 15:37:27 2009 New Revision: 74448 URL: http://llvm.org/viewvc/llvm-project?rev=74448&view=rev Log: MC: Improve expression parsing and implement evaluation of absolute expressions. Added: llvm/trunk/test/MC/AsmParser/exprs.s Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp llvm/trunk/tools/llvm-mc/AsmLexer.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Added: llvm/trunk/test/MC/AsmParser/exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=74448&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/exprs.s (added) +++ llvm/trunk/test/MC/AsmParser/exprs.s Mon Jun 29 15:37:27 2009 @@ -0,0 +1,39 @@ +# FIXME: For now this test just checks that llvm-mc works. Once we have .macro, +# .if, and .abort we can write a better test (without resorting to miles of +# greps). + +# RUN: llvm-mc %s > %t + + .byte !1 + 2 + .byte !0 + .byte ~0 + .byte -1 + .byte +1 + .byte 1 + 2 + .byte 1 & 3 + .byte 4 / 2 + .byte 4 / -2 + .byte 1 == 1 + .byte 1 == 0 + .byte 1 > 0 + .byte 1 >= 1 + .byte 1 < 2 + .byte 1 <= 1 + .byte 4 % 3 + .byte 2 * 2 + .byte 2 != 2 + .byte 2 <> 2 + .byte 1 | 2 + .byte 1 << 1 + .byte 2 >> 1 + .byte ~0 >> 1 + .byte 3 - 2 + .byte 1 ^ 3 + .byte 1 && 2 + .byte 3 && 0 + .byte 1 || 2 + .byte 0 || 0 + + .set c, 10 + .byte c + 1 + \ No newline at end of file Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=74448&r1=74447&r2=74448&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Mon Jun 29 15:37:27 2009 @@ -262,11 +262,23 @@ case '*': return asmtok::Star; case ',': return asmtok::Comma; case '$': return asmtok::Dollar; - case '=': return asmtok::Equal; - case '|': return asmtok::Pipe; + case '=': + if (*CurPtr == '=') + return ++CurPtr, asmtok::EqualEqual; + return asmtok::Equal; + case '|': + if (*CurPtr == '|') + return ++CurPtr, asmtok::PipePipe; + return asmtok::Pipe; case '^': return asmtok::Caret; - case '&': return asmtok::Amp; - case '!': return asmtok::Exclaim; + case '&': + if (*CurPtr == '&') + return ++CurPtr, asmtok::AmpAmp; + return asmtok::Amp; + case '!': + if (*CurPtr == '=') + return ++CurPtr, asmtok::ExclaimEqual; + return asmtok::Exclaim; case '%': return LexPercent(); case '/': return LexSlash(); case '#': return LexHash(); @@ -275,19 +287,18 @@ case '5': case '6': case '7': case '8': case '9': return LexDigit(); case '<': - if (*CurPtr == '<') { - ++CurPtr; - return asmtok::LessLess; + switch (*CurPtr) { + case '<': return ++CurPtr, asmtok::LessLess; + case '=': return ++CurPtr, asmtok::LessEqual; + case '>': return ++CurPtr, asmtok::LessGreater; + default: return asmtok::Less; } - // Don't have any use for bare '<' yet. - return ReturnError(TokStart, "invalid character in input"); case '>': - if (*CurPtr == '>') { - ++CurPtr; - return asmtok::GreaterGreater; + switch (*CurPtr) { + case '>': return ++CurPtr, asmtok::GreaterGreater; + case '=': return ++CurPtr, asmtok::GreaterEqual; + default: return asmtok::Greater; } - // Don't have any use for bare '>' yet. - return ReturnError(TokStart, "invalid character in input"); // TODO: Quoted identifiers (objc methods etc) // local labels: [0-9][:] Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=74448&r1=74447&r2=74448&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Mon Jun 29 15:37:27 2009 @@ -42,10 +42,12 @@ Plus, Minus, Tilde, Slash, // '/' LParen, RParen, - Star, Comma, Dollar, Equal, + Star, Comma, Dollar, Equal, EqualEqual, - Pipe, Caret, Amp, Exclaim, - Percent, LessLess, GreaterGreater + Pipe, PipePipe, Caret, + Amp, AmpAmp, Exclaim, ExclaimEqual, Percent, + Less, LessEqual, LessLess, LessGreater, + Greater, GreaterEqual, GreaterGreater }; } Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74448&r1=74447&r2=74448&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 29 15:37:27 2009 @@ -12,6 +12,8 @@ //===----------------------------------------------------------------------===// #include "AsmParser.h" + +#include "AsmExpr.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCStreamer.h" @@ -57,7 +59,7 @@ /// /// parenexpr ::= expr) /// -bool AsmParser::ParseParenExpr(int64_t &Res) { +bool AsmParser::ParseParenExpr(AsmExpr *&Res) { if (ParseExpression(Res)) return true; if (Lexer.isNot(asmtok::RParen)) return TokError("expected ')' in parentheses expression"); @@ -70,28 +72,47 @@ /// primaryexpr ::= symbol /// primaryexpr ::= number /// primaryexpr ::= ~,+,- primaryexpr -bool AsmParser::ParsePrimaryExpr(int64_t &Res) { +bool AsmParser::ParsePrimaryExpr(AsmExpr *&Res) { switch (Lexer.getKind()) { default: return TokError("unknown token in expression"); + case asmtok::Exclaim: + Lexer.Lex(); // Eat the operator. + if (ParsePrimaryExpr(Res)) + return true; + Res = new AsmUnaryExpr(AsmUnaryExpr::LNot, Res); + return false; case asmtok::Identifier: // This is a label, this should be parsed as part of an expression, to - // handle things like LFOO+4 - Res = 0; // FIXME. + // handle things like LFOO+4. + Res = new AsmSymbolRefExpr(Ctx.GetOrCreateSymbol(Lexer.getCurStrVal())); Lexer.Lex(); // Eat identifier. return false; case asmtok::IntVal: - Res = Lexer.getCurIntVal(); + Res = new AsmConstantExpr(Lexer.getCurIntVal()); Lexer.Lex(); // Eat identifier. return false; case asmtok::LParen: Lexer.Lex(); // Eat the '('. return ParseParenExpr(Res); - case asmtok::Tilde: - case asmtok::Plus: case asmtok::Minus: Lexer.Lex(); // Eat the operator. - return ParsePrimaryExpr(Res); + if (ParsePrimaryExpr(Res)) + return true; + Res = new AsmUnaryExpr(AsmUnaryExpr::Minus, Res); + return false; + case asmtok::Plus: + Lexer.Lex(); // Eat the operator. + if (ParsePrimaryExpr(Res)) + return true; + Res = new AsmUnaryExpr(AsmUnaryExpr::Plus, Res); + return false; + case asmtok::Tilde: + Lexer.Lex(); // Eat the operator. + if (ParsePrimaryExpr(Res)) + return true; + Res = new AsmUnaryExpr(AsmUnaryExpr::Not, Res); + return false; } } @@ -102,59 +123,125 @@ /// expr ::= expr *,/,%,<<,>> expr -> highest. /// expr ::= primaryexpr /// -bool AsmParser::ParseExpression(int64_t &Res) { +bool AsmParser::ParseExpression(AsmExpr *&Res) { + Res = 0; return ParsePrimaryExpr(Res) || ParseBinOpRHS(1, Res); } -static unsigned getBinOpPrecedence(asmtok::TokKind K) { +bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { + AsmExpr *Expr; + + if (ParseExpression(Expr)) + return true; + + if (!Expr->EvaluateAsAbsolute(Ctx, Res)) + return TokError("expected absolute expression"); + + return false; +} + +static unsigned getBinOpPrecedence(asmtok::TokKind K, + AsmBinaryExpr::Opcode &Kind) { switch (K) { default: return 0; // not a binop. + + // Lowest Precedence: &&, || + case asmtok::AmpAmp: + Kind = AsmBinaryExpr::LAnd; + return 1; + case asmtok::PipePipe: + Kind = AsmBinaryExpr::LOr; + return 1; + + // Low Precedence: +, -, ==, !=, <>, <, <=, >, >= case asmtok::Plus: + Kind = AsmBinaryExpr::Add; + return 2; case asmtok::Minus: - return 1; + Kind = AsmBinaryExpr::Sub; + return 2; + case asmtok::EqualEqual: + Kind = AsmBinaryExpr::EQ; + return 2; + case asmtok::ExclaimEqual: + case asmtok::LessGreater: + Kind = AsmBinaryExpr::NE; + return 2; + case asmtok::Less: + Kind = AsmBinaryExpr::LT; + return 2; + case asmtok::LessEqual: + Kind = AsmBinaryExpr::LTE; + return 2; + case asmtok::Greater: + Kind = AsmBinaryExpr::GT; + return 2; + case asmtok::GreaterEqual: + Kind = AsmBinaryExpr::GTE; + return 2; + + // Intermediate Precedence: |, &, ^ + // + // FIXME: gas seems to support '!' as an infix operator? case asmtok::Pipe: + Kind = AsmBinaryExpr::Or; + return 3; case asmtok::Caret: + Kind = AsmBinaryExpr::Xor; + return 3; case asmtok::Amp: - case asmtok::Exclaim: - return 2; + Kind = AsmBinaryExpr::And; + return 3; + + // Highest Precedence: *, /, %, <<, >> case asmtok::Star: + Kind = AsmBinaryExpr::Mul; + return 4; case asmtok::Slash: + Kind = AsmBinaryExpr::Div; + return 4; case asmtok::Percent: + Kind = AsmBinaryExpr::Mod; + return 4; case asmtok::LessLess: + Kind = AsmBinaryExpr::Shl; + return 4; case asmtok::GreaterGreater: - return 3; + Kind = AsmBinaryExpr::Shr; + return 4; } } /// ParseBinOpRHS - Parse all binary operators with precedence >= 'Precedence'. /// Res contains the LHS of the expression on input. -bool AsmParser::ParseBinOpRHS(unsigned Precedence, int64_t &Res) { +bool AsmParser::ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res) { while (1) { - unsigned TokPrec = getBinOpPrecedence(Lexer.getKind()); + AsmBinaryExpr::Opcode Kind; + unsigned TokPrec = getBinOpPrecedence(Lexer.getKind(), Kind); // If the next token is lower precedence than we are allowed to eat, return // successfully with what we ate already. if (TokPrec < Precedence) return false; - //asmtok::TokKind BinOp = Lexer.getKind(); Lexer.Lex(); // Eat the next primary expression. - int64_t RHS; + AsmExpr *RHS; if (ParsePrimaryExpr(RHS)) return true; // If BinOp binds less tightly with RHS than the operator after RHS, let // the pending operator take RHS as its LHS. - unsigned NextTokPrec = getBinOpPrecedence(Lexer.getKind()); + AsmBinaryExpr::Opcode Dummy; + unsigned NextTokPrec = getBinOpPrecedence(Lexer.getKind(), Dummy); if (TokPrec < NextTokPrec) { if (ParseBinOpRHS(Precedence+1, RHS)) return true; } - // Merge LHS/RHS: fixme use the right operator etc. - Res += RHS; + // Merge LHS and RHS according to operator. + Res = new AsmBinaryExpr(Kind, Res, RHS); } } @@ -354,7 +441,7 @@ bool AsmParser::ParseAssignment(const char *Name, bool IsDotSet) { int64_t Value; - if (ParseExpression(Value)) + if (ParseAbsoluteExpression(Value)) return true; if (Lexer.isNot(asmtok::EndOfStatement)) @@ -433,7 +520,7 @@ } /// ParseDirectiveAscii: -/// ::= ( .ascii | .asciiz ) [ "string" ( , "string" )* ] +/// ::= ( .ascii | .asciz ) [ "string" ( , "string" )* ] bool AsmParser::ParseDirectiveAscii(bool ZeroTerminated) { if (Lexer.isNot(asmtok::EndOfStatement)) { for (;;) { @@ -469,7 +556,7 @@ if (Lexer.isNot(asmtok::EndOfStatement)) { for (;;) { int64_t Expr; - if (ParseExpression(Expr)) + if (ParseAbsoluteExpression(Expr)) return true; Out.EmitValue(MCValue::get(Expr), Size); @@ -492,7 +579,7 @@ /// ::= .space expression [ , expression ] bool AsmParser::ParseDirectiveSpace() { int64_t NumBytes; - if (ParseExpression(NumBytes)) + if (ParseAbsoluteExpression(NumBytes)) return true; int64_t FillExpr = 0; @@ -502,7 +589,7 @@ return TokError("unexpected token in '.space' directive"); Lexer.Lex(); - if (ParseExpression(FillExpr)) + if (ParseAbsoluteExpression(FillExpr)) return true; HasFillExpr = true; @@ -527,7 +614,7 @@ /// ::= .fill expression , expression , expression bool AsmParser::ParseDirectiveFill() { int64_t NumValues; - if (ParseExpression(NumValues)) + if (ParseAbsoluteExpression(NumValues)) return true; if (Lexer.isNot(asmtok::Comma)) @@ -535,7 +622,7 @@ Lexer.Lex(); int64_t FillSize; - if (ParseExpression(FillSize)) + if (ParseAbsoluteExpression(FillSize)) return true; if (Lexer.isNot(asmtok::Comma)) @@ -543,7 +630,7 @@ Lexer.Lex(); int64_t FillExpr; - if (ParseExpression(FillExpr)) + if (ParseAbsoluteExpression(FillExpr)) return true; if (Lexer.isNot(asmtok::EndOfStatement)) @@ -564,7 +651,7 @@ /// ::= .org expression [ , expression ] bool AsmParser::ParseDirectiveOrg() { int64_t Offset; - if (ParseExpression(Offset)) + if (ParseAbsoluteExpression(Offset)) return true; // Parse optional fill expression. @@ -574,7 +661,7 @@ return TokError("unexpected token in '.org' directive"); Lexer.Lex(); - if (ParseExpression(FillExpr)) + if (ParseAbsoluteExpression(FillExpr)) return true; if (Lexer.isNot(asmtok::EndOfStatement)) Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=74448&r1=74447&r2=74448&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jun 29 15:37:27 2009 @@ -17,6 +17,7 @@ #include "AsmLexer.h" namespace llvm { +class AsmExpr; class MCContext; class MCInst; class MCStreamer; @@ -44,10 +45,24 @@ void EatToEndOfStatement(); bool ParseAssignment(const char *Name, bool IsDotSet); - bool ParseExpression(int64_t &Res); - bool ParsePrimaryExpr(int64_t &Res); - bool ParseBinOpRHS(unsigned Precedence, int64_t &Res); - bool ParseParenExpr(int64_t &Res); + + /// ParseExpression - Parse a general assembly expression. + /// + /// @param Res - The resulting expression. The pointer value is null on error. + /// @result - False on success. + bool ParseExpression(AsmExpr *&Res); + + /// ParseAbsoluteExpr - Parse an expression which must evaluate to an absolute + /// value. + /// + /// @param Res - The value of the absolute expression. The result is undefined + /// on error. + /// @result - False on success. + bool ParseAbsoluteExpression(int64_t &Res); + + bool ParsePrimaryExpr(AsmExpr *&Res); + bool ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res); + bool ParseParenExpr(AsmExpr *&Res); // X86 specific. bool ParseX86InstOperands(MCInst &Inst); Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=74448&r1=74447&r2=74448&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Mon Jun 29 15:37:27 2009 @@ -87,7 +87,7 @@ // $42 -> immediate. Lexer.Lex(); int64_t Val; - if (ParseExpression(Val)) + if (ParseAbsoluteExpression(Val)) return TokError("expected integer constant"); Op = X86Operand::CreateReg(Val); return false; @@ -118,7 +118,7 @@ // it. int64_t Disp = 0; if (Lexer.isNot(asmtok::LParen)) { - if (ParseExpression(Disp)) return true; + if (ParseAbsoluteExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. @@ -139,8 +139,7 @@ // memory operand consumed. } else { // It must be an parenthesized expression, parse it now. - if (ParseParenExpr(Disp) || - ParseBinOpRHS(1, Disp)) + if (ParseAbsoluteExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized From dpatel at apple.com Mon Jun 29 15:38:14 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Jun 2009 20:38:14 -0000 Subject: [llvm-commits] [llvm] r74449 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200906292038.n5TKcELm030800@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jun 29 15:38:13 2009 New Revision: 74449 URL: http://llvm.org/viewvc/llvm-project?rev=74449&view=rev Log: Multiple DW_TAG_compile_unit is not used, afaict, on any target. Update dwarf writer to only emit one DW_TAG_compile_unit per .o file. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=74449&r1=74448&r2=74449&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Jun 29 15:38:13 2009 @@ -1093,13 +1093,8 @@ // Get the subprogram debug information entry. DISubprogram SPD(Desc.getGV()); - // Get the compile unit context. - CompileUnit *Unit = MainCU; - if (!Unit) - Unit = &FindCompileUnit(SPD.getCompileUnit()); - // Get the subprogram die. - DIE *SPDie = Unit->getDieMapSlotFor(SPD.getGV()); + DIE *SPDie = MainCU->getDieMapSlotFor(SPD.getGV()); assert(SPDie && "Missing subprogram descriptor"); if (!AbstractScope) { @@ -1112,55 +1107,27 @@ AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); } - ConstructDbgScope(RootScope, 0, 0, SPDie, Unit); + ConstructDbgScope(RootScope, 0, 0, SPDie, MainCU); } /// ConstructDefaultDbgScope - Construct a default scope for the subprogram. /// void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) { const char *FnName = MF->getFunction()->getNameStart(); - if (MainCU) { - StringMap &Globals = MainCU->getGlobals(); - StringMap::iterator GI = Globals.find(FnName); - if (GI != Globals.end()) { - DIE *SPDie = GI->second; - - // Add the function bounds. - AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, - DWLabel("func_begin", SubprogramCount)); - AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, - DWLabel("func_end", SubprogramCount)); - - MachineLocation Location(RI->getFrameRegister(*MF)); - AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); - return; - } - } else { - for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) { - CompileUnit *Unit = CompileUnits[i]; - StringMap &Globals = Unit->getGlobals(); - StringMap::iterator GI = Globals.find(FnName); - if (GI != Globals.end()) { - DIE *SPDie = GI->second; - - // Add the function bounds. - AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, - DWLabel("func_begin", SubprogramCount)); - AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, - DWLabel("func_end", SubprogramCount)); - - MachineLocation Location(RI->getFrameRegister(*MF)); - AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); - return; - } - } + StringMap &Globals = MainCU->getGlobals(); + StringMap::iterator GI = Globals.find(FnName); + if (GI != Globals.end()) { + DIE *SPDie = GI->second; + + // Add the function bounds. + AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, + DWLabel("func_begin", SubprogramCount)); + AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, + DWLabel("func_end", SubprogramCount)); + + MachineLocation Location(RI->getFrameRegister(*MF)); + AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); } - -#if 0 - // FIXME: This is causing an abort because C++ mangled names are compared with - // their unmangled counterparts. See PR2885. Don't do this assert. - assert(0 && "Couldn't find DIE for machine function!"); -#endif } /// GetOrCreateSourceID - Look up the source id with the given directory and @@ -1233,10 +1200,11 @@ dwarf::DW_FORM_data1, RVer); CompileUnit *Unit = new CompileUnit(ID, Die); - if (DIUnit.isMain()) { - assert(!MainCU && "Multiple main compile units are found!"); + if (!MainCU && DIUnit.isMain()) { + // Use first compile unit marked as isMain as the compile unit + // for this module. MainCU = Unit; - } + } CompileUnitMap[DIUnit.getGV()] = Unit; CompileUnits.push_back(Unit); @@ -1244,16 +1212,13 @@ void DwarfDebug::ConstructGlobalVariableDIE(GlobalVariable *GV) { DIGlobalVariable DI_GV(GV); - CompileUnit *DW_Unit = MainCU; - if (!DW_Unit) - DW_Unit = &FindCompileUnit(DI_GV.getCompileUnit()); // Check for pre-existence. - DIE *&Slot = DW_Unit->getDieMapSlotFor(DI_GV.getGV()); + DIE *&Slot = MainCU->getDieMapSlotFor(DI_GV.getGV()); if (Slot) return; - DIE *VariableDie = CreateGlobalVariableDIE(DW_Unit, DI_GV); + DIE *VariableDie = CreateGlobalVariableDIE(MainCU, DI_GV); // Add address. DIEBlock *Block = new DIEBlock(); @@ -1267,22 +1232,19 @@ Slot = VariableDie; // Add to context owner. - DW_Unit->getDie()->AddChild(VariableDie); + MainCU->getDie()->AddChild(VariableDie); // Expose as global. FIXME - need to check external flag. std::string Name; - DW_Unit->AddGlobal(DI_GV.getName(Name), VariableDie); + MainCU->AddGlobal(DI_GV.getName(Name), VariableDie); return; } void DwarfDebug::ConstructSubprogram(GlobalVariable *GV) { DISubprogram SP(GV); - CompileUnit *Unit = MainCU; - if (!Unit) - Unit = &FindCompileUnit(SP.getCompileUnit()); // Check for pre-existence. - DIE *&Slot = Unit->getDieMapSlotFor(GV); + DIE *&Slot = MainCU->getDieMapSlotFor(GV); if (Slot) return; @@ -1291,17 +1253,17 @@ // class type. return; - DIE *SubprogramDie = CreateSubprogramDIE(Unit, SP); + DIE *SubprogramDie = CreateSubprogramDIE(MainCU, SP); // Add to map. Slot = SubprogramDie; // Add to context owner. - Unit->getDie()->AddChild(SubprogramDie); + MainCU->getDie()->AddChild(SubprogramDie); // Expose as global. std::string Name; - Unit->AddGlobal(SP.getName(Name), SubprogramDie); + MainCU->AddGlobal(SP.getName(Name), SubprogramDie); return; } @@ -1331,6 +1293,11 @@ return; } + // If main compile unit for this module is not seen than randomly + // select first compile unit. + if (!MainCU) + MainCU = CompileUnits[0]; + // If there is not any debug info available for any global variables and any // subprograms then there is not any debug info to emit. if (GVs.empty() && SPs.empty()) { @@ -1707,9 +1674,6 @@ if (TimePassesIsEnabled) DebugTimer->startTimer(); - CompileUnit *Unit = MainCU; - if (!Unit) - Unit = &FindCompileUnit(SP.getCompileUnit()); GlobalVariable *GV = SP.getGV(); DenseMap::iterator II = AbstractInstanceRootMap.find(GV); @@ -1720,9 +1684,9 @@ DbgScope *Scope = new DbgScope(NULL, DIDescriptor(GV)); // Get the compile unit context. - DIE *SPDie = Unit->getDieMapSlotFor(GV); + DIE *SPDie = MainCU->getDieMapSlotFor(GV); if (!SPDie) - SPDie = CreateSubprogramDIE(Unit, SP, false, true); + SPDie = CreateSubprogramDIE(MainCU, SP, false, true); // Mark as being inlined. This makes this subprogram entry an abstract // instance root. @@ -1741,12 +1705,12 @@ // Create a concrete inlined instance for this inlined function. DbgConcreteScope *ConcreteScope = new DbgConcreteScope(DIDescriptor(GV)); DIE *ScopeDie = new DIE(dwarf::DW_TAG_inlined_subroutine); - ScopeDie->setAbstractCompileUnit(Unit); + ScopeDie->setAbstractCompileUnit(MainCU); - DIE *Origin = Unit->getDieMapSlotFor(GV); + DIE *Origin = MainCU->getDieMapSlotFor(GV); AddDIEEntry(ScopeDie, dwarf::DW_AT_abstract_origin, dwarf::DW_FORM_ref4, Origin); - AddUInt(ScopeDie, dwarf::DW_AT_call_file, 0, Unit->getID()); + AddUInt(ScopeDie, dwarf::DW_AT_call_file, 0, MainCU->getID()); AddUInt(ScopeDie, dwarf::DW_AT_call_line, 0, Line); AddUInt(ScopeDie, dwarf::DW_AT_call_column, 0, Col); @@ -1907,22 +1871,8 @@ sizeof(int32_t) + // Offset Into Abbrev. Section sizeof(int8_t); // Pointer Size (in bytes) - // Process base compile unit. - if (MainCU) { - SizeAndOffsetDie(MainCU->getDie(), Offset, true); - CompileUnitOffsets[MainCU] = 0; - return; - } - - // Process all compile units. - unsigned PrevOffset = 0; - - for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) { - CompileUnit *Unit = CompileUnits[i]; - CompileUnitOffsets[Unit] = PrevOffset; - PrevOffset += SizeAndOffsetDie(Unit->getDie(), Offset, true) - + sizeof(int32_t); // FIXME - extra pad for gdb bug. - } + SizeAndOffsetDie(MainCU->getDie(), Offset, true); + CompileUnitOffsets[MainCU] = 0; } /// EmitInitial - Emit initial Dwarf declarations. This is necessary for cc @@ -2067,13 +2017,7 @@ // Start debug info section. Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); - if (MainCU) { - EmitDebugInfoPerCU(MainCU); - return; - } - - for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) - EmitDebugInfoPerCU(CompileUnits[i]); + EmitDebugInfoPerCU(MainCU); } /// EmitAbbreviations - Emit the abbreviation section. @@ -2405,13 +2349,7 @@ // Start the dwarf pubnames section. Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); - if (MainCU) { - EmitDebugPubNamesPerCU(MainCU); - return; - } - - for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) - EmitDebugPubNamesPerCU(CompileUnits[i]); + EmitDebugPubNamesPerCU(MainCU); } /// EmitDebugStr - Emit visible names into a debug str section. From daniel at zuster.org Mon Jun 29 15:40:36 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 20:40:36 -0000 Subject: [llvm-commits] [llvm] r74450 - in /llvm/trunk/tools/llvm-mc: AsmExpr.cpp AsmExpr.h Message-ID: <200906292040.n5TKeaI9030880@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 15:40:36 2009 New Revision: 74450 URL: http://llvm.org/viewvc/llvm-project?rev=74450&view=rev Log: MC: Improve expression parsing and implement evaluation of absolute expressions (missed files). Added: llvm/trunk/tools/llvm-mc/AsmExpr.cpp llvm/trunk/tools/llvm-mc/AsmExpr.h Added: llvm/trunk/tools/llvm-mc/AsmExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=74450&view=auto ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (added) +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Mon Jun 29 15:40:36 2009 @@ -0,0 +1,92 @@ +//===- AsmExpr.cpp - Assembly file expressions ----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "AsmExpr.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCValue.h" +using namespace llvm; + +AsmExpr::~AsmExpr() { +} + +bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { + switch (getKind()) { + default: + assert(0 && "Invalid assembly expression kind!"); + + case Constant: + Res = cast(this)->getValue(); + return true; + + case SymbolRef: { + MCSymbol *Sym = cast(this)->getSymbol(); + const MCValue *Value = Ctx.GetSymbolValue(Sym); + + // FIXME: Return more information about the failure. + if (!Value || !Value->isConstant()) + return false; + + Res = Value->getConstant(); + return true; + } + + case Unary: { + const AsmUnaryExpr *AUE = cast(this); + int64_t Value; + + if (!AUE->getSubExpr()->EvaluateAsAbsolute(Ctx, Value)) + return false; + + switch (AUE->getOpcode()) { + case AsmUnaryExpr::LNot: Res = !Value; break; + case AsmUnaryExpr::Minus: Res = -Value; break; + case AsmUnaryExpr::Not: Res = ~Value; break; + case AsmUnaryExpr::Plus: Res = +Value; break; + } + + return true; + } + + case Binary: { + const AsmBinaryExpr *ABE = cast(this); + int64_t LHS, RHS; + + if (!ABE->getLHS()->EvaluateAsAbsolute(Ctx, LHS) || + !ABE->getRHS()->EvaluateAsAbsolute(Ctx, RHS)) + return false; + + // FIXME: We need target hooks for the evaluation. It may be limited in + // width, and gas defines the result of comparisons differently from Apple + // as (the result is sign extended). + switch (ABE->getOpcode()) { + case AsmBinaryExpr::Add: Res = LHS + RHS; break; + case AsmBinaryExpr::And: Res = LHS & RHS; break; + case AsmBinaryExpr::Div: Res = LHS / RHS; break; + case AsmBinaryExpr::EQ: Res = LHS == RHS; break; + case AsmBinaryExpr::GT: Res = LHS > RHS; break; + case AsmBinaryExpr::GTE: Res = LHS >= RHS; break; + case AsmBinaryExpr::LAnd: Res = LHS && RHS; break; + case AsmBinaryExpr::LOr: Res = LHS || RHS; break; + case AsmBinaryExpr::LT: Res = LHS < RHS; break; + case AsmBinaryExpr::LTE: Res = LHS <= RHS; break; + case AsmBinaryExpr::Mod: Res = LHS % RHS; break; + case AsmBinaryExpr::Mul: Res = LHS * RHS; break; + case AsmBinaryExpr::NE: Res = LHS != RHS; break; + case AsmBinaryExpr::Or: Res = LHS | RHS; break; + case AsmBinaryExpr::Shl: Res = LHS << RHS; break; + case AsmBinaryExpr::Shr: Res = LHS >> RHS; break; + case AsmBinaryExpr::Sub: Res = LHS - RHS; break; + case AsmBinaryExpr::Xor: Res = LHS ^ RHS; break; + } + + return true; + } + } +} + Added: llvm/trunk/tools/llvm-mc/AsmExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.h?rev=74450&view=auto ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.h (added) +++ llvm/trunk/tools/llvm-mc/AsmExpr.h Mon Jun 29 15:40:36 2009 @@ -0,0 +1,157 @@ +//===- AsmExpr.h - Assembly file expressions --------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef ASMEXPR_H +#define ASMEXPR_H + +#include "llvm/Support/Casting.h" +#include "llvm/Support/DataTypes.h" + +namespace llvm { +class MCContext; +class MCSymbol; + +class AsmExpr { +public: + enum AsmExprKind { + Binary, /// Binary expressions. + Constant, /// Constant expressions. + SymbolRef, /// References to labels and assigned expressions. + Unary /// Unary expressions. + }; + +private: + AsmExprKind Kind; + +protected: + AsmExpr(AsmExprKind _Kind) : Kind(_Kind) {} + +public: + virtual ~AsmExpr(); + + AsmExprKind getKind() const { return Kind; } + + /// EvaluateAsAbsolute - Try to evaluate the expression to an absolute value. + /// + /// @param Res - The absolute value if evaluation succeeds. + /// @result - True on success. + bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; + + static bool classof(const AsmExpr *) { return true; } +}; + +class AsmConstantExpr : public AsmExpr { + int64_t Value; + +public: + AsmConstantExpr(int64_t _Value) + : AsmExpr(AsmExpr::Constant), Value(_Value) {} + + int64_t getValue() const { return Value; } + + static bool classof(const AsmExpr *E) { + return E->getKind() == AsmExpr::Constant; + } + static bool classof(const AsmConstantExpr *) { return true; } +}; + +class AsmSymbolRefExpr : public AsmExpr { + MCSymbol *Symbol; + +public: + AsmSymbolRefExpr(MCSymbol *_Symbol) + : AsmExpr(AsmExpr::SymbolRef), Symbol(_Symbol) {} + + MCSymbol *getSymbol() const { return Symbol; } + + static bool classof(const AsmExpr *E) { + return E->getKind() == AsmExpr::SymbolRef; + } + static bool classof(const AsmSymbolRefExpr *) { return true; } +}; + +class AsmUnaryExpr : public AsmExpr { +public: + enum Opcode { + LNot, /// Logical negation. + Minus, /// Unary minus. + Not, /// Bit-wise negation. + Plus /// Unary plus. + }; + +private: + Opcode Op; + AsmExpr *Expr; + +public: + AsmUnaryExpr(Opcode _Op, AsmExpr *_Expr) + : AsmExpr(AsmExpr::Unary), Op(_Op), Expr(_Expr) {} + ~AsmUnaryExpr() { + delete Expr; + } + + Opcode getOpcode() const { return Op; } + + AsmExpr *getSubExpr() const { return Expr; } + + static bool classof(const AsmExpr *E) { + return E->getKind() == AsmExpr::Unary; + } + static bool classof(const AsmUnaryExpr *) { return true; } +}; + +class AsmBinaryExpr : public AsmExpr { +public: + enum Opcode { + Add, /// Addition. + And, /// Bitwise and. + Div, /// Division. + EQ, /// Equality comparison. + GT, /// Greater than comparison. + GTE, /// Greater than or equal comparison. + LAnd, /// Logical and. + LOr, /// Logical or. + LT, /// Less than comparison. + LTE, /// Less than or equal comparison. + Mod, /// Modulus. + Mul, /// Multiplication. + NE, /// Inequality comparison. + Or, /// Bitwise or. + Shl, /// Bitwise shift left. + Shr, /// Bitwise shift right. + Sub, /// Subtraction. + Xor /// Bitwise exclusive or. + }; + +private: + Opcode Op; + AsmExpr *LHS, *RHS; + +public: + AsmBinaryExpr(Opcode _Op, AsmExpr *_LHS, AsmExpr *_RHS) + : AsmExpr(AsmExpr::Binary), Op(_Op), LHS(_LHS), RHS(_RHS) {} + ~AsmBinaryExpr() { + delete LHS; + delete RHS; + } + + Opcode getOpcode() const { return Op; } + + AsmExpr *getLHS() const { return LHS; } + AsmExpr *getRHS() const { return RHS; } + + static bool classof(const AsmExpr *E) { + return E->getKind() == AsmExpr::Binary; + } + static bool classof(const AsmBinaryExpr *) { return true; } +}; + +} // end namespace llvm + +#endif From daniel at zuster.org Mon Jun 29 15:41:28 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 20:41:28 -0000 Subject: [llvm-commits] [llvm] r74451 - in /llvm/trunk: test/Analysis/LoopDependenceAnalysis/ unittests/ExecutionEngine/JIT/ Message-ID: <200906292041.n5TKfSrB030916@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 15:41:28 2009 New Revision: 74451 URL: http://llvm.org/viewvc/llvm-project?rev=74451&view=rev Log: Set some svn:ignore props Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/ (props changed) llvm/trunk/unittests/ExecutionEngine/JIT/ (props changed) Propchange: llvm/trunk/test/Analysis/LoopDependenceAnalysis/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Jun 29 15:41:28 2009 @@ -0,0 +1 @@ +Output Propchange: llvm/trunk/unittests/ExecutionEngine/JIT/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Jun 29 15:41:28 2009 @@ -0,0 +1 @@ +Debug From dpatel at apple.com Mon Jun 29 15:45:23 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Jun 2009 20:45:23 -0000 Subject: [llvm-commits] [llvm] r74452 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfDebug.cpp DwarfDebug.h Message-ID: <200906292045.n5TKjN8C031026@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jun 29 15:45:18 2009 New Revision: 74452 URL: http://llvm.org/viewvc/llvm-project?rev=74452&view=rev Log: s/MainCU/ModuleCU/g Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=74452&r1=74451&r2=74452&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Jun 29 15:45:18 2009 @@ -221,7 +221,7 @@ } // end llvm namespace DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) - : Dwarf(OS, A, T, "dbg"), MainCU(0), + : Dwarf(OS, A, T, "dbg"), ModuleCU(0), AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(), ValuesSet(InitValuesSetSize), Values(), StringPool(), SectionMap(), SectionSourceLines(), didInitial(false), shouldEmit(false), @@ -1094,7 +1094,7 @@ DISubprogram SPD(Desc.getGV()); // Get the subprogram die. - DIE *SPDie = MainCU->getDieMapSlotFor(SPD.getGV()); + DIE *SPDie = ModuleCU->getDieMapSlotFor(SPD.getGV()); assert(SPDie && "Missing subprogram descriptor"); if (!AbstractScope) { @@ -1107,14 +1107,14 @@ AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); } - ConstructDbgScope(RootScope, 0, 0, SPDie, MainCU); + ConstructDbgScope(RootScope, 0, 0, SPDie, ModuleCU); } /// ConstructDefaultDbgScope - Construct a default scope for the subprogram. /// void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) { const char *FnName = MF->getFunction()->getNameStart(); - StringMap &Globals = MainCU->getGlobals(); + StringMap &Globals = ModuleCU->getGlobals(); StringMap::iterator GI = Globals.find(FnName); if (GI != Globals.end()) { DIE *SPDie = GI->second; @@ -1200,10 +1200,10 @@ dwarf::DW_FORM_data1, RVer); CompileUnit *Unit = new CompileUnit(ID, Die); - if (!MainCU && DIUnit.isMain()) { + if (!ModuleCU && DIUnit.isMain()) { // Use first compile unit marked as isMain as the compile unit // for this module. - MainCU = Unit; + ModuleCU = Unit; } CompileUnitMap[DIUnit.getGV()] = Unit; @@ -1214,11 +1214,11 @@ DIGlobalVariable DI_GV(GV); // Check for pre-existence. - DIE *&Slot = MainCU->getDieMapSlotFor(DI_GV.getGV()); + DIE *&Slot = ModuleCU->getDieMapSlotFor(DI_GV.getGV()); if (Slot) return; - DIE *VariableDie = CreateGlobalVariableDIE(MainCU, DI_GV); + DIE *VariableDie = CreateGlobalVariableDIE(ModuleCU, DI_GV); // Add address. DIEBlock *Block = new DIEBlock(); @@ -1232,11 +1232,11 @@ Slot = VariableDie; // Add to context owner. - MainCU->getDie()->AddChild(VariableDie); + ModuleCU->getDie()->AddChild(VariableDie); // Expose as global. FIXME - need to check external flag. std::string Name; - MainCU->AddGlobal(DI_GV.getName(Name), VariableDie); + ModuleCU->AddGlobal(DI_GV.getName(Name), VariableDie); return; } @@ -1244,7 +1244,7 @@ DISubprogram SP(GV); // Check for pre-existence. - DIE *&Slot = MainCU->getDieMapSlotFor(GV); + DIE *&Slot = ModuleCU->getDieMapSlotFor(GV); if (Slot) return; @@ -1253,17 +1253,17 @@ // class type. return; - DIE *SubprogramDie = CreateSubprogramDIE(MainCU, SP); + DIE *SubprogramDie = CreateSubprogramDIE(ModuleCU, SP); // Add to map. Slot = SubprogramDie; // Add to context owner. - MainCU->getDie()->AddChild(SubprogramDie); + ModuleCU->getDie()->AddChild(SubprogramDie); // Expose as global. std::string Name; - MainCU->AddGlobal(SP.getName(Name), SubprogramDie); + ModuleCU->AddGlobal(SP.getName(Name), SubprogramDie); return; } @@ -1295,8 +1295,8 @@ // If main compile unit for this module is not seen than randomly // select first compile unit. - if (!MainCU) - MainCU = CompileUnits[0]; + if (!ModuleCU) + ModuleCU = CompileUnits[0]; // If there is not any debug info available for any global variables and any // subprograms then there is not any debug info to emit. @@ -1684,9 +1684,9 @@ DbgScope *Scope = new DbgScope(NULL, DIDescriptor(GV)); // Get the compile unit context. - DIE *SPDie = MainCU->getDieMapSlotFor(GV); + DIE *SPDie = ModuleCU->getDieMapSlotFor(GV); if (!SPDie) - SPDie = CreateSubprogramDIE(MainCU, SP, false, true); + SPDie = CreateSubprogramDIE(ModuleCU, SP, false, true); // Mark as being inlined. This makes this subprogram entry an abstract // instance root. @@ -1705,12 +1705,12 @@ // Create a concrete inlined instance for this inlined function. DbgConcreteScope *ConcreteScope = new DbgConcreteScope(DIDescriptor(GV)); DIE *ScopeDie = new DIE(dwarf::DW_TAG_inlined_subroutine); - ScopeDie->setAbstractCompileUnit(MainCU); + ScopeDie->setAbstractCompileUnit(ModuleCU); - DIE *Origin = MainCU->getDieMapSlotFor(GV); + DIE *Origin = ModuleCU->getDieMapSlotFor(GV); AddDIEEntry(ScopeDie, dwarf::DW_AT_abstract_origin, dwarf::DW_FORM_ref4, Origin); - AddUInt(ScopeDie, dwarf::DW_AT_call_file, 0, MainCU->getID()); + AddUInt(ScopeDie, dwarf::DW_AT_call_file, 0, ModuleCU->getID()); AddUInt(ScopeDie, dwarf::DW_AT_call_line, 0, Line); AddUInt(ScopeDie, dwarf::DW_AT_call_column, 0, Col); @@ -1871,8 +1871,8 @@ sizeof(int32_t) + // Offset Into Abbrev. Section sizeof(int8_t); // Pointer Size (in bytes) - SizeAndOffsetDie(MainCU->getDie(), Offset, true); - CompileUnitOffsets[MainCU] = 0; + SizeAndOffsetDie(ModuleCU->getDie(), Offset, true); + CompileUnitOffsets[ModuleCU] = 0; } /// EmitInitial - Emit initial Dwarf declarations. This is necessary for cc @@ -2017,7 +2017,7 @@ // Start debug info section. Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); - EmitDebugInfoPerCU(MainCU); + EmitDebugInfoPerCU(ModuleCU); } /// EmitAbbreviations - Emit the abbreviation section. @@ -2349,7 +2349,7 @@ // Start the dwarf pubnames section. Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); - EmitDebugPubNamesPerCU(MainCU); + EmitDebugPubNamesPerCU(ModuleCU); } /// EmitDebugStr - Emit visible names into a debug str section. @@ -2459,7 +2459,7 @@ if (!TAI->doesDwarfUsesInlineInfoSection()) return; - if (!MainCU) + if (!ModuleCU) return; Asm->SwitchToDataSection(TAI->getDwarfDebugInlineSection()); @@ -2493,7 +2493,7 @@ for (SmallVector::iterator LI = Labels.begin(), LE = Labels.end(); LI != LE; ++LI) { - DIE *SP = MainCU->getDieMapSlotFor(GV); + DIE *SP = ModuleCU->getDieMapSlotFor(GV); Asm->EmitInt32(SP->getOffset()); Asm->EOL("DIE offset"); if (TD->getPointerSize() == sizeof(int32_t)) Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=74452&r1=74451&r2=74452&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Jun 29 15:45:18 2009 @@ -70,9 +70,8 @@ /// SmallVector CompileUnits; - /// MainCU - Some platform prefers one compile unit per .o file. In such - /// cases, all dies are inserted in MainCU. - CompileUnit *MainCU; + /// ModuleCU - All DIEs are inserted in ModuleCU. + CompileUnit *ModuleCU; /// AbbreviationsSet - Used to uniquely define abbreviations. /// From gohman at apple.com Mon Jun 29 15:46:00 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Jun 2009 13:46:00 -0700 Subject: [llvm-commits] [PATCH] Avoid use after free in ScalarEvolution In-Reply-To: <4A49067E.6070404@gmail.com> References: <4A16816C.7080405@gmail.com> <4AFCEFE6-6B21-4B33-998F-DACE37C5235E@apple.com> <4A369661.8050909@gmail.com> <2BDFCF40-1E6F-47E3-917D-E1148DE31CF7@apple.com> <4A374784.3030607@gmail.com> <4A476FAF.3020205@gmail.com> <4A49067E.6070404@gmail.com> Message-ID: On Jun 29, 2009, at 11:22 AM, T?r?k Edwin wrote: > On 2009-06-29 21:15, Dan Gohman wrote: > >>> + if (!wasRun) >>> >>> + return; >>> >>> + for (unsigned Index = 0; Index < getNumContainedManagers(); + >>> >> +Index) { >> >>> + FPPassManager *FPPM = getContainedManager(Index); >>> >>> + for (unsigned Index = 0; Index < FPPM->getNumContainedPasses >>> >> (); ++Index) { >> >>> + FPPM->getContainedPass(Index)->releaseMemory(); >>> >>> + } >>> >>> + } >>> >>> +} >>> >> >> >> Should this set wasRun to true after freeing all the memory? >> >> >> > > wasRun is already true, otherwise we would have returned early. > wasRun only guards against calling releaseMemory() before the first > run() call. Oops. I meant to ask if wasRun should be set to false afterwards, to indicate that all of the state has been reset. Even if not necessary for correctness, this may be a nice invariant. > > >> + // Finalize on-the-fly passes >> >> + for (std::map::iterator >> >> + I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end(); >> >> + I != E; ++I) { >> >> + FunctionPassManagerImpl *FPP = I->second; >> >> + // We don't know when is the last time an on-the-fly pass is >> run, >> >> + // so we need to releaseMemory / finalize here >> >> + FPP->releaseMemoryOnTheFly(); >> >> + Changed |= FPP->doFinalization(M); >> >> + } >> >> >> >> Is it correct to call releaseMemoryOnTheFly before calling >> >> doInitialization? It seems like it should be the other way >> >> around. >> >> >> > > No, you can't call it before doInitialization. > releaseMemoryOnTheFly is called before doFinalization, that looks > right > to me. > doInitialization is called above, always before releaseMemory. > There is one situation where doInitialization is called, but run() > isn't, then releaseMemoryOnTheFly then doFinalization. > But that should be OK too, since then wasRun will be false, and > releaseMemory won't be called. Oops again. Here, I meant to ask if releaseMemoryOnTheFly should be called after doFinialization. It seems that a pass' doFinalization may want to have access to the pass' state before it gets freed. Dan From devang.patel at gmail.com Mon Jun 29 15:58:27 2009 From: devang.patel at gmail.com (Devang Patel) Date: Mon, 29 Jun 2009 13:58:27 -0700 Subject: [llvm-commits] [llvm] r74439 - /llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp In-Reply-To: <200906291851.n5TIpEkE027628@zion.cs.uiuc.edu> References: <200906291851.n5TIpEkE027628@zion.cs.uiuc.edu> Message-ID: <352a1fb20906291358m5251549fn34b71f733dacbec4@mail.gmail.com> On Mon, Jun 29, 2009 at 11:51 AM, Andreas Bolka
wrote: > Author: abolka > Date: Mon Jun 29 13:51:11 2009 > New Revision: 74439 > > URL: http://llvm.org/viewvc/llvm-project?rev=74439&view=rev > Log: > Relax LDA memory instruction checks. Thanks! - Devang From edwintorok at gmail.com Mon Jun 29 16:01:23 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Tue, 30 Jun 2009 00:01:23 +0300 Subject: [llvm-commits] [PATCH] Avoid use after free in ScalarEvolution In-Reply-To: References: <4A16816C.7080405@gmail.com> <4AFCEFE6-6B21-4B33-998F-DACE37C5235E@apple.com> <4A369661.8050909@gmail.com> <2BDFCF40-1E6F-47E3-917D-E1148DE31CF7@apple.com> <4A374784.3030607@gmail.com> <4A476FAF.3020205@gmail.com> <4A49067E.6070404@gmail.com> Message-ID: <4A492BA3.6060906@gmail.com> On 2009-06-29 23:46, Dan Gohman wrote: > On Jun 29, 2009, at 11:22 AM, T?r?k Edwin wrote: > > > >> On 2009-06-29 21:15, Dan Gohman wrote: >> >> >>>> + if (!wasRun) >>>> >>>> + return; >>>> >>>> + for (unsigned Index = 0; Index < getNumContainedManagers(); + >>>> >>>> >>> +Index) { >>> >>> >>>> + FPPassManager *FPPM = getContainedManager(Index); >>>> >>>> + for (unsigned Index = 0; Index < FPPM->getNumContainedPasses >>>> >>>> >>> (); ++Index) { >>> >>> >>>> + FPPM->getContainedPass(Index)->releaseMemory(); >>>> >>>> + } >>>> >>>> + } >>>> >>>> +} >>>> >>>> >>> Should this set wasRun to true after freeing all the memory? >>> >>> >>> >>> >> wasRun is already true, otherwise we would have returned early. >> wasRun only guards against calling releaseMemory() before the first >> run() call. >> > > Oops. I meant to ask if wasRun should be set to false afterwards, > to indicate that all of the state has been reset. Even if not > necessary for correctness, this may be a nice invariant. > Makes sense, I'll set it to false. > >> >>> + // Finalize on-the-fly passes >>> >>> + for (std::map::iterator >>> >>> + I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end(); >>> >>> + I != E; ++I) { >>> >>> + FunctionPassManagerImpl *FPP = I->second; >>> >>> + // We don't know when is the last time an on-the-fly pass is >>> run, >>> >>> + // so we need to releaseMemory / finalize here >>> >>> + FPP->releaseMemoryOnTheFly(); >>> >>> + Changed |= FPP->doFinalization(M); >>> >>> + } >>> >>> >>> >>> Is it correct to call releaseMemoryOnTheFly before calling >>> >>> doInitialization? It seems like it should be the other way >>> >>> around. >>> >>> >>> >>> >> No, you can't call it before doInitialization. >> releaseMemoryOnTheFly is called before doFinalization, that looks >> right >> to me. >> doInitialization is called above, always before releaseMemory. >> There is one situation where doInitialization is called, but run() >> isn't, then releaseMemoryOnTheFly then doFinalization. >> But that should be OK too, since then wasRun will be false, and >> releaseMemory won't be called. >> > > Oops again. Here, I meant to ask if releaseMemoryOnTheFly should > be called after doFinialization. It seems that a pass' doFinalization > may want to have access to the pass' state before it gets freed. > The documentation isn't very clear on that unfortunately. What if doFinalization deletes a map that run() and releaseMemory() are using, and releaseMemory only .clear()s it? Best regards, --Edwin From edwintorok at gmail.com Mon Jun 29 16:05:12 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Mon, 29 Jun 2009 21:05:12 -0000 Subject: [llvm-commits] [llvm] r74455 - /llvm/trunk/lib/VMCore/PassManager.cpp Message-ID: <200906292105.n5TL5CAA031702@zion.cs.uiuc.edu> Author: edwin Date: Mon Jun 29 16:05:10 2009 New Revision: 74455 URL: http://llvm.org/viewvc/llvm-project?rev=74455&view=rev Log: Set wasRun to false here on Dan's suggestion. Modified: llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=74455&r1=74454&r2=74455&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Jun 29 16:05:10 2009 @@ -1305,6 +1305,7 @@ FPPM->getContainedPass(Index)->releaseMemory(); } } + wasRun = false; } // Execute all the passes managed by this top level manager. From clattner at apple.com Mon Jun 29 16:10:28 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 29 Jun 2009 14:10:28 -0700 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html pubs.js In-Reply-To: <4A49036F.7010308@gmail.com> References: <200906291643.n5TGhjxt023422@zion.cs.uiuc.edu> <4A49036F.7010308@gmail.com> Message-ID: On Jun 29, 2009, at 11:09 AM, T?r?k Edwin wrote: > On 2009-06-29 19:43, Misha Brukman wrote: >> Changes in directory llvm-www/pubs: >> >> index.html updated: 1.91 -> 1.92 >> pubs.js updated: 1.46 -> 1.47 >> --- >> Log message: >> >> Added a histogram of publications over years as a chart. >> > > Sounds cool, where can I see the histogram? > It doesn't show up in my firefox. Doesn't work for me with safari either. BTW Misha, thank you *so* much for making pubs.js, it saved me a huge amount of time adding those pubs. -Chris From daniel at zuster.org Mon Jun 29 16:12:28 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 21:12:28 -0000 Subject: [llvm-commits] [llvm] r74456 - in /llvm/trunk: lib/Makefile tools/Makefile Message-ID: <200906292112.n5TLCT7T031928@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 16:12:26 2009 New Revision: 74456 URL: http://llvm.org/viewvc/llvm-project?rev=74456&view=rev Log: Don't build LLVMC when configured with --disable-pic (it needs requires shared module support to build). Modified: llvm/trunk/lib/Makefile llvm/trunk/tools/Makefile Modified: llvm/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Makefile?rev=74456&r1=74455&r2=74456&view=diff ============================================================================== --- llvm/trunk/lib/Makefile (original) +++ llvm/trunk/lib/Makefile Mon Jun 29 16:12:26 2009 @@ -8,8 +8,16 @@ ##===----------------------------------------------------------------------===## LEVEL = .. -PARALLEL_DIRS = VMCore AsmParser Bitcode Archive Analysis Transforms CodeGen \ - Target ExecutionEngine Debugger Linker CompilerDriver MC +include $(LEVEL)/Makefile.config + +PARALLEL_DIRS := VMCore AsmParser Bitcode Archive Analysis Transforms CodeGen \ + Target ExecutionEngine Debugger Linker MC + +# Only build the CompilerDriver when PIC is enabled. + +ifeq ($(ENABLE_PIC),1) +PARALLEL_DIRS += CompilerDriver +endif include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/Makefile?rev=74456&r1=74455&r2=74456&view=diff ============================================================================== --- llvm/trunk/tools/Makefile (original) +++ llvm/trunk/tools/Makefile Mon Jun 29 16:12:26 2009 @@ -20,7 +20,7 @@ llc llvm-ranlib llvm-ar llvm-nm \ llvm-ld llvm-prof llvm-link \ lli gccas gccld llvm-extract llvm-db \ - bugpoint llvm-bcanalyzer llvm-stub llvmc \ + bugpoint llvm-bcanalyzer llvm-stub \ llvm-mc # Let users override the set of tools to build from the command line. @@ -32,7 +32,7 @@ include $(LEVEL)/Makefile.config ifeq ($(ENABLE_PIC),1) - DIRS += lto + DIRS += lto llvmc ifdef BINUTILS_INCDIR DIRS += gold endif From daniel at zuster.org Mon Jun 29 16:14:22 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 21:14:22 -0000 Subject: [llvm-commits] [llvm] r74457 - /llvm/trunk/tools/llvm-mc/AsmParser.cpp Message-ID: <200906292114.n5TLEMkD032000@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 16:14:21 2009 New Revision: 74457 URL: http://llvm.org/viewvc/llvm-project?rev=74457&view=rev Log: Fix uninitialized variable warning. Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74457&r1=74456&r2=74457&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 29 16:14:21 2009 @@ -218,7 +218,7 @@ /// Res contains the LHS of the expression on input. bool AsmParser::ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res) { while (1) { - AsmBinaryExpr::Opcode Kind; + AsmBinaryExpr::Opcode Kind = AsmBinaryExpr::Add; unsigned TokPrec = getBinOpPrecedence(Lexer.getKind(), Kind); // If the next token is lower precedence than we are allowed to eat, return From resistor at mac.com Mon Jun 29 16:24:21 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 29 Jun 2009 21:24:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74458 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906292124.n5TLONt4032305@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 29 16:24:10 2009 New Revision: 74458 URL: http://llvm.org/viewvc/llvm-project?rev=74458&view=rev Log: Correct comment. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74458&r1=74457&r2=74458&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jun 29 16:24:10 2009 @@ -4467,8 +4467,8 @@ C[1] = ConstantInt::get(Type::Int1Ty, ls); C[2] = ConstantInt::get(Type::Int1Ty, sl); C[3] = ConstantInt::get(Type::Int1Ty, ss); - // We assume like gcc appears to, that this only applies to cached memory. - C[4] = ConstantInt::get(Type::Int1Ty, true); + // Be conservatively correct. + C[4] = ConstantInt::get(Type::Int1Ty, true1); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memory_barrier), From brukman at gmail.com Mon Jun 29 16:29:16 2009 From: brukman at gmail.com (Misha Brukman) Date: Mon, 29 Jun 2009 17:29:16 -0400 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html pubs.js In-Reply-To: <4A491F73.6040200@gmail.com> References: <200906291643.n5TGhjxt023422@zion.cs.uiuc.edu> <4A49036F.7010308@gmail.com> <4A491F73.6040200@gmail.com> Message-ID: 2009/6/29 T?r?k Edwin > On 2009-06-29 22:53, Misha Brukman wrote: > > 2009/6/29 T?r?k Edwin >> > > > > On 2009-06-29 19:43, Misha Brukman wrote: > > > Changes in directory llvm-www/pubs: > > > > > > index.html updated: 1.91 -> 1.92 > > > pubs.js updated: 1.46 -> 1.47 > > > --- > > > Log message: > > > > > > Added a histogram of publications over years as a chart. > > > > > > > Sounds cool, where can I see the histogram? > > It doesn't show up in my firefox. > > > > > > http://llvm.org/pubs/ -- see top right of the page. Works for me in > > Firefox 3 on Linux. > > Firefox 3.0.11, Linux here too. > > Using chart.apis.google.com in the URL instead of google.com makes the > image appear. > I don't know why www.google.com/charts doesn't work (it does if I > copy+paste the URL in a new tab). Fixed the URL, thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090629/a2446866/attachment.html From echristo at apple.com Mon Jun 29 16:29:10 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 29 Jun 2009 14:29:10 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74458 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200906292124.n5TLONt4032305@zion.cs.uiuc.edu> References: <200906292124.n5TLONt4032305@zion.cs.uiuc.edu> Message-ID: On Jun 29, 2009, at 2:24 PM, Owen Anderson wrote: > - // We assume like gcc appears to, that this only applies to > cached memory. > - C[4] = ConstantInt::get(Type::Int1Ty, true); > + // Be conservatively correct. > + C[4] = ConstantInt::get(Type::Int1Ty, true1); typo? The only other true1 I see is in combine. -eric From gohman at apple.com Mon Jun 29 16:31:40 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Jun 2009 21:31:40 -0000 Subject: [llvm-commits] [llvm] r74459 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <200906292131.n5TLVgtg032606@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 29 16:31:18 2009 New Revision: 74459 URL: http://llvm.org/viewvc/llvm-project?rev=74459&view=rev Log: Use getSCEV instead of getUnknown to create a SCEV for a Constant. This lets ConstantInts be handled as SCEVConstant instead of SCEVUnknown, as getUnknown no longer has special-case code for ConstantInt and friends. This usually doesn't affect the final output, since the constants end up getting folded later, but it does make intermediate expressions more obvious in many cases. Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=74459&r1=74458&r2=74459&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 29 16:31:18 2009 @@ -3572,7 +3572,7 @@ Constant *RV = getConstantEvolutionLoopExitValue(PN, BTCC->getValue()->getValue(), LI); - if (RV) return getUnknown(RV); + if (RV) return getSCEV(RV); } } @@ -3586,7 +3586,7 @@ std::pair::iterator, bool> Pair = Values.insert(std::make_pair(L, static_cast(0))); if (!Pair.second) - return Pair.first->second ? &*getUnknown(Pair.first->second) : V; + return Pair.first->second ? &*getSCEV(Pair.first->second) : V; std::vector Operands; Operands.reserve(I->getNumOperands()); @@ -3635,7 +3635,7 @@ C = ConstantFoldInstOperands(I->getOpcode(), I->getType(), &Operands[0], Operands.size()); Pair.first->second = C; - return getUnknown(C); + return getSCEV(C); } } From brukman at cs.uiuc.edu Mon Jun 29 16:34:06 2009 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 29 Jun 2009 16:34:06 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/pubs.js Message-ID: <200906292134.n5TLY6B1032685@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: pubs.js updated: 1.47 -> 1.48 --- Log message: Fixed URL for Google Chart API. --- Diffs of the changes: (+1 -1) pubs.js | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/pubs/pubs.js diff -u llvm-www/pubs/pubs.js:1.47 llvm-www/pubs/pubs.js:1.48 --- llvm-www/pubs/pubs.js:1.47 Mon Jun 29 11:39:51 2009 +++ llvm-www/pubs/pubs.js Mon Jun 29 16:28:53 2009 @@ -897,7 +897,7 @@ var container = document.getElementById(id); var image = document.createElement('img'); - image.src = 'http://www.google.com/chart?cht=bvs' + // vertical bars + image.src = 'http://chart.apis.google.com/chart?cht=bvs' + // vertical bars '&chs=300x200' + // size '&chtt=Histogram' + // title '&chdl=Count' + // label in legend From isanbard at gmail.com Mon Jun 29 16:46:48 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 29 Jun 2009 21:46:48 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74461 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906292146.n5TLkmeL000679@zion.cs.uiuc.edu> Author: void Date: Mon Jun 29 16:46:47 2009 New Revision: 74461 URL: http://llvm.org/viewvc/llvm-project?rev=74461&view=rev Log: --- Reverse-merging (from foreign repository) r74458 into 'gcc/llvm-convert.cpp': U gcc/llvm-convert.cpp Temporarily revert r74458. It was causing bootstrap failures. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74461&r1=74460&r2=74461&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jun 29 16:46:47 2009 @@ -4467,8 +4467,8 @@ C[1] = ConstantInt::get(Type::Int1Ty, ls); C[2] = ConstantInt::get(Type::Int1Ty, sl); C[3] = ConstantInt::get(Type::Int1Ty, ss); - // Be conservatively correct. - C[4] = ConstantInt::get(Type::Int1Ty, true1); + // We assume like gcc appears to, that this only applies to cached memory. + C[4] = ConstantInt::get(Type::Int1Ty, true); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memory_barrier), From isanbard at gmail.com Mon Jun 29 16:47:07 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 29 Jun 2009 14:47:07 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74458 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200906292124.n5TLONt4032305@zion.cs.uiuc.edu> References: <200906292124.n5TLONt4032305@zion.cs.uiuc.edu> Message-ID: <16e5fdf90906291447o2bb4a417q1dffa37188549d2c@mail.gmail.com> Hi Owen, This isn't correct. It was causing bootstrapping failures. I reverted it for now. -bw On Mon, Jun 29, 2009 at 2:24 PM, Owen Anderson wrote: > Author: resistor > Date: Mon Jun 29 16:24:10 2009 > New Revision: 74458 > > URL: http://llvm.org/viewvc/llvm-project?rev=74458&view=rev > Log: > Correct comment. > > Modified: > ? ?llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74458&r1=74457&r2=74458&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jun 29 16:24:10 2009 > @@ -4467,8 +4467,8 @@ > ? C[1] = ConstantInt::get(Type::Int1Ty, ls); > ? C[2] = ConstantInt::get(Type::Int1Ty, sl); > ? C[3] = ConstantInt::get(Type::Int1Ty, ss); > - ?// We assume like gcc appears to, that this only applies to cached memory. > - ?C[4] = ConstantInt::get(Type::Int1Ty, true); > + ?// Be conservatively correct. > + ?C[4] = ConstantInt::get(Type::Int1Ty, true1); > > ? Builder.CreateCall(Intrinsic::getDeclaration(TheModule, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Intrinsic::memory_barrier), > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Mon Jun 29 16:58:23 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 21:58:23 -0000 Subject: [llvm-commits] [llvm] r74462 - /llvm/trunk/tools/llvm-mc/AsmLexer.cpp Message-ID: <200906292158.n5TLwNvq001270@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 16:58:22 2009 New Revision: 74462 URL: http://llvm.org/viewvc/llvm-project?rev=74462&view=rev Log: llvm-mc: Recognize C++ style comments. Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=74462&r1=74461&r2=74462&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Mon Jun 29 16:58:22 2009 @@ -109,8 +109,11 @@ /// LexSlash: Slash: / /// C-Style Comment: /* ... */ asmtok::TokKind AsmLexer::LexSlash() { - if (*CurPtr != '*') - return asmtok::Slash; + switch (*CurPtr) { + case '*': break; // C style comment. + case '/': return ++CurPtr, LexLineComment(); + default: return asmtok::Slash; + } // C Style comment. ++CurPtr; // skip the star. @@ -129,8 +132,9 @@ } } -/// LexHash: Comment: #[^\n]* -asmtok::TokKind AsmLexer::LexHash() { +/// LexLineComment: Comment: #[^\n]* +/// : //[^\n]* +asmtok::TokKind AsmLexer::LexLineComment() { int CurChar = getNextChar(); while (CurChar != '\n' && CurChar != '\n' && CurChar != EOF) CurChar = getNextChar(); @@ -281,7 +285,7 @@ return asmtok::Exclaim; case '%': return LexPercent(); case '/': return LexSlash(); - case '#': return LexHash(); + case '#': return LexLineComment(); case '"': return LexQuote(); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': From daniel at zuster.org Mon Jun 29 17:00:58 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 22:00:58 -0000 Subject: [llvm-commits] [llvm] r74463 - in /llvm/trunk: test/MC/AsmParser/exprs.s tools/llvm-mc/AsmLexer.h Message-ID: <200906292200.n5TM0wWu001366@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 17:00:57 2009 New Revision: 74463 URL: http://llvm.org/viewvc/llvm-project?rev=74463&view=rev Log: llvm-mc: Recognize C++ style comments. Modified: llvm/trunk/test/MC/AsmParser/exprs.s llvm/trunk/tools/llvm-mc/AsmLexer.h Modified: llvm/trunk/test/MC/AsmParser/exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=74463&r1=74462&r2=74463&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/exprs.s (original) +++ llvm/trunk/test/MC/AsmParser/exprs.s Mon Jun 29 17:00:57 2009 @@ -1,8 +1,8 @@ -# FIXME: For now this test just checks that llvm-mc works. Once we have .macro, -# .if, and .abort we can write a better test (without resorting to miles of -# greps). +// FIXME: For now this test just checks that llvm-mc works. Once we have .macro, +// .if, and .abort we can write a better test (without resorting to miles of +// greps). -# RUN: llvm-mc %s > %t +// RUN: llvm-mc %s > %t .byte !1 + 2 .byte !0 Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=74463&r1=74462&r2=74463&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Mon Jun 29 17:00:57 2009 @@ -108,7 +108,7 @@ asmtok::TokKind LexIdentifier(); asmtok::TokKind LexPercent(); asmtok::TokKind LexSlash(); - asmtok::TokKind LexHash(); + asmtok::TokKind LexLineComment(); asmtok::TokKind LexDigit(); asmtok::TokKind LexQuote(); }; From david_goodwin at apple.com Mon Jun 29 17:25:38 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 29 Jun 2009 22:25:38 -0000 Subject: [llvm-commits] [llvm] r74464 - in /llvm/trunk/test/CodeGen/Thumb2: thumb2-adc.ll thumb2-add2.ll thumb2-sbc2.ll thumb2-sub.ll thumb2-sub2.ll thumb2-sub4.ll thumb2-sub5.ll Message-ID: <200906292225.n5TMPf65002371@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Jun 29 17:25:22 2009 New Revision: 74464 URL: http://llvm.org/viewvc/llvm-project?rev=74464&view=rev Log: Thumb-2 tests Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sub2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-adc.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-adc.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-adc.ll?rev=74464&r1=74463&r2=74464&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-adc.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-adc.ll Mon Jun 29 17:25:22 2009 @@ -1,32 +1,32 @@ ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adc\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 -; 734439407617 = 0x000000ab00000001 +; 734439407618 = 0x000000ab00000002 define i64 @f1(i64 %a) { - %tmp = add i64 %a, 734439407617 + %tmp = add i64 %a, 734439407618 ret i64 %tmp } -; 5066626890203137 = 0x0012001200000001 +; 5066626890203138 = 0x0012001200000002 define i64 @f2(i64 %a) { - %tmp = add i64 %a, 5066626890203137 + %tmp = add i64 %a, 5066626890203138 ret i64 %tmp } -; 3747052064576897025 = 0x3400340000000001 +; 3747052064576897026 = 0x3400340000000002 define i64 @f3(i64 %a) { - %tmp = add i64 %a, 3747052064576897025 + %tmp = add i64 %a, 3747052064576897026 ret i64 %tmp } -; 6221254862626095105 = 0x5656565600000001 +; 6221254862626095106 = 0x5656565600000002 define i64 @f4(i64 %a) { - %tmp = add i64 %a, 6221254862626095105 + %tmp = add i64 %a, 6221254862626095106 ret i64 %tmp } -; 287104476244869121 = 0x03fc000000000001 +; 287104476244869122 = 0x03fc000000000002 define i64 @f5(i64 %a) { - %tmp = add i64 %a, 287104476244869121 + %tmp = add i64 %a, 287104476244869122 ret i64 %tmp } Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll?rev=74464&r1=74463&r2=74464&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll Mon Jun 29 17:25:22 2009 @@ -29,8 +29,3 @@ %tmp = add i32 %a, 510 ret i32 %tmp } - -define i32 @f6(i32 %a) { - %tmp = add i32 %a, 4095 - ret i32 %tmp -} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll?rev=74464&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll Mon Jun 29 17:25:22 2009 @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sbc\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]*} | count 1 + +define i64 @f1(i64 %a, i64 %b) { + %tmp = sub i64 %a, %b + ret i64 %tmp +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll?rev=74464&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll Mon Jun 29 17:25:22 2009 @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\[w\]\\?\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#510} | count 5 + +; 171 = 0x000000ab +define i32 @f1(i32 %a) { + %tmp = sub i32 %a, 171 + ret i32 %tmp +} + +; 1179666 = 0x00120012 +define i32 @f2(i32 %a) { + %tmp = sub i32 %a, 1179666 + ret i32 %tmp +} + +; 872428544 = 0x34003400 +define i32 @f3(i32 %a) { + %tmp = sub i32 %a, 872428544 + ret i32 %tmp +} + +; 1448498774 = 0x56565656 +define i32 @f4(i32 %a) { + %tmp = sub i32 %a, 1448498774 + ret i32 %tmp +} + +; 510 = 0x000001fe +define i32 @f5(i32 %a) { + %tmp = sub i32 %a, 510 + ret i32 %tmp +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-sub2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sub2.ll?rev=74464&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sub2.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sub2.ll Mon Jun 29 17:25:22 2009 @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {subw\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#4095} | count 1 + +define i32 @f1(i32 %a) { + %tmp = sub i32 %a, 4095 + ret i32 %tmp +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll?rev=74464&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll Mon Jun 29 17:25:22 2009 @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 + +define i32 @f1(i32 %a, i32 %b) { + %tmp = sub i32 %a, %b + ret i32 %tmp +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll?rev=74464&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll Mon Jun 29 17:25:22 2009 @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {subs\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 + +define i64 @f1(i64 %a, i64 %b) { + %tmp = sub i64 %a, %b + ret i64 %tmp +} From jyasskin at google.com Mon Jun 29 17:32:04 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Mon, 29 Jun 2009 15:32:04 -0700 Subject: [llvm-commits] Initial OProfile symbolization support Message-ID: OProfile provides a library to tell it about JIT output, described at http://oprofile.sourceforge.net/doc/devel/jit-interface.html. This patch tells OProfile about function ranges, but not line numbers. It adds a --with-oprofile= flag to configure, but I don't know how to do the equivalent to cmake. Problems: 1. Because oprofile installs its libraries to /lib/oprofile, we need an -rpath option to let the loader find them. We could probably link the oprofile library statically to avoid this (but how?). 2. llvm-config doesn't include the required -L and -rpath flags in its --ldflags output, even though it includes -lopagent. 3. cmake support is missing, as mentioned above. I've tested this by running the attached fib.c under lli. Let me know if you can think of an automated way to test it. The output from opreport follows: Before: $ opreport -l ~/opensource/llvm/trunk/dbg/Debug/bin/lli CPU: Core 2, speed 1998 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000 samples % image name symbol name 48182 98.9729 anon (tgid:19412 range:0x7f12ccaab000-0x7f12cdaab000) anon (tgid:19412 range:0x7f12ccaab000-0x7f12cdaab000) 11 0.0226 libstdc++.so.6.0.9 /usr/lib/libstdc++.so.6.0.9 10 0.0205 lli llvm::MachineOperand::isReg() const ... After: $ opreport -l ~/opensource/llvm/oprof/dbg/Debug/bin/lli CPU: Core 2, speed 1998 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000 samples % image name symbol name 24565 60.7308 19814.jo fib_left 15365 37.9861 19814.jo fib_right 22 0.0544 ld-2.7.so do_lookup_x 10 0.0247 lli llvm::MachineOperand::isReg() const 8 0.0198 ld-2.7.so _dl_relocate_object 8 0.0198 lli std::vector >::size() const ... -------------- next part -------------- A non-text attachment was scrubbed... Name: oprofile.patch Type: text/x-patch Size: 7684 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090629/15c69b27/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: fib.c Type: text/x-csrc Size: 1013 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090629/15c69b27/attachment-0001.bin From clattner at apple.com Mon Jun 29 17:36:40 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 29 Jun 2009 15:36:40 -0700 Subject: [llvm-commits] CVS: llvm-www/pubs/pubs.js In-Reply-To: <200906292134.n5TLY6B1032685@zion.cs.uiuc.edu> References: <200906292134.n5TLY6B1032685@zion.cs.uiuc.edu> Message-ID: <9BD5D29B-311C-405B-B4AB-E30B1011F54A@apple.com> On Jun 29, 2009, at 2:34 PM, Misha Brukman wrote: > > > Changes in directory llvm-www/pubs: > > pubs.js updated: 1.47 -> 1.48 > --- > Log message: > > Fixed URL for Google Chart API. Nice, works great now. -Chris > > > > --- > Diffs of the changes: (+1 -1) > > pubs.js | 2 +- > 1 files changed, 1 insertion(+), 1 deletion(-) > > > Index: llvm-www/pubs/pubs.js > diff -u llvm-www/pubs/pubs.js:1.47 llvm-www/pubs/pubs.js:1.48 > --- llvm-www/pubs/pubs.js:1.47 Mon Jun 29 11:39:51 2009 > +++ llvm-www/pubs/pubs.js Mon Jun 29 16:28:53 2009 > @@ -897,7 +897,7 @@ > > var container = document.getElementById(id); > var image = document.createElement('img'); > - image.src = 'http://www.google.com/chart?cht=bvs' + // vertical > bars > + image.src = 'http://chart.apis.google.com/chart?cht=bvs' + // > vertical bars > '&chs=300x200' + // size > '&chtt=Histogram' + // title > '&chdl=Count' + // label in > legend > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From david_goodwin at apple.com Mon Jun 29 17:49:43 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 29 Jun 2009 22:49:43 -0000 Subject: [llvm-commits] [llvm] r74468 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-teq.ll test/CodeGen/Thumb2/thumb2-teq2.ll test/CodeGen/Thumb2/thumb2-tst.ll test/CodeGen/Thumb2/thumb2-tst2.ll Message-ID: <200906292249.n5TMni1Q003345@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Jun 29 17:49:42 2009 New Revision: 74468 URL: http://llvm.org/viewvc/llvm-project?rev=74468&view=rev Log: Add Thumb-2 support for TEQ amd TST. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74468&r1=74467&r2=74468&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Jun 29 17:49:42 2009 @@ -621,7 +621,10 @@ def : T2Pat<(ARMcmpZ GPR:$src, t2_so_imm_neg:$imm), (t2CMNri GPR:$src, t2_so_imm_neg:$imm)>; -// FIXME: TST, TEQ, etc. +defm t2TST : T2I_cmp_is<"tst", + BinOpFrag<(ARMcmpZ (and node:$LHS, node:$RHS), 0)>>; +defm t2TEQ : T2I_cmp_is<"teq", + BinOpFrag<(ARMcmpZ (xor node:$LHS, node:$RHS), 0)>>; // A8.6.27 CBNZ, CBZ - Compare and branch on (non)zero. // Short range conditional branch. Looks awesome for loops. Need to figure Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll?rev=74468&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll Mon Jun 29 17:49:42 2009 @@ -0,0 +1,71 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 10 + +; 0x000000bb = 187 +define i1 @f1(i32 %a) { + %tmp = xor i32 %a, 187 + %tmp1 = icmp ne i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0x000000bb = 187 +define i1 @f2(i32 %a) { + %tmp = xor i32 %a, 187 + %tmp1 = icmp eq i32 0, %tmp + ret i1 %tmp1 +} + +; 0x00aa00aa = 11141290 +define i1 @f3(i32 %a) { + %tmp = xor i32 %a, 11141290 + %tmp1 = icmp eq i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0x00aa00aa = 11141290 +define i1 @f4(i32 %a) { + %tmp = xor i32 %a, 11141290 + %tmp1 = icmp ne i32 0, %tmp + ret i1 %tmp1 +} + +; 0xcc00cc00 = 3422604288 +define i1 @f5(i32 %a) { + %tmp = xor i32 %a, 3422604288 + %tmp1 = icmp ne i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0xcc00cc00 = 3422604288 +define i1 @f6(i32 %a) { + %tmp = xor i32 %a, 3422604288 + %tmp1 = icmp eq i32 0, %tmp + ret i1 %tmp1 +} + +; 0xdddddddd = 3722304989 +define i1 @f7(i32 %a) { + %tmp = xor i32 %a, 3722304989 + %tmp1 = icmp eq i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0xdddddddd = 3722304989 +define i1 @f8(i32 %a) { + %tmp = xor i32 %a, 3722304989 + %tmp1 = icmp ne i32 0, %tmp + ret i1 %tmp1 +} + +; 0x00110000 = 1114112 +define i1 @f9(i32 %a) { + %tmp = xor i32 %a, 1114112 + %tmp1 = icmp ne i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0x00110000 = 1114112 +define i1 @f10(i32 %a) { + %tmp = xor i32 %a, 1114112 + %tmp1 = icmp eq i32 0, %tmp + ret i1 %tmp1 +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll?rev=74468&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll Mon Jun 29 17:49:42 2009 @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\]} | count 4 + +define i1 @f1(i32 %a, i32 %b) { + %tmp = xor i32 %a, %b + %tmp1 = icmp ne i32 %tmp, 0 + ret i1 %tmp1 +} + +define i1 @f2(i32 %a, i32 %b) { + %tmp = xor i32 %a, %b + %tmp1 = icmp eq i32 %tmp, 0 + ret i1 %tmp1 +} + +define i1 @f3(i32 %a, i32 %b) { + %tmp = xor i32 %a, %b + %tmp1 = icmp ne i32 0, %tmp + ret i1 %tmp1 +} + +define i1 @f4(i32 %a, i32 %b) { + %tmp = xor i32 %a, %b + %tmp1 = icmp eq i32 0, %tmp + ret i1 %tmp1 +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll?rev=74468&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll Mon Jun 29 17:49:42 2009 @@ -0,0 +1,71 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 10 + +; 0x000000bb = 187 +define i1 @f1(i32 %a) { + %tmp = and i32 %a, 187 + %tmp1 = icmp ne i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0x000000bb = 187 +define i1 @f2(i32 %a) { + %tmp = and i32 %a, 187 + %tmp1 = icmp eq i32 0, %tmp + ret i1 %tmp1 +} + +; 0x00aa00aa = 11141290 +define i1 @f3(i32 %a) { + %tmp = and i32 %a, 11141290 + %tmp1 = icmp eq i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0x00aa00aa = 11141290 +define i1 @f4(i32 %a) { + %tmp = and i32 %a, 11141290 + %tmp1 = icmp ne i32 0, %tmp + ret i1 %tmp1 +} + +; 0xcc00cc00 = 3422604288 +define i1 @f5(i32 %a) { + %tmp = and i32 %a, 3422604288 + %tmp1 = icmp ne i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0xcc00cc00 = 3422604288 +define i1 @f6(i32 %a) { + %tmp = and i32 %a, 3422604288 + %tmp1 = icmp eq i32 0, %tmp + ret i1 %tmp1 +} + +; 0xdddddddd = 3722304989 +define i1 @f7(i32 %a) { + %tmp = and i32 %a, 3722304989 + %tmp1 = icmp eq i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0xdddddddd = 3722304989 +define i1 @f8(i32 %a) { + %tmp = and i32 %a, 3722304989 + %tmp1 = icmp ne i32 0, %tmp + ret i1 %tmp1 +} + +; 0x00110000 = 1114112 +define i1 @f9(i32 %a) { + %tmp = and i32 %a, 1114112 + %tmp1 = icmp ne i32 %tmp, 0 + ret i1 %tmp1 +} + +; 0x00110000 = 1114112 +define i1 @f10(i32 %a) { + %tmp = and i32 %a, 1114112 + %tmp1 = icmp eq i32 0, %tmp + ret i1 %tmp1 +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll?rev=74468&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll Mon Jun 29 17:49:42 2009 @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\]} | count 4 + +define i1 @f1(i32 %a, i32 %b) { + %tmp = and i32 %a, %b + %tmp1 = icmp ne i32 %tmp, 0 + ret i1 %tmp1 +} + +define i1 @f2(i32 %a, i32 %b) { + %tmp = and i32 %a, %b + %tmp1 = icmp eq i32 %tmp, 0 + ret i1 %tmp1 +} + +define i1 @f3(i32 %a, i32 %b) { + %tmp = and i32 %a, %b + %tmp1 = icmp ne i32 0, %tmp + ret i1 %tmp1 +} + +define i1 @f4(i32 %a, i32 %b) { + %tmp = and i32 %a, %b + %tmp1 = icmp eq i32 0, %tmp + ret i1 %tmp1 +} From greened at obbligato.org Mon Jun 29 17:50:51 2009 From: greened at obbligato.org (David Greene) Date: Mon, 29 Jun 2009 22:50:51 -0000 Subject: [llvm-commits] [llvm] r74469 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86RegisterInfo.td Message-ID: <200906292250.n5TMoqgx003421@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 29 17:50:51 2009 New Revision: 74469 URL: http://llvm.org/viewvc/llvm-project?rev=74469&view=rev Log: Add a 256-bit register class and YMM registers. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.td Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74469&r1=74468&r2=74469&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 29 17:50:51 2009 @@ -785,6 +785,11 @@ } if (!UseSoftFloat && Subtarget->hasAVX()) { + addRegisterClass(MVT::v8f32, X86::VR256RegisterClass); + addRegisterClass(MVT::v4f64, X86::VR256RegisterClass); + addRegisterClass(MVT::v8i32, X86::VR256RegisterClass); + addRegisterClass(MVT::v4i64, X86::VR256RegisterClass); + setOperationAction(ISD::LOAD, MVT::v8f32, Legal); setOperationAction(ISD::LOAD, MVT::v8i32, Legal); setOperationAction(ISD::LOAD, MVT::v4f64, Legal); Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=74469&r1=74468&r2=74469&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Mon Jun 29 17:50:51 2009 @@ -157,6 +157,24 @@ def XMM14: Register<"xmm14">, DwarfRegNum<[31, -2, -2]>; def XMM15: Register<"xmm15">, DwarfRegNum<[32, -2, -2]>; + // YMM Registers, used by AVX instructions + def YMM0: Register<"ymm0">, DwarfRegNum<[17, 21, 21]>; + def YMM1: Register<"ymm1">, DwarfRegNum<[18, 22, 22]>; + def YMM2: Register<"ymm2">, DwarfRegNum<[19, 23, 23]>; + def YMM3: Register<"ymm3">, DwarfRegNum<[20, 24, 24]>; + def YMM4: Register<"ymm4">, DwarfRegNum<[21, 25, 25]>; + def YMM5: Register<"ymm5">, DwarfRegNum<[22, 26, 26]>; + def YMM6: Register<"ymm6">, DwarfRegNum<[23, 27, 27]>; + def YMM7: Register<"ymm7">, DwarfRegNum<[24, 28, 28]>; + def YMM8: Register<"ymm8">, DwarfRegNum<[25, -2, -2]>; + def YMM9: Register<"ymm9">, DwarfRegNum<[26, -2, -2]>; + def YMM10: Register<"ymm10">, DwarfRegNum<[27, -2, -2]>; + def YMM11: Register<"ymm11">, DwarfRegNum<[28, -2, -2]>; + def YMM12: Register<"ymm12">, DwarfRegNum<[29, -2, -2]>; + def YMM13: Register<"ymm13">, DwarfRegNum<[30, -2, -2]>; + def YMM14: Register<"ymm14">, DwarfRegNum<[31, -2, -2]>; + def YMM15: Register<"ymm15">, DwarfRegNum<[32, -2, -2]>; + // Floating point stack registers def ST0 : Register<"st(0)">, DwarfRegNum<[33, 12, 11]>; def ST1 : Register<"st(1)">, DwarfRegNum<[34, 13, 12]>; @@ -229,6 +247,11 @@ [EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D]>; +def : SubRegSet<1, [YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7, + YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15], + [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15]>; + //===----------------------------------------------------------------------===// // Register Class Definitions... now that we have all of the pieces, define the // top-level register classes. The order specified in the register list is @@ -755,6 +778,10 @@ } }]; } +def VR256 : RegisterClass<"X86", [ v8i32, v4i64, v8f32, v4f64],256, + [YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7, + YMM8, YMM9, YMM10, YMM11, + YMM12, YMM13, YMM14, YMM15]>; // Status flags registers. def CCR : RegisterClass<"X86", [i32], 32, [EFLAGS]> { From clattner at apple.com Mon Jun 29 17:51:22 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 29 Jun 2009 15:51:22 -0700 Subject: [llvm-commits] [llvm] r74444 - in /llvm/trunk: docs/TableGenFundamentals.html utils/TableGen/Record.cpp utils/TableGen/Record.h In-Reply-To: <200906292005.n5TK5gGn029811@zion.cs.uiuc.edu> References: <200906292005.n5TK5gGn029811@zion.cs.uiuc.edu> Message-ID: <71487B9A-572B-4D88-BDFB-64A77A404D5A@apple.com> On Jun 29, 2009, at 1:05 PM, David Greene wrote: > Author: greened > Date: Mon Jun 29 15:05:29 2009 > New Revision: 74444 > Implement !cast. Hi David, > + > +// VarInit *LHSv = dynamic_cast(LHS); > +// if (LHSv) { > +// // If this is not a template arg, cast it > +// if (!CurRec->isTemplateArg(LHSv->getName()) > +// && !CurMultiClass) { > +// return new StringInit(LHSv->getName()); > +// } > +// break; > +// } > + > +// OpInit *LHSo = dynamic_cast(LHS); > +// if (!LHSo) { > +// return new StringInit(LHS->getAsString()); > +// } > + } Please remove the commented-out code, thanks! -Chris From resistor at mac.com Mon Jun 29 17:55:07 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 29 Jun 2009 22:55:07 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74470 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906292255.n5TMt7DE003699@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 29 17:55:07 2009 New Revision: 74470 URL: http://llvm.org/viewvc/llvm-project?rev=74470&view=rev Log: Correct comment, without the typo this time. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74470&r1=74469&r2=74470&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jun 29 17:55:07 2009 @@ -4467,7 +4467,7 @@ C[1] = ConstantInt::get(Type::Int1Ty, ls); C[2] = ConstantInt::get(Type::Int1Ty, sl); C[3] = ConstantInt::get(Type::Int1Ty, ss); - // We assume like gcc appears to, that this only applies to cached memory. + // Be conservatively safe. C[4] = ConstantInt::get(Type::Int1Ty, true); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, From greened at obbligato.org Mon Jun 29 17:55:53 2009 From: greened at obbligato.org (David Greene) Date: Mon, 29 Jun 2009 22:55:53 -0000 Subject: [llvm-commits] [llvm] r74471 - /llvm/trunk/utils/TableGen/Record.cpp Message-ID: <200906292255.n5TMtrsV003734@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 29 17:55:52 2009 New Revision: 74471 URL: http://llvm.org/viewvc/llvm-project?rev=74471&view=rev Log: Remove commented code. Modified: llvm/trunk/utils/TableGen/Record.cpp Modified: llvm/trunk/utils/TableGen/Record.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=74471&r1=74470&r2=74471&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.cpp (original) +++ llvm/trunk/utils/TableGen/Record.cpp Mon Jun 29 17:55:52 2009 @@ -547,21 +547,6 @@ if (LHSd) { return new StringInit(LHSd->getDef()->getName()); } - -// VarInit *LHSv = dynamic_cast(LHS); -// if (LHSv) { -// // If this is not a template arg, cast it -// if (!CurRec->isTemplateArg(LHSv->getName()) -// && !CurMultiClass) { -// return new StringInit(LHSv->getName()); -// } -// break; -// } - -// OpInit *LHSo = dynamic_cast(LHS); -// if (!LHSo) { -// return new StringInit(LHS->getAsString()); -// } } else { StringInit *LHSs = dynamic_cast(LHS); From daniel at zuster.org Mon Jun 29 17:59:36 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 22:59:36 -0000 Subject: [llvm-commits] [llvm] r74473 - /llvm/trunk/lib/CompilerDriver/Makefile Message-ID: <200906292259.n5TMxa0s003956@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 17:59:36 2009 New Revision: 74473 URL: http://llvm.org/viewvc/llvm-project?rev=74473&view=rev Log: Fix install of libCompilerDriver dynamic library to not copy on every build. Modified: llvm/trunk/lib/CompilerDriver/Makefile Modified: llvm/trunk/lib/CompilerDriver/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Makefile?rev=74473&r1=74472&r2=74473&view=diff ============================================================================== --- llvm/trunk/lib/CompilerDriver/Makefile (original) +++ llvm/trunk/lib/CompilerDriver/Makefile Mon Jun 29 17:59:36 2009 @@ -21,11 +21,12 @@ FullLibName = $(LIBRARYNAME)$(SHLIBEXT) +all-local:: $(ToolDir)/$(FullLibName) + # Copy the library to the bin dir so that llvmc can find it. -all-local:: - $(Echo) Copying $(BuildMode) Shared Library $(FullLibName) \ - to $(ToolDir) - -$(Verb) $(CP) $(LibDir)/$(FullLibName) $(ToolDir)/ +$(ToolDir)/$(FullLibName): $(LibDir)/$(FullLibName) $(ToolDir)/.dir + $(Echo) Copying $(BuildMode) Shared Library $(FullLibName) to $@ + -$(Verb) $(CP) $< $@ clean-local:: $(Echo) Removing $(BuildMode) Shared Library $(FullLibName) \ From daniel at zuster.org Mon Jun 29 18:29:08 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 23:29:08 -0000 Subject: [llvm-commits] [llvm] r74474 - /llvm/trunk/include/llvm/Support/SourceMgr.h Message-ID: <200906292329.n5TNTA7e004881@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 18:28:55 2009 New Revision: 74474 URL: http://llvm.org/viewvc/llvm-project?rev=74474&view=rev Log: Add SMLoc::isValid method. - To support using SMLoc as a sentinel. Modified: llvm/trunk/include/llvm/Support/SourceMgr.h Modified: llvm/trunk/include/llvm/Support/SourceMgr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=74474&r1=74473&r2=74474&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/SourceMgr.h (original) +++ llvm/trunk/include/llvm/Support/SourceMgr.h Mon Jun 29 18:28:55 2009 @@ -30,6 +30,8 @@ SMLoc() : Ptr(0) {} SMLoc(const SMLoc &RHS) : Ptr(RHS.Ptr) {} + bool isValid() const { return Ptr != 0; } + bool operator==(const SMLoc &RHS) const { return RHS.Ptr == Ptr; } bool operator!=(const SMLoc &RHS) const { return RHS.Ptr != Ptr; } From foldr at codedgers.com Mon Jun 29 18:29:23 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Mon, 29 Jun 2009 23:29:23 +0000 (UTC) Subject: [llvm-commits] =?utf-8?q?=5Bllvm=5D_r74473_-=09/llvm/trunk/lib/Co?= =?utf-8?q?mpilerDriver/Makefile?= References: <200906292259.n5TMxa0s003956@zion.cs.uiuc.edu> Message-ID: Daniel Dunbar writes: > Fix install of libCompilerDriver dynamic library to not copy on every build. Thanks! From foldr at codedgers.com Mon Jun 29 18:34:35 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Mon, 29 Jun 2009 23:34:35 +0000 (UTC) Subject: [llvm-commits] =?utf-8?q?=5Bllvm=5D_r74417_-_in_/llvm/trunk=3A_Ma?= =?utf-8?q?kefile=2Erules=09include/llvm/CompilerDriver/Main=2Einc?= =?utf-8?q?=09lib/CompilerDriver/BuiltinOptions=2Ecpp=09lib/Compile?= =?utf-8?q?rDriver/Makefile_lib/CompilerDriver/Tool=2Ecpp?= References: <200906290309.n5T39LPo015790@zion.cs.uiuc.edu> Message-ID: Hi, Howard Su writes: > Great. I can now wait to try. How can I compile a pass as a > DLL? Since you are talking about a pass, I guess you're thinking about *opt* plugins, but this was a *llvmc* commit. Anyway, to compile a llvmc plugin you should just cd to the plugin directory and run make: $ cd $LLVM_DIR/tools/llvmc/plugins/Base $ make $ cd $LLVM_DIR/tools/llvmc/example/Skeleton $ make $ llvmc-skeleton -load $LLVM_DIR/Release/lib/plugin_llvmc_Base.dll --help > Can you include a sample CMakefile? No, I don't use CMake. From isanbard at gmail.com Mon Jun 29 18:42:21 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 29 Jun 2009 23:42:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74475 - /llvm-gcc-4.2/trunk/gcc/function.c Message-ID: <200906292342.n5TNgLW5005272@zion.cs.uiuc.edu> Author: void Date: Mon Jun 29 18:42:21 2009 New Revision: 74475 URL: http://llvm.org/viewvc/llvm-project?rev=74475&view=rev Log: LLVM's optimizer does the inlining of "always_inline" functions. A function that returns an aggregate value may not be a problem in this case. The GCC inliner would normally inline these functions, and, if there are no more uses of said function, remove it entirely so that it would never hit this warning. For LLVM, check that the function is *not* marked "always_inline" before issuing the warning. Modified: llvm-gcc-4.2/trunk/gcc/function.c Modified: llvm-gcc-4.2/trunk/gcc/function.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/function.c?rev=74475&r1=74474&r2=74475&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/function.c (original) +++ llvm-gcc-4.2/trunk/gcc/function.c Mon Jun 29 18:42:21 2009 @@ -3985,7 +3985,13 @@ /* LLVM LOCAL end */ /* Warn if this value is an aggregate type, regardless of which calling convention we are using for it. */ - if (AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr)))) + /* LLVM LOCAL begin - */ + if (AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr))) +#ifdef ENABLE_LLVM + && !lookup_attribute ("always_inline", DECL_ATTRIBUTES (subr)) +#endif + ) + /* LLVM LOCAL end - */ warning (OPT_Waggregate_return, "function returns an aggregate"); } From daniel at zuster.org Mon Jun 29 18:43:14 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 23:43:14 -0000 Subject: [llvm-commits] [llvm] r74476 - in /llvm/trunk: include/llvm/MC/MCContext.h include/llvm/MC/MCSymbol.h tools/llvm-mc/AsmParser.cpp Message-ID: <200906292343.n5TNhEGn005318@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 18:43:14 2009 New Revision: 74476 URL: http://llvm.org/viewvc/llvm-project?rev=74476&view=rev Log: llvm-mc: Diagnose misuse (mix) of defined symbols and labels. - For example, we diagnose errors on: -- a: a = 10 -- - For now we reject code like: -- .long a a = 10 -- which "as" accepts (on Darwin). Modified: llvm/trunk/include/llvm/MC/MCContext.h llvm/trunk/include/llvm/MC/MCSymbol.h llvm/trunk/tools/llvm-mc/AsmParser.cpp Modified: llvm/trunk/include/llvm/MC/MCContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=74476&r1=74475&r2=74476&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCContext.h (original) +++ llvm/trunk/include/llvm/MC/MCContext.h Mon Jun 29 18:43:14 2009 @@ -31,6 +31,8 @@ StringMap Symbols; /// SymbolValues - Bindings of symbols to values. + // + // FIXME: Is there a good reason to not just put this in the MCSymbol? DenseMap SymbolValues; /// Allocator - Allocator object used for creating machine code objects. Modified: llvm/trunk/include/llvm/MC/MCSymbol.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=74476&r1=74475&r2=74476&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) +++ llvm/trunk/include/llvm/MC/MCSymbol.h Mon Jun 29 18:43:14 2009 @@ -17,14 +17,18 @@ MCSection *Section; std::string Name; unsigned IsTemporary : 1; + unsigned IsExternal : 1; public: MCSymbol(const char *_Name, bool _IsTemporary) - : Section(0), Name(_Name), IsTemporary(_IsTemporary) {} + : Section(0), Name(_Name), IsTemporary(_IsTemporary), IsExternal(false) {} MCSection *getSection() const { return Section; } void setSection(MCSection *Value) { Section = Value; } + bool isExternal() const { return IsExternal; } + void setExternal(bool Value) { IsExternal = Value; } + const std::string &getName() const { return Name; } }; Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74476&r1=74475&r2=74476&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 29 18:43:14 2009 @@ -17,6 +17,7 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSymbol.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -82,12 +83,19 @@ return true; Res = new AsmUnaryExpr(AsmUnaryExpr::LNot, Res); return false; - case asmtok::Identifier: + case asmtok::Identifier: { // This is a label, this should be parsed as part of an expression, to // handle things like LFOO+4. - Res = new AsmSymbolRefExpr(Ctx.GetOrCreateSymbol(Lexer.getCurStrVal())); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + + // If this is use of an undefined symbol then mark it external. + if (!Sym->getSection() && !Ctx.GetSymbolValue(Sym)) + Sym->setExternal(true); + + Res = new AsmSymbolRefExpr(Sym); Lexer.Lex(); // Eat identifier. return false; + } case asmtok::IntVal: Res = new AsmConstantExpr(Lexer.getCurIntVal()); Lexer.Lex(); // Eat identifier. @@ -270,16 +278,28 @@ // Consume the identifier, see what is after it. switch (Lexer.Lex()) { - case asmtok::Colon: + case asmtok::Colon: { // identifier ':' -> Label. Lexer.Lex(); + + // Diagnose attempt to use a variable as a label. + // + // FIXME: Diagnostics. Note the location of the definition as a label. + // FIXME: This doesn't diagnose assignment to a symbol which has been + // implicitly marked as external. + MCSymbol *Sym = Ctx.GetOrCreateSymbol(IDVal); + if (Sym->getSection()) + return Error(IDLoc, "invalid symbol redefinition"); + if (Ctx.GetSymbolValue(Sym)) + return Error(IDLoc, "symbol already used as assembler variable"); // Since we saw a label, create a symbol and emit it. // FIXME: If the label starts with L it is an assembler temporary label. // Why does the client of this api need to know this? - Out.EmitLabel(Ctx.GetOrCreateSymbol(IDVal)); - + Out.EmitLabel(Sym); + return ParseStatement(); + } case asmtok::Equal: // identifier '=' ... -> assignment statement @@ -440,6 +460,9 @@ } bool AsmParser::ParseAssignment(const char *Name, bool IsDotSet) { + // FIXME: Use better location, we should use proper tokens. + SMLoc EqualLoc = Lexer.getLoc(); + int64_t Value; if (ParseAbsoluteExpression(Value)) return true; @@ -450,9 +473,20 @@ // Eat the end of statement marker. Lexer.Lex(); - // Get the symbol for this name. + // Diagnose assignment to a label. + // + // FIXME: Diagnostics. Note the location of the definition as a label. + // FIXME: This doesn't diagnose assignment to a symbol which has been + // implicitly marked as external. // FIXME: Handle '.'. + // FIXME: Diagnose assignment to protected identifier (e.g., register name). MCSymbol *Sym = Ctx.GetOrCreateSymbol(Name); + if (Sym->getSection()) + return Error(EqualLoc, "invalid assignment to symbol emitted as a label"); + if (Sym->isExternal()) + return Error(EqualLoc, "invalid assignment to external symbol"); + + // Do the assignment. Out.EmitAssignment(Sym, MCValue::get(Value), IsDotSet); return false; From dpatel at apple.com Mon Jun 29 18:46:50 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Jun 2009 23:46:50 -0000 Subject: [llvm-commits] [llvm] r74477 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200906292346.n5TNkope005462@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jun 29 18:46:50 2009 New Revision: 74477 URL: http://llvm.org/viewvc/llvm-project?rev=74477&view=rev Log: Struct types are described using field types only. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=74477&r1=74476&r2=74477&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Jun 29 18:46:50 2009 @@ -678,9 +678,6 @@ if (Element.getTag() == dwarf::DW_TAG_subprogram) ElemDie = CreateSubprogramDIE(DW_Unit, DISubprogram(Element.getGV())); - else if (Element.getTag() == dwarf::DW_TAG_variable) // ?? - ElemDie = CreateGlobalVariableDIE(DW_Unit, - DIGlobalVariable(Element.getGV())); else ElemDie = CreateMemberDIE(DW_Unit, DIDerivedType(Element.getGV())); From daniel at zuster.org Mon Jun 29 18:47:00 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 29 Jun 2009 23:47:00 -0000 Subject: [llvm-commits] [llvm] r74478 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp test/MC/AsmParser/directive_align.s tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h Message-ID: <200906292347.n5TNl09u005485@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 18:46:59 2009 New Revision: 74478 URL: http://llvm.org/viewvc/llvm-project?rev=74478&view=rev Log: llvm-mc: Parse .{,b,p2}align{,w,l} directives. Added: llvm/trunk/test/MC/AsmParser/directive_align.s Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=74478&r1=74477&r2=74478&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Jun 29 18:46:59 2009 @@ -135,7 +135,7 @@ /// This used to implement the .align assembler directive. /// /// @param ByteAlignment - The alignment to reach. This must be a power of - /// two. + /// two on some targets. /// @param Value - The value to use when filling bytes. /// @param Size - The size of the integer (in bytes) to emit for @param /// Value. This must match a native machine width. Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=74478&r1=74477&r2=74478&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Jun 29 18:46:59 2009 @@ -105,6 +105,7 @@ OS << Symbol->getName() << ":\n"; Symbol->setSection(CurSection); + Symbol->setExternal(false); } void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value, @@ -164,20 +165,23 @@ void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit) { + // Some assemblers don't support .balign, so we always emit as .p2align if + // this is a power of two. Otherwise we assume the client knows the target + // supports .balign and use that. unsigned Pow2 = Log2_32(ByteAlignment); - assert((1U << Pow2) == ByteAlignment && "Invalid alignment!"); + bool IsPow2 = (1U << Pow2) == ByteAlignment; switch (ValueSize) { default: assert(0 && "Invalid size for machine code value!"); case 8: assert(0 && "Unsupported alignment size!"); - case 1: OS << ".p2align"; break; - case 2: OS << ".p2alignw"; break; - case 4: OS << ".p2alignl"; break; + case 1: OS << (IsPow2 ? ".p2align" : ".balign"); break; + case 2: OS << (IsPow2 ? ".p2alignw" : ".balignw"); break; + case 4: OS << (IsPow2 ? ".p2alignl" : ".balignl"); break; } - OS << ' ' << Pow2; + OS << ' ' << (IsPow2 ? Pow2 : ByteAlignment); OS << ", " << truncateToSize(Value, ValueSize); if (MaxBytesToEmit) Added: llvm/trunk/test/MC/AsmParser/directive_align.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_align.s?rev=74478&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/directive_align.s (added) +++ llvm/trunk/test/MC/AsmParser/directive_align.s Mon Jun 29 18:46:59 2009 @@ -0,0 +1,16 @@ +# RUN: llvm-mc %s > %t + +# RUN: grep -A 2 TEST0 %t > %t2 +# RUN: grep ".p2align 1, 0" %t2 | count 1 +TEST0: + .align 1 + +# RUN: grep -A 2 TEST1 %t > %t2 +# RUN: grep ".p2alignl 3, 0, 2" %t2 | count 1 +TEST1: + .align32 3,,2 + +# RUN: grep -A 2 TEST2 %t > %t2 +# RUN: grep ".balign 3, 10" %t2 | count 1 +TEST2: + .balign 3,10 Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74478&r1=74477&r2=74478&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 29 18:46:59 2009 @@ -429,10 +429,30 @@ return ParseDirectiveValue(4); if (!strcmp(IDVal, ".quad")) return ParseDirectiveValue(8); - if (!strcmp(IDVal, ".fill")) - return ParseDirectiveFill(); + + // FIXME: Target hooks for IsPow2. + if (!strcmp(IDVal, ".align")) + return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/1); + if (!strcmp(IDVal, ".align32")) + return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/4); + if (!strcmp(IDVal, ".balign")) + return ParseDirectiveAlign(/*IsPow2=*/false, /*ExprSize=*/1); + if (!strcmp(IDVal, ".balignw")) + return ParseDirectiveAlign(/*IsPow2=*/false, /*ExprSize=*/2); + if (!strcmp(IDVal, ".balignl")) + return ParseDirectiveAlign(/*IsPow2=*/false, /*ExprSize=*/4); + if (!strcmp(IDVal, ".p2align")) + return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/1); + if (!strcmp(IDVal, ".p2alignw")) + return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/2); + if (!strcmp(IDVal, ".p2alignl")) + return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/4); + if (!strcmp(IDVal, ".org")) return ParseDirectiveOrg(); + + if (!strcmp(IDVal, ".fill")) + return ParseDirectiveFill(); if (!strcmp(IDVal, ".space")) return ParseDirectiveSpace(); @@ -708,3 +728,77 @@ return false; } + +/// ParseDirectiveAlign +/// ::= {.align, ...} expression [ , expression [ , expression ]] +bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { + int64_t Alignment; + if (ParseAbsoluteExpression(Alignment)) + return true; + + SMLoc MaxBytesLoc; + bool HasFillExpr = false; + int64_t FillExpr = 0; + int64_t MaxBytesToFill = 0; + if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(asmtok::Comma)) + return TokError("unexpected token in directive"); + Lexer.Lex(); + + // The fill expression can be omitted while specifying a maximum number of + // alignment bytes, e.g: + // .align 3,,4 + if (Lexer.isNot(asmtok::Comma)) { + HasFillExpr = true; + if (ParseAbsoluteExpression(FillExpr)) + return true; + } + + if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(asmtok::Comma)) + return TokError("unexpected token in directive"); + Lexer.Lex(); + + MaxBytesLoc = Lexer.getLoc(); + if (ParseAbsoluteExpression(MaxBytesToFill)) + return true; + + if (Lexer.isNot(asmtok::EndOfStatement)) + return TokError("unexpected token in directive"); + } + } + + Lexer.Lex(); + + if (!HasFillExpr) { + // FIXME: Sometimes fill with nop. + FillExpr = 0; + } + + // Compute alignment in bytes. + if (IsPow2) { + // FIXME: Diagnose overflow. + Alignment = 1 << Alignment; + } + + // Diagnose non-sensical max bytes to fill. + if (MaxBytesLoc.isValid()) { + if (MaxBytesToFill < 1) { + Lexer.PrintMessage(MaxBytesLoc, "warning: alignment directive can never " + "be satisfied in this many bytes, ignoring"); + return false; + } + + if (MaxBytesToFill >= Alignment) { + Lexer.PrintMessage(MaxBytesLoc, "warning: maximum bytes expression " + "exceeds alignment and has no effect"); + MaxBytesToFill = 0; + } + } + + // FIXME: Target specific behavior about how the "extra" bytes are filled. + Out.EmitValueToAlignment(Alignment, FillExpr, ValueSize, MaxBytesToFill); + + return false; +} + Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=74478&r1=74477&r2=74478&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jun 29 18:46:59 2009 @@ -79,6 +79,8 @@ bool ParseDirectiveSpace(); // ".space" bool ParseDirectiveSet(); // ".set" bool ParseDirectiveOrg(); // ".org" + // ".align{,32}", ".p2align{,w,l}" + bool ParseDirectiveAlign(bool IsPow2, unsigned ValueSize); }; From aaronngray.lists at googlemail.com Mon Jun 29 18:55:19 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Tue, 30 Jun 2009 00:55:19 +0100 Subject: [llvm-commits] Cygwin 'volitile sys::cas_flag' patch Message-ID: <21D07E7DCEEC40218E09D18538FFCB98@HPLAPTOP> Sorry I sent the patch using Google mail which zips the patch file. Heres another copy. I am getting a casting error on the Cygwin build on both GCC 3.4.4 and GCC 4.2.4. I have created a patch but it may need checking out and reviewing befoire applying as I am not sure about the use of the volitile in this context. Thanks, Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/26d7a00f/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: cygwin.patch Type: application/octet-stream Size: 1787 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/26d7a00f/attachment.obj From foldr at codedgers.com Mon Jun 29 19:15:24 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Tue, 30 Jun 2009 00:15:24 -0000 Subject: [llvm-commits] [llvm] r74482 - in /llvm/trunk: include/llvm/CompilerDriver/Main.inc lib/CompilerDriver/Main.cpp Message-ID: <200906300015.n5U0FORd006408@zion.cs.uiuc.edu> Author: foldr Date: Mon Jun 29 19:15:24 2009 New Revision: 74482 URL: http://llvm.org/viewvc/llvm-project?rev=74482&view=rev Log: Move the driver entry point out of Main.inc. Added: llvm/trunk/lib/CompilerDriver/Main.cpp - copied, changed from r74473, llvm/trunk/include/llvm/CompilerDriver/Main.inc Modified: llvm/trunk/include/llvm/CompilerDriver/Main.inc Modified: llvm/trunk/include/llvm/CompilerDriver/Main.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Main.inc?rev=74482&r1=74481&r2=74482&view=diff ============================================================================== --- llvm/trunk/include/llvm/CompilerDriver/Main.inc (original) +++ llvm/trunk/include/llvm/CompilerDriver/Main.inc Mon Jun 29 19:15:24 2009 @@ -12,121 +12,22 @@ // supported please refer to the tools' manual page or run the tool // with the --help option. // +// This file provides the default entry point for the driver executable. +// //===----------------------------------------------------------------------===// #ifndef LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC #define LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC -#include "llvm/CompilerDriver/BuiltinOptions.h" -#include "llvm/CompilerDriver/CompilationGraph.h" -#include "llvm/CompilerDriver/Error.h" #include "llvm/CompilerDriver/ForceLinkage.h" -#include "llvm/CompilerDriver/Plugin.h" - -#include "llvm/System/Path.h" - -#include -#include -#include - -namespace cl = llvm::cl; -namespace sys = llvm::sys; -using namespace llvmc; - -namespace { - - sys::Path getTempDir() { - sys::Path tempDir; - - // GCC 4.5-style -save-temps handling. - if (SaveTemps == SaveTempsEnum::Unset) { - tempDir = sys::Path::GetTemporaryDirectory(); - } - else if (SaveTemps == SaveTempsEnum::Obj && !OutputFilename.empty()) { - tempDir = OutputFilename; - - if (!tempDir.exists()) { - std::string ErrMsg; - if (tempDir.createDirectoryOnDisk(true, &ErrMsg)) - throw std::runtime_error(ErrMsg); - } - } - // else if (SaveTemps == Cwd) -> use current dir (leave tempDir empty) - - return tempDir; - } - - /// BuildTargets - A small wrapper for CompilationGraph::Build. - int BuildTargets(CompilationGraph& graph, const LanguageMap& langMap) { - int ret; - const sys::Path& tempDir = getTempDir(); - try { - ret = graph.Build(tempDir, langMap); - } - catch(...) { - if (SaveTemps == SaveTempsEnum::Unset) - tempDir.eraseFromDisk(true); - throw; - } - - if (SaveTemps == SaveTempsEnum::Unset) - tempDir.eraseFromDisk(true); - return ret; - } +namespace llvmc { + int Main(int argc, char** argv); } int main(int argc, char** argv) { - try { - ForceLinkage(); - - LanguageMap langMap; - CompilationGraph graph; - - cl::ParseCommandLineOptions - (argc, argv, "LLVM Compiler Driver (Work In Progress)", true); - - PluginLoader Plugins; - Plugins.PopulateLanguageMap(langMap); - Plugins.PopulateCompilationGraph(graph); - - if (CheckGraph) { - int ret = graph.Check(); - if (!ret) - std::cerr << "check-graph: no errors found.\n"; - - return ret; - } - - if (ViewGraph) { - graph.viewGraph(); - if (!WriteGraph) - return 0; - } - - if (WriteGraph) { - graph.writeGraph(OutputFilename.empty() - ? std::string("compilation-graph.dot") - : OutputFilename); - return 0; - } - - if (InputFilenames.empty()) { - throw std::runtime_error("no input files"); - } - - return BuildTargets(graph, langMap); - } - catch(llvmc::error_code& ec) { - return ec.code(); - } - catch(const std::exception& ex) { - std::cerr << argv[0] << ": " << ex.what() << '\n'; - } - catch(...) { - std::cerr << argv[0] << ": unknown error!\n"; - } - return 1; + llvmc::ForceLinkage(); + return llvmc::Main(argc, argv); } #endif // LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC Copied: llvm/trunk/lib/CompilerDriver/Main.cpp (from r74473, llvm/trunk/include/llvm/CompilerDriver/Main.inc) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Main.cpp?p2=llvm/trunk/lib/CompilerDriver/Main.cpp&p1=llvm/trunk/include/llvm/CompilerDriver/Main.inc&r1=74473&r2=74482&rev=74482&view=diff ============================================================================== --- llvm/trunk/include/llvm/CompilerDriver/Main.inc (original) +++ llvm/trunk/lib/CompilerDriver/Main.cpp Mon Jun 29 19:15:24 2009 @@ -1,4 +1,4 @@ -//===--- Main.inc - The LLVM Compiler Driver --------------------*- C++ -*-===// +//===--- Main.cpp - The LLVM Compiler Driver --------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,20 +7,13 @@ // //===----------------------------------------------------------------------===// // -// This tool provides a single point of access to the LLVM -// compilation tools. It has many options. To discover the options -// supported please refer to the tools' manual page or run the tool -// with the --help option. +// llvmc::Main function - driver entry point. // //===----------------------------------------------------------------------===// -#ifndef LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC -#define LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC - #include "llvm/CompilerDriver/BuiltinOptions.h" #include "llvm/CompilerDriver/CompilationGraph.h" #include "llvm/CompilerDriver/Error.h" -#include "llvm/CompilerDriver/ForceLinkage.h" #include "llvm/CompilerDriver/Plugin.h" #include "llvm/System/Path.h" @@ -76,10 +69,10 @@ } } -int main(int argc, char** argv) { - try { - ForceLinkage(); +namespace llvmc { +int Main(int argc, char** argv) { + try { LanguageMap langMap; CompilationGraph graph; @@ -129,4 +122,4 @@ return 1; } -#endif // LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC +} // end namespace llvmc From foldr at codedgers.com Mon Jun 29 19:16:00 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Tue, 30 Jun 2009 00:16:00 -0000 Subject: [llvm-commits] [llvm] r74483 - in /llvm/trunk: lib/CompilerDriver/Main.cpp tools/llvmc/doc/LLVMC-Reference.rst Message-ID: <200906300016.n5U0G0DT006437@zion.cs.uiuc.edu> Author: foldr Date: Mon Jun 29 19:16:00 2009 New Revision: 74483 URL: http://llvm.org/viewvc/llvm-project?rev=74483&view=rev Log: Add a way to access argv[0] in hooks. Modified: llvm/trunk/lib/CompilerDriver/Main.cpp llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst Modified: llvm/trunk/lib/CompilerDriver/Main.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Main.cpp?rev=74483&r1=74482&r2=74483&view=diff ============================================================================== --- llvm/trunk/lib/CompilerDriver/Main.cpp (original) +++ llvm/trunk/lib/CompilerDriver/Main.cpp Mon Jun 29 19:16:00 2009 @@ -71,11 +71,16 @@ namespace llvmc { +// Sometimes plugins want to condition on the value in argv[0]. +const char* ProgramName; + int Main(int argc, char** argv) { try { LanguageMap langMap; CompilationGraph graph; + ProgramName = argv[0]; + cl::ParseCommandLineOptions (argc, argv, "LLVM Compiler Driver (Work In Progress)", true); Modified: llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst?rev=74483&r1=74482&r2=74483&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst (original) +++ llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst Mon Jun 29 19:16:00 2009 @@ -678,6 +678,28 @@ .. _Graphviz: http://www.graphviz.org/ .. _Ghostview: http://pages.cs.wisc.edu/~ghost/ +Conditioning on the executable name +----------------------------------- + +For now, the executable name (the value passed to the driver in ``argv[0]``) is +accessible only in the C++ code (i.e. hooks). Use the following code:: + + namespace llvmc { + extern const char* ProgramName; + } + + std::string MyHook() { + //... + if (strcmp(ProgramName, "mydriver") == 0) { + //... + + } + +In general, you're encouraged not to make the behaviour dependent on the +executable file name, and use command-line switches instead. See for example how +the ``Base`` plugin behaves when it needs to choose the correct linker options +(think ``g++`` vs. ``gcc``). + .. raw:: html
From foldr at codedgers.com Mon Jun 29 19:16:23 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Tue, 30 Jun 2009 00:16:23 -0000 Subject: [llvm-commits] [llvm] r74484 - /llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst Message-ID: <200906300016.n5U0GNEv006455@zion.cs.uiuc.edu> Author: foldr Date: Mon Jun 29 19:16:22 2009 New Revision: 74484 URL: http://llvm.org/viewvc/llvm-project?rev=74484&view=rev Log: Clang is now production quality (at least for C). Modified: llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst Modified: llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst?rev=74484&r1=74483&r2=74484&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst (original) +++ llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst Mon Jun 29 19:16:22 2009 @@ -71,9 +71,8 @@ $ ./a.out hello -By default, LLVMC uses ``llvm-gcc`` to compile the source code. It is -also possible to choose the work-in-progress ``clang`` compiler with -the ``-clang`` option. +By default, LLVMC uses ``llvm-gcc`` to compile the source code. It is also +possible to choose the ``clang`` compiler with the ``-clang`` option. Predefined options From foldr at codedgers.com Mon Jun 29 19:16:43 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Tue, 30 Jun 2009 00:16:43 -0000 Subject: [llvm-commits] [llvm] r74485 - /llvm/trunk/docs/CompilerDriver.html Message-ID: <200906300016.n5U0GhSZ006476@zion.cs.uiuc.edu> Author: foldr Date: Mon Jun 29 19:16:43 2009 New Revision: 74485 URL: http://llvm.org/viewvc/llvm-project?rev=74485&view=rev Log: Regenerate. Modified: llvm/trunk/docs/CompilerDriver.html Modified: llvm/trunk/docs/CompilerDriver.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CompilerDriver.html?rev=74485&r1=74484&r2=74485&view=diff ============================================================================== --- llvm/trunk/docs/CompilerDriver.html (original) +++ llvm/trunk/docs/CompilerDriver.html Mon Jun 29 19:16:43 2009 @@ -37,6 +37,7 @@
  • Hooks and environment variables
  • How plugins are loaded
  • Debugging
  • +
  • Conditioning on the executable name
  • @@ -94,9 +95,8 @@ $ ./a.out hello -

    By default, LLVMC uses llvm-gcc to compile the source code. It is -also possible to choose the work-in-progress clang compiler with -the -clang option.

    +

    By default, LLVMC uses llvm-gcc to compile the source code. It is also +possible to choose the clang compiler with the -clang option.

    Predefined options

    @@ -633,6 +633,27 @@ dynamically. When invoked with --check-graph, llvmc doesn't perform any compilation tasks and returns the number of encountered errors as its status code.

    +
    +
    +

    Conditioning on the executable name

    +

    For now, the executable name (the value passed to the driver in argv[0]) is +accessible only in the C++ code (i.e. hooks). Use the following code:

    +
    +namespace llvmc {
    +extern const char* ProgramName;
    +}
    +
    +std::string MyHook() {
    +//...
    +if (strcmp(ProgramName, "mydriver") == 0) {
    +   //...
    +
    +}
    +
    +

    In general, you're encouraged not to make the behaviour dependent on the +executable file name, and use command-line switches instead. See for example how +the Base plugin behaves when it needs to choose the correct linker options +(think g++ vs. gcc).


    From daniel at zuster.org Mon Jun 29 19:33:19 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 00:33:19 -0000 Subject: [llvm-commits] [llvm] r74487 - in /llvm/trunk: test/MC/AsmParser/directive_symbol_attrs.s tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h Message-ID: <200906300033.n5U0XJab007001@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 19:33:19 2009 New Revision: 74487 URL: http://llvm.org/viewvc/llvm-project?rev=74487&view=rev Log: llvm-mc: Parse symbol attribute directives. Added: llvm/trunk/test/MC/AsmParser/directive_symbol_attrs.s Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h Added: llvm/trunk/test/MC/AsmParser/directive_symbol_attrs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_symbol_attrs.s?rev=74487&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/directive_symbol_attrs.s (added) +++ llvm/trunk/test/MC/AsmParser/directive_symbol_attrs.s Mon Jun 29 19:33:19 2009 @@ -0,0 +1,7 @@ +# RUN: llvm-mc %s > %t + +# RUN: grep -A 3 TEST0 %t > %t2 +# RUN: grep ".globl a" %t2 | count 1 +# RUN: grep ".globl b" %t2 | count 1 +TEST0: + .globl a, b Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74487&r1=74486&r2=74487&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 29 19:33:19 2009 @@ -456,6 +456,32 @@ if (!strcmp(IDVal, ".space")) return ParseDirectiveSpace(); + // Symbol attribute directives + if (!strcmp(IDVal, ".globl") || !strcmp(IDVal, ".global")) + return ParseDirectiveSymbolAttribute(MCStreamer::Global); + if (!strcmp(IDVal, ".hidden")) + return ParseDirectiveSymbolAttribute(MCStreamer::Hidden); + if (!strcmp(IDVal, ".indirect_symbol")) + return ParseDirectiveSymbolAttribute(MCStreamer::IndirectSymbol); + if (!strcmp(IDVal, ".internal")) + return ParseDirectiveSymbolAttribute(MCStreamer::Internal); + if (!strcmp(IDVal, ".lazy_reference")) + return ParseDirectiveSymbolAttribute(MCStreamer::LazyReference); + if (!strcmp(IDVal, ".no_dead_strip")) + return ParseDirectiveSymbolAttribute(MCStreamer::NoDeadStrip); + if (!strcmp(IDVal, ".private_extern")) + return ParseDirectiveSymbolAttribute(MCStreamer::PrivateExtern); + if (!strcmp(IDVal, ".protected")) + return ParseDirectiveSymbolAttribute(MCStreamer::Protected); + if (!strcmp(IDVal, ".reference")) + return ParseDirectiveSymbolAttribute(MCStreamer::Reference); + if (!strcmp(IDVal, ".weak")) + return ParseDirectiveSymbolAttribute(MCStreamer::Weak); + if (!strcmp(IDVal, ".weak_definition")) + return ParseDirectiveSymbolAttribute(MCStreamer::WeakDefinition); + if (!strcmp(IDVal, ".weak_reference")) + return ParseDirectiveSymbolAttribute(MCStreamer::WeakReference); + Lexer.PrintMessage(IDLoc, "warning: ignoring directive for now"); EatToEndOfStatement(); return false; @@ -802,3 +828,32 @@ return false; } +/// ParseDirectiveSymbolAttribute +/// ::= { ".globl", ".weak", ... } [ identifier ( , identifier )* ] +bool AsmParser::ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr) { + if (Lexer.isNot(asmtok::EndOfStatement)) { + for (;;) { + if (Lexer.isNot(asmtok::Identifier)) + return TokError("expected identifier in directive"); + + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + Lexer.Lex(); + + // If this is use of an undefined symbol then mark it external. + if (!Sym->getSection() && !Ctx.GetSymbolValue(Sym)) + Sym->setExternal(true); + + Out.EmitSymbolAttribute(Sym, Attr); + + if (Lexer.is(asmtok::EndOfStatement)) + break; + + if (Lexer.isNot(asmtok::Comma)) + return TokError("unexpected token in directive"); + Lexer.Lex(); + } + } + + Lexer.Lex(); + return false; +} Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=74487&r1=74486&r2=74487&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jun 29 19:33:19 2009 @@ -15,6 +15,7 @@ #define ASMPARSER_H #include "AsmLexer.h" +#include "llvm/MC/MCStreamer.h" namespace llvm { class AsmExpr; @@ -81,6 +82,10 @@ bool ParseDirectiveOrg(); // ".org" // ".align{,32}", ".p2align{,w,l}" bool ParseDirectiveAlign(bool IsPow2, unsigned ValueSize); + + /// ParseDirectiveSymbolAttribute - Parse a directive like ".globl" which + /// accepts a single symbol (which should be a label or an external). + bool ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr); }; From resistor at mac.com Mon Jun 29 19:48:55 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 30 Jun 2009 00:48:55 -0000 Subject: [llvm-commits] [llvm] r74488 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/CMakeLists.txt lib/VMCore/LLVMContext.cpp lib/VMCore/LLVMContextImpl.h Message-ID: <200906300048.n5U0mucZ007464@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 29 19:48:55 2009 New Revision: 74488 URL: http://llvm.org/viewvc/llvm-project?rev=74488&view=rev Log: Add LLVMContext, which will eventually be used as a container for privatizing a lot of (currently) global state, including the constant and type uniquing tables. For now, just make it a wrapper around the existing APIs. Added: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.h Modified: llvm/trunk/lib/VMCore/CMakeLists.txt Added: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74488&view=auto ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (added) +++ llvm/trunk/include/llvm/LLVMContext.h Mon Jun 29 19:48:55 2009 @@ -0,0 +1,162 @@ +//===-- llvm/LLVMContext.h - Class for managing "global" state --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LLVMCONTEXT_H +#define LLVM_LLVMCONTEXT_H + +#include "llvm/Support/DataTypes.h" +#include +#include + +namespace llvm { + +class LLVMContextImpl; +class Constant; +class ConstantInt; +class ConstantPointerNull; +class ConstantStruct; +class ConstantAggregateZero; +class ConstantArray; +class ConstantFP; +class ConstantVector; +class IntegerType; +class PointerType; +class StructType; +class ArrayType; +class VectorType; +class Type; +class APInt; +class APFloat; +class Value; + +class LLVMContext { + LLVMContextImpl* pImpl; +public: + LLVMContext(); + ~LLVMContext(); + + // ConstantInt accessors + ConstantInt* getConstantIntTrue(); + ConstantInt* getConstantIntFalse(); + ConstantInt* getConstantInt(const IntegerType* Ty, uint64_t V, + bool isSigned = false); + ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V); + ConstantInt* getConstantInt(const APInt& V); + Constant* getConstantInt(const Type* Ty, const APInt& V); + ConstantInt* getAllOnesConstantInt(const Type* Ty); + + // ConstantPointerNull accessors + ConstantPointerNull* getConstantPointerNull(const PointerType* T); + + // ConstantStruct accessors + Constant* getConstantStruct(const StructType* T, + const std::vector& V); + Constant* getConstantStruct(const std::vector& V, + bool Packed = false); + Constant* getConstantStruct(Constant* const *Vals, unsigned NumVals, + bool Packed = false); + + // ConstantAggregateZero accessors + ConstantAggregateZero* getConstantAggregateZero(const Type* Ty); + + // ConstantArray accessors + Constant* getConstantArray(const ArrayType* T, + const std::vector& V); + Constant* getConstantArray(const ArrayType* T, Constant* const* Vals, + unsigned NumVals); + Constant* getConstantArray(const std::string& Initializer, + bool AddNull = false); + + // ConstantExpr accessors + Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2); + Constant* getConstantExprTrunc(Constant* C, const Type* Ty); + Constant* getConstantExprSExt(Constant* C, const Type* Ty); + Constant* getConstantExprZExt(Constant* C, const Type* Ty); + Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty); + Constant* getConstantExprFPExtend(Constant* C, const Type* Ty); + Constant* getConstantExprUIToFP(Constant* C, const Type* Ty); + Constant* getConstantExprSIToFP(Constant* C, const Type* Ty); + Constant* getConstantExprFPToUI(Constant* C, const Type* Ty); + Constant* getConstantExprFPToSI(Constant* C, const Type* Ty); + Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty); + Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty); + Constant* getConstantExprBitCast(Constant* C, const Type* Ty); + Constant* getConstantExprCast(unsigned ops, Constant* C, const Type* Ty); + Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty); + Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty); + Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty); + Constant* getConstantExprPointerCast(Constant* C, const Type* Ty); + Constant* getConstantExprIntegerCast(Constant* C, const Type* Ty, + bool isSigned); + Constant* getConstantExprFPCast(Constant* C, const Type* Ty); + Constant* getConstantExprSelect(Constant* C, Constant* V1, Constant* V2); + Constant* getConstantExprAlignOf(const Type* Ty); + Constant* getConstantExprCompare(unsigned short pred, + Constant* C1, Constant* C2); + Constant* getConstantExprNeg(Constant* C); + Constant* getConstantExprFNeg(Constant* C); + Constant* getConstantExprNot(Constant* C); + Constant* getConstantExprAdd(Constant* C1, Constant* C2); + Constant* getConstantExprFAdd(Constant* C1, Constant* C2); + Constant* getConstantExprSub(Constant* C1, Constant* C2); + Constant* getConstantExprFSub(Constant* C1, Constant* C2); + Constant* getConstantExprMul(Constant* C1, Constant* C2); + Constant* getConstantExprFMul(Constant* C1, Constant* C2); + Constant* getConstantExprUDiv(Constant* C1, Constant* C2); + Constant* getConstantExprSDiv(Constant* C1, Constant* C2); + Constant* getConstantExprFDiv(Constant* C1, Constant* C2); + Constant* getConstantExprURem(Constant* C1, Constant* C2); + Constant* getConstantExprSRem(Constant* C1, Constant* C2); + Constant* getConstantExprFRem(Constant* C1, Constant* C2); + Constant* getConstantExprAnd(Constant* C1, Constant* C2); + Constant* getConstantExprOr(Constant* C1, Constant* C2); + Constant* getConstantExprXor(Constant* C1, Constant* C2); + Constant* getConstantExprICmp(unsigned short pred, Constant* LHS, + Constant* RHS); + Constant* getConstantExprFCmp(unsigned short pred, Constant* LHS, + Constant* RHS); + Constant* getConstantExprVICmp(unsigned short pred, Constant* LHS, + Constant* RHS); + Constant* getConstantExprVFCmp(unsigned short pred, Constant* LHS, + Constant* RHS); + Constant* getConstantExprShl(Constant* C1, Constant* C2); + Constant* getConstantExprLShr(Constant* C1, Constant* C2); + Constant* getConstantExprAShr(Constant* C1, Constant* C2); + Constant* getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList, + unsigned NumIdx); + Constant* getConstantExprGetElementPtr(Constant* C, Value* const* IdxList, + unsigned NumIdx); + Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx); + Constant* getConstantExprInsertElement(Constant* Vec, Constant* Elt, + Constant* Idx); + Constant* getConstantExprShuffleVector(Constant* V1, Constant* V2, + Constant* Mask); + Constant* getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList, + unsigned NumIdx); + Constant* getConstantExprInsertValue(Constant* Agg, Constant* Val, + const unsigned* IdxList, + unsigned NumIdx); + Constant* getZeroValueForNegation(const Type* Ty); + + // ConstantFP accessors + ConstantFP* getConstantFP(const APFloat& V); + Constant* getConstantFP(const Type* Ty, double V); + ConstantFP* getConstantFPNegativeZero(const Type* Ty); + + // ConstantVector accessors + Constant* getConstantVector(const VectorType* T, + const std::vector& V); + Constant* getConstantVector(const std::vector& V); + Constant* getConstantVector(Constant* const* Vals, unsigned NumVals); + ConstantVector* getConstantVectorAllOnes(const VectorType* Ty); +}; + +} + +#endif Modified: llvm/trunk/lib/VMCore/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/CMakeLists.txt?rev=74488&r1=74487&r2=74488&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/CMakeLists.txt (original) +++ llvm/trunk/lib/VMCore/CMakeLists.txt Mon Jun 29 19:48:55 2009 @@ -14,6 +14,7 @@ Instructions.cpp IntrinsicInst.cpp LeakDetector.cpp + LLVMContext.cpp Mangler.cpp Module.cpp ModuleProvider.cpp Added: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74488&view=auto ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (added) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Mon Jun 29 19:48:55 2009 @@ -0,0 +1,379 @@ +//===-- LLVMContext.cpp - Implement LLVMContext -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/LLVMContext.h" +#include "llvm/Constants.h" +#include "LLVMContextImpl.h" + +using namespace llvm; + +LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl()) { } +LLVMContext::~LLVMContext() { delete pImpl; } + +// ConstantInt accessors. +ConstantInt* LLVMContext::getConstantIntTrue() { + return ConstantInt::getTrue(); +} + +ConstantInt* LLVMContext::getConstantIntFalse() { + return ConstantInt::getFalse(); +} + +ConstantInt* LLVMContext::getConstantInt(const IntegerType* Ty, uint64_t V, + bool isSigned) { + return ConstantInt::get(Ty, V, isSigned); +} + +ConstantInt* LLVMContext::getConstantIntSigned(const IntegerType* Ty, + int64_t V) { + return ConstantInt::getSigned(Ty, V); +} + +ConstantInt* LLVMContext::getConstantInt(const APInt& V) { + return ConstantInt::get(V); +} + +Constant* LLVMContext::getConstantInt(const Type* Ty, const APInt& V) { + return ConstantInt::get(Ty, V); +} + +ConstantInt* LLVMContext::getAllOnesConstantInt(const Type* Ty) { + return ConstantInt::getAllOnesValue(Ty); +} + + +// ConstantPointerNull accessors. +ConstantPointerNull* LLVMContext::getConstantPointerNull(const PointerType* T) { + return ConstantPointerNull::get(T); +} + + +// ConstantStruct accessors. +Constant* LLVMContext::getConstantStruct(const StructType* T, + const std::vector& V) { + return ConstantStruct::get(T, V); +} + +Constant* LLVMContext::getConstantStruct(const std::vector& V, + bool Packed) { + return ConstantStruct::get(V, Packed); +} + +Constant* LLVMContext::getConstantStruct(Constant* const *Vals, + unsigned NumVals, bool Packed) { + return ConstantStruct::get(Vals, NumVals, Packed); +} + + +// ConstantAggregateZero accessors. +ConstantAggregateZero* LLVMContext::getConstantAggregateZero(const Type* Ty) { + return ConstantAggregateZero::get(Ty); +} + + +// ConstantArray accessors. +Constant* LLVMContext::getConstantArray(const ArrayType* T, + const std::vector& V) { + return ConstantArray::get(T, V); +} + +Constant* LLVMContext::getConstantArray(const ArrayType* T, + Constant* const* Vals, + unsigned NumVals) { + return ConstantArray::get(T, Vals, NumVals); +} + +Constant* LLVMContext::getConstantArray(const std::string& Initializer, + bool AddNull) { + return ConstantArray::get(Initializer, AddNull); +} + + +// ConstantExpr accessors. +Constant* LLVMContext::getConstantExpr(unsigned Opcode, Constant* C1, + Constant* C2) { + return ConstantExpr::get(Opcode, C1, C2); +} + +Constant* LLVMContext::getConstantExprTrunc(Constant* C, const Type* Ty) { + return ConstantExpr::getTrunc(C, Ty); +} + +Constant* LLVMContext::getConstantExprSExt(Constant* C, const Type* Ty) { + return ConstantExpr::getSExt(C, Ty); +} + +Constant* LLVMContext::getConstantExprZExt(Constant* C, const Type* Ty) { + return ConstantExpr::getZExt(C, Ty); +} + +Constant* LLVMContext::getConstantExprFPTrunc(Constant* C, const Type* Ty) { + return ConstantExpr::getFPTrunc(C, Ty); +} + +Constant* LLVMContext::getConstantExprFPExtend(Constant* C, const Type* Ty) { + return ConstantExpr::getFPExtend(C, Ty); +} + +Constant* LLVMContext::getConstantExprUIToFP(Constant* C, const Type* Ty) { + return ConstantExpr::getUIToFP(C, Ty); +} + +Constant* LLVMContext::getConstantExprSIToFP(Constant* C, const Type* Ty) { + return ConstantExpr::getSIToFP(C, Ty); +} + +Constant* LLVMContext::getConstantExprFPToUI(Constant* C, const Type* Ty) { + return ConstantExpr::getFPToUI(C, Ty); +} + +Constant* LLVMContext::getConstantExprFPToSI(Constant* C, const Type* Ty) { + return ConstantExpr::getFPToSI(C, Ty); +} + +Constant* LLVMContext::getConstantExprPtrToInt(Constant* C, const Type* Ty) { + return ConstantExpr::getPtrToInt(C, Ty); +} + +Constant* LLVMContext::getConstantExprIntToPtr(Constant* C, const Type* Ty) { + return ConstantExpr::getIntToPtr(C, Ty); +} + +Constant* LLVMContext::getConstantExprBitCast(Constant* C, const Type* Ty) { + return ConstantExpr::getBitCast(C, Ty); +} + +Constant* LLVMContext::getConstantExprCast(unsigned ops, Constant* C, + const Type* Ty) { + return ConstantExpr::getCast(ops, C, Ty); +} + +Constant* LLVMContext::getConstantExprZExtOrBitCast(Constant* C, + const Type* Ty) { + return ConstantExpr::getZExtOrBitCast(C, Ty); +} + +Constant* LLVMContext::getConstantExprSExtOrBitCast(Constant* C, + const Type* Ty) { + return ConstantExpr::getSExtOrBitCast(C, Ty); +} + +Constant* LLVMContext::getConstantExprTruncOrBitCast(Constant* C, + const Type* Ty) { + return ConstantExpr::getTruncOrBitCast(C, Ty); +} + +Constant* LLVMContext::getConstantExprPointerCast(Constant* C, const Type* Ty) { + return ConstantExpr::getPointerCast(C, Ty); +} + +Constant* LLVMContext::getConstantExprIntegerCast(Constant* C, const Type* Ty, + bool isSigned) { + return ConstantExpr::getIntegerCast(C, Ty, isSigned); +} + +Constant* LLVMContext::getConstantExprFPCast(Constant* C, const Type* Ty) { + return ConstantExpr::getFPCast(C, Ty); +} + +Constant* LLVMContext::getConstantExprSelect(Constant* C, Constant* V1, + Constant* V2) { + return ConstantExpr::getSelect(C, V1, V2); +} + +Constant* LLVMContext::getConstantExprAlignOf(const Type* Ty) { + return ConstantExpr::getAlignOf(Ty); +} + +Constant* LLVMContext::getConstantExprCompare(unsigned short pred, + Constant* C1, Constant* C2) { + return ConstantExpr::getCompare(pred, C1, C2); +} + +Constant* LLVMContext::getConstantExprNeg(Constant* C) { + return ConstantExpr::getNeg(C); +} + +Constant* LLVMContext::getConstantExprFNeg(Constant* C) { + return ConstantExpr::getFNeg(C); +} + +Constant* LLVMContext::getConstantExprNot(Constant* C) { + return ConstantExpr::getNot(C); +} + +Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) { + return ConstantExpr::getAdd(C1, C2); +} + +Constant* LLVMContext::getConstantExprFAdd(Constant* C1, Constant* C2) { + return ConstantExpr::getFAdd(C1, C2); +} + +Constant* LLVMContext::getConstantExprSub(Constant* C1, Constant* C2) { + return ConstantExpr::getSub(C1, C2); +} + +Constant* LLVMContext::getConstantExprFSub(Constant* C1, Constant* C2) { + return ConstantExpr::getFSub(C1, C2); +} + +Constant* LLVMContext::getConstantExprMul(Constant* C1, Constant* C2) { + return ConstantExpr::getMul(C1, C2); +} + +Constant* LLVMContext::getConstantExprFMul(Constant* C1, Constant* C2) { + return ConstantExpr::getFMul(C1, C2); +} + +Constant* LLVMContext::getConstantExprUDiv(Constant* C1, Constant* C2) { + return ConstantExpr::getUDiv(C1, C2); +} + +Constant* LLVMContext::getConstantExprSDiv(Constant* C1, Constant* C2) { + return ConstantExpr::getSDiv(C1, C2); +} + +Constant* LLVMContext::getConstantExprFDiv(Constant* C1, Constant* C2) { + return ConstantExpr::getFDiv(C1, C2); +} + +Constant* LLVMContext::getConstantExprURem(Constant* C1, Constant* C2) { + return ConstantExpr::getURem(C1, C2); +} + +Constant* LLVMContext::getConstantExprSRem(Constant* C1, Constant* C2) { + return ConstantExpr::getSRem(C1, C2); +} + +Constant* LLVMContext::getConstantExprFRem(Constant* C1, Constant* C2) { + return ConstantExpr::getFRem(C1, C2); +} + +Constant* LLVMContext::getConstantExprAnd(Constant* C1, Constant* C2) { + return ConstantExpr::getAnd(C1, C2); +} + +Constant* LLVMContext::getConstantExprOr(Constant* C1, Constant* C2) { + return ConstantExpr::getOr(C1, C2); +} + +Constant* LLVMContext::getConstantExprXor(Constant* C1, Constant* C2) { + return ConstantExpr::getXor(C1, C2); +} + +Constant* LLVMContext::getConstantExprICmp(unsigned short pred, Constant* LHS, + Constant* RHS) { + return ConstantExpr::getICmp(pred, LHS, RHS); +} + +Constant* LLVMContext::getConstantExprFCmp(unsigned short pred, Constant* LHS, + Constant* RHS) { + return ConstantExpr::getFCmp(pred, LHS, RHS); +} + +Constant* LLVMContext::getConstantExprVICmp(unsigned short pred, Constant* LHS, + Constant* RHS) { + return ConstantExpr::getVICmp(pred, LHS, RHS); +} + +Constant* LLVMContext::getConstantExprVFCmp(unsigned short pred, Constant* LHS, + Constant* RHS) { + return ConstantExpr::getVFCmp(pred, LHS, RHS); +} + +Constant* LLVMContext::getConstantExprShl(Constant* C1, Constant* C2) { + return ConstantExpr::getShl(C1, C2); +} + +Constant* LLVMContext::getConstantExprLShr(Constant* C1, Constant* C2) { + return ConstantExpr::getLShr(C1, C2); +} + +Constant* LLVMContext::getConstantExprAShr(Constant* C1, Constant* C2) { + return ConstantExpr::getAShr(C1, C2); +} + +Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, + Constant* const* IdxList, + unsigned NumIdx) { + return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); +} + +Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, + Value* const* IdxList, + unsigned NumIdx) { + return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); +} + +Constant* LLVMContext::getConstantExprExtractElement(Constant* Vec, + Constant* Idx) { + return ConstantExpr::getExtractElement(Vec, Idx); +} + +Constant* LLVMContext::getConstantExprInsertElement(Constant* Vec, + Constant* Elt, + Constant* Idx) { + return ConstantExpr::getInsertElement(Vec, Elt, Idx); +} + +Constant* LLVMContext::getConstantExprShuffleVector(Constant* V1, Constant* V2, + Constant* Mask) { + return ConstantExpr::getShuffleVector(V1, V2, Mask); +} + +Constant* LLVMContext::getConstantExprExtractValue(Constant* Agg, + const unsigned* IdxList, + unsigned NumIdx) { + return ConstantExpr::getExtractValue(Agg, IdxList, NumIdx); +} + +Constant* LLVMContext::getConstantExprInsertValue(Constant* Agg, Constant* Val, + const unsigned* IdxList, + unsigned NumIdx) { + return ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx); +} + +Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) { + return ConstantExpr::getZeroValueForNegationExpr(Ty); +} + + +// ConstantFP accessors. +ConstantFP* LLVMContext::getConstantFP(const APFloat& V) { + return ConstantFP::get(V); +} + +Constant* LLVMContext::getConstantFP(const Type* Ty, double V) { + return ConstantFP::get(Ty, V); +} + +ConstantFP* LLVMContext::getConstantFPNegativeZero(const Type* Ty) { + return ConstantFP::getNegativeZero(Ty); +} + + +// ConstantVector accessors. +Constant* LLVMContext::getConstantVector(const VectorType* T, + const std::vector& V) { + return ConstantVector::get(T, V); +} + +Constant* LLVMContext::getConstantVector(const std::vector& V) { + return ConstantVector::get(V); +} + +Constant* LLVMContext::getConstantVector(Constant* const* Vals, + unsigned NumVals) { + return ConstantVector::get(Vals, NumVals); +} + +ConstantVector* LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) { + return ConstantVector::getAllOnesValue(Ty); +} Added: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=74488&view=auto ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (added) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Jun 29 19:48:55 2009 @@ -0,0 +1,20 @@ +//===-- llvm/SymbolTableListTraitsImpl.h - Implementation ------*- C++ -*--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LLVMCONTEXT_IMPL_H +#define LLVM_LLVMCONTEXT_IMPL_H + +namespace llvm { +class LLVMContextImpl { + +}; + +} + +#endif \ No newline at end of file From daniel at zuster.org Mon Jun 29 19:49:23 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 00:49:23 -0000 Subject: [llvm-commits] [llvm] r74489 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/Support/SourceMgr.cpp tools/llvm-mc/AsmLexer.cpp tools/llvm-mc/AsmLexer.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h tools/llvm-mc/llvm-mc.cpp utils/TableGen/TGLexer.cpp utils/TableGen/TableGen.cpp Message-ID: <200906300049.n5U0nNR8007496@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 19:49:23 2009 New Revision: 74489 URL: http://llvm.org/viewvc/llvm-project?rev=74489&view=rev Log: Normalize SourceMgr messages. - Don't print "Parsing" in front of every message. - Take additional "type" argument which is prepended to the message (with ": ") if given. - Update clients to print errors (warnings) as: :: error(warning): ... Modified: llvm/trunk/include/llvm/Support/SourceMgr.h llvm/trunk/lib/Support/SourceMgr.cpp llvm/trunk/tools/llvm-mc/AsmLexer.cpp llvm/trunk/tools/llvm-mc/AsmLexer.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/llvm-mc.cpp llvm/trunk/utils/TableGen/TGLexer.cpp llvm/trunk/utils/TableGen/TableGen.cpp Modified: llvm/trunk/include/llvm/Support/SourceMgr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/SourceMgr.h (original) +++ llvm/trunk/include/llvm/Support/SourceMgr.h Mon Jun 29 19:49:23 2009 @@ -111,7 +111,10 @@ /// PrintMessage - Emit a message about the specified location with the /// specified string. - void PrintMessage(SMLoc Loc, const std::string &Msg) const; + /// + /// @param Type - If non-null, the kind of message (e.g., "error") which is + /// prefixed to the message. + void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const; private: void PrintIncludeStack(SMLoc IncludeLoc) const; Modified: llvm/trunk/lib/Support/SourceMgr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/lib/Support/SourceMgr.cpp (original) +++ llvm/trunk/lib/Support/SourceMgr.cpp Mon Jun 29 19:49:23 2009 @@ -90,7 +90,8 @@ } -void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg) const { +void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg, + const char *Type) const { raw_ostream &OS = errs(); // First thing to do: find the current buffer containing the specified @@ -103,9 +104,12 @@ MemoryBuffer *CurMB = getBufferInfo(CurBuf).Buffer; - OS << "Parsing " << CurMB->getBufferIdentifier() << ":" + OS << CurMB->getBufferIdentifier() << ":" << FindLineNumber(Loc, CurBuf) << ": "; - + + if (Type) + OS << Type << ": "; + OS << Msg << "\n"; // Scan backward to find the start of the line. Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Mon Jun 29 19:49:23 2009 @@ -42,14 +42,15 @@ return SMLoc::getFromPointer(TokStart); } -void AsmLexer::PrintMessage(SMLoc Loc, const std::string &Msg) const { - SrcMgr.PrintMessage(Loc, Msg); +void AsmLexer::PrintMessage(SMLoc Loc, const std::string &Msg, + const char *Type) const { + SrcMgr.PrintMessage(Loc, Msg, Type); } /// ReturnError - Set the error to the specified string at the specified /// location. This is defined to always return asmtok::Error. asmtok::TokKind AsmLexer::ReturnError(const char *Loc, const std::string &Msg) { - SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg); + SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error"); return asmtok::Error; } Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Mon Jun 29 19:49:23 2009 @@ -97,7 +97,7 @@ SMLoc getLoc() const; - void PrintMessage(SMLoc Loc, const std::string &Msg) const; + void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const; private: int getNextChar(); Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 29 19:49:23 2009 @@ -22,13 +22,17 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; +void AsmParser::Warning(SMLoc L, const char *Msg) { + Lexer.PrintMessage(L, Msg, "warning"); +} + bool AsmParser::Error(SMLoc L, const char *Msg) { - Lexer.PrintMessage(L, Msg); + Lexer.PrintMessage(L, Msg, "error"); return true; } bool AsmParser::TokError(const char *Msg) { - Lexer.PrintMessage(Lexer.getLoc(), Msg); + Lexer.PrintMessage(Lexer.getLoc(), Msg, "error"); return true; } @@ -482,7 +486,7 @@ if (!strcmp(IDVal, ".weak_reference")) return ParseDirectiveSymbolAttribute(MCStreamer::WeakReference); - Lexer.PrintMessage(IDLoc, "warning: ignoring directive for now"); + Warning(IDLoc, "ignoring directive for now"); EatToEndOfStatement(); return false; } @@ -810,14 +814,14 @@ // Diagnose non-sensical max bytes to fill. if (MaxBytesLoc.isValid()) { if (MaxBytesToFill < 1) { - Lexer.PrintMessage(MaxBytesLoc, "warning: alignment directive can never " - "be satisfied in this many bytes, ignoring"); + Warning(MaxBytesLoc, "alignment directive can never be satisfied in this " + "many bytes, ignoring"); return false; } if (MaxBytesToFill >= Alignment) { - Lexer.PrintMessage(MaxBytesLoc, "warning: maximum bytes expression " - "exceeds alignment and has no effect"); + Warning(MaxBytesLoc, "maximum bytes expression exceeds alignment and " + "has no effect"); MaxBytesToFill = 0; } } Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jun 29 19:49:23 2009 @@ -39,7 +39,8 @@ private: bool ParseStatement(); - + + void Warning(SMLoc L, const char *Msg); bool Error(SMLoc L, const char *Msg); bool TokError(const char *Msg); Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Mon Jun 29 19:49:23 2009 @@ -80,7 +80,7 @@ while (Tok != asmtok::Eof) { switch (Tok) { default: - Lexer.PrintMessage(Lexer.getLoc(), "driver: unknown token"); + Lexer.PrintMessage(Lexer.getLoc(), "unknown token", "warning"); Error = true; break; case asmtok::Error: Modified: llvm/trunk/utils/TableGen/TGLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.cpp (original) +++ llvm/trunk/utils/TableGen/TGLexer.cpp Mon Jun 29 19:49:23 2009 @@ -44,11 +44,11 @@ void TGLexer::PrintError(const char *Loc, const std::string &Msg) const { - SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg); + SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error"); } void TGLexer::PrintError(SMLoc Loc, const std::string &Msg) const { - SrcMgr.PrintMessage(Loc, Msg); + SrcMgr.PrintMessage(Loc, Msg, "error"); } Modified: llvm/trunk/utils/TableGen/TableGen.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=74489&r1=74488&r2=74489&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TableGen.cpp (original) +++ llvm/trunk/utils/TableGen/TableGen.cpp Mon Jun 29 19:49:23 2009 @@ -127,7 +127,7 @@ static SourceMgr SrcMgr; void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) { - SrcMgr.PrintMessage(ErrorLoc, Msg); + SrcMgr.PrintMessage(ErrorLoc, Msg, "error"); } From david_goodwin at apple.com Mon Jun 29 20:02:21 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 30 Jun 2009 01:02:21 -0000 Subject: [llvm-commits] [llvm] r74490 - in /llvm/trunk/test/CodeGen/Thumb2: thumb2-add5.ll thumb2-and.ll thumb2-bic.ll thumb2-cmn.ll thumb2-cmp.ll thumb2-cmp2.ll thumb2-eor.ll thumb2-mvn2.ll thumb2-orn.ll thumb2-orr.ll thumb2-rsb.ll thumb2-sub4.ll thumb2-teq2.ll thumb2-tst2.ll Message-ID: <200906300102.n5U12L6H007895@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Jun 29 20:02:20 2009 New Revision: 74490 URL: http://llvm.org/viewvc/llvm-project?rev=74490&view=rev Log: Enhance tests to include shifted-register operand testing. Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll Mon Jun 29 20:02:20 2009 @@ -1,6 +1,36 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = add i32 %a, %b ret i32 %tmp } + +define i32 @f2(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = add i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f3(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = add i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f4(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = add i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f5(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = add i32 %a, %tmp + ret i32 %tmp1 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll Mon Jun 29 20:02:20 2009 @@ -1,6 +1,36 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = and i32 %a, %b ret i32 %tmp } + +define i32 @f2(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = and i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f3(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = and i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f4(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = and i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f5(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = and i32 %a, %tmp + ret i32 %tmp1 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll Mon Jun 29 20:02:20 2009 @@ -1,4 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = xor i32 %b, 4294967295 @@ -23,3 +27,33 @@ %tmp1 = and i32 %tmp, %a ret i32 %tmp1 } + +define i32 @f5(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = xor i32 4294967295, %tmp + %tmp2 = and i32 %a, %tmp1 + ret i32 %tmp2 +} + +define i32 @f6(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = xor i32 %tmp, 4294967295 + %tmp2 = and i32 %tmp1, %a + ret i32 %tmp2 +} + +define i32 @f7(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = xor i32 %tmp, 4294967295 + %tmp2 = and i32 %a, %tmp1 + ret i32 %tmp2 +} + +define i32 @f8(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = xor i32 4294967295, %tmp + %tmp2 = and i32 %tmp1, %a + ret i32 %tmp2 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll Mon Jun 29 20:02:20 2009 @@ -1,4 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\]} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i1 @f1(i32 %a, i32 %b) { %nb = sub i32 0, %b @@ -23,3 +27,33 @@ %tmp = icmp eq i32 %nb, %a ret i1 %tmp } + +define i1 @f5(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %nb = sub i32 0, %tmp + %tmp1 = icmp eq i32 %nb, %a + ret i1 %tmp1 +} + +define i1 @f6(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %nb = sub i32 0, %tmp + %tmp1 = icmp ne i32 %nb, %a + ret i1 %tmp1 +} + +define i1 @f7(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %nb = sub i32 0, %tmp + %tmp1 = icmp eq i32 %a, %nb + ret i1 %tmp1 +} + +define i1 @f8(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %nb = sub i32 0, %tmp + %tmp1 = icmp ne i32 %a, %nb + ret i1 %tmp1 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll Mon Jun 29 20:02:20 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "cmp " | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*#\[0-9\]*$} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 5 ; 0x000000bb = 187 define i1 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll Mon Jun 29 20:02:20 2009 @@ -1,4 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\]} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\]$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i1 @f1(i32 %a, i32 %b) { %tmp = icmp ne i32 %a, %b @@ -9,3 +13,29 @@ %tmp = icmp eq i32 %a, %b ret i1 %tmp } + +define i1 @f6(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = icmp eq i32 %tmp, %a + ret i1 %tmp1 +} + +define i1 @f7(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = icmp ne i32 %tmp, %a + ret i1 %tmp1 +} + +define i1 @f8(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = icmp eq i32 %a, %tmp + ret i1 %tmp1 +} + +define i1 @f9(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = icmp ne i32 %a, %tmp + ret i1 %tmp1 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll Mon Jun 29 20:02:20 2009 @@ -1,6 +1,41 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = xor i32 %a, %b ret i32 %tmp } + +define i32 @f2(i32 %a, i32 %b) { + %tmp = xor i32 %b, %a + ret i32 %tmp +} + +define i32 @f3(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = xor i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f4(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = xor i32 %tmp, %a + ret i32 %tmp1 +} + +define i32 @f5(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = xor i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f6(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = xor i32 %tmp, %a + ret i32 %tmp1 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll Mon Jun 29 20:02:20 2009 @@ -1,4 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a) { %tmp = xor i32 4294967295, %a @@ -9,3 +13,29 @@ %tmp = xor i32 %a, 4294967295 ret i32 %tmp } + +define i32 @f5(i32 %a) { + %tmp = shl i32 %a, 5 + %tmp1 = xor i32 %tmp, 4294967295 + ret i32 %tmp1 +} + +define i32 @f6(i32 %a) { + %tmp = lshr i32 %a, 6 + %tmp1 = xor i32 %tmp, 4294967295 + ret i32 %tmp1 +} + +define i32 @f7(i32 %a) { + %tmp = ashr i32 %a, 7 + %tmp1 = xor i32 %tmp, 4294967295 + ret i32 %tmp1 +} + +define i32 @f8(i32 %a) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = xor i32 %tmp, 4294967295 + ret i32 %tmp1 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll Mon Jun 29 20:02:20 2009 @@ -1,4 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = xor i32 %b, 4294967295 @@ -23,3 +27,33 @@ %tmp1 = or i32 %tmp, %a ret i32 %tmp1 } + +define i32 @f5(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = xor i32 4294967295, %tmp + %tmp2 = or i32 %a, %tmp1 + ret i32 %tmp2 +} + +define i32 @f6(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = xor i32 4294967295, %tmp + %tmp2 = or i32 %a, %tmp1 + ret i32 %tmp2 +} + +define i32 @f7(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = xor i32 4294967295, %tmp + %tmp2 = or i32 %a, %tmp1 + ret i32 %tmp2 +} + +define i32 @f8(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = xor i32 4294967295, %tmp + %tmp2 = or i32 %a, %tmp1 + ret i32 %tmp2 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll Mon Jun 29 20:02:20 2009 @@ -1,6 +1,36 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp2 = or i32 %a, %b ret i32 %tmp2 } + +define i32 @f5(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp2 = or i32 %a, %tmp + ret i32 %tmp2 +} + +define i32 @f6(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp2 = or i32 %a, %tmp + ret i32 %tmp2 +} + +define i32 @f7(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp2 = or i32 %a, %tmp + ret i32 %tmp2 +} + +define i32 @f8(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp2 = or i32 %a, %tmp + ret i32 %tmp2 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb.ll Mon Jun 29 20:02:20 2009 @@ -1,9 +1,30 @@ -; XFAIL: * -; this will match as "sub" until we get register shifting +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]*} | count 1 +define i32 @f2(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = sub i32 %tmp, %a + ret i32 %tmp1 +} + +define i32 @f3(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = sub i32 %tmp, %a + ret i32 %tmp1 +} + +define i32 @f4(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = sub i32 %tmp, %a + ret i32 %tmp1 +} -define i32 @f1(i32 %a, i32 %b) { - %tmp = sub i32 %b, %a - ret i32 %tmp +define i32 @f5(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = sub i32 %tmp, %a + ret i32 %tmp1 } Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll Mon Jun 29 20:02:20 2009 @@ -1,6 +1,36 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = sub i32 %a, %b ret i32 %tmp } + +define i32 @f2(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = sub i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f3(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = sub i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f4(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = sub i32 %a, %tmp + ret i32 %tmp1 +} + +define i32 @f5(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = sub i32 %a, %tmp + ret i32 %tmp1 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll Mon Jun 29 20:02:20 2009 @@ -1,4 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\]} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i1 @f1(i32 %a, i32 %b) { %tmp = xor i32 %a, %b @@ -23,3 +27,33 @@ %tmp1 = icmp eq i32 0, %tmp ret i1 %tmp1 } + +define i1 @f6(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = xor i32 %a, %tmp + %tmp2 = icmp eq i32 %tmp1, 0 + ret i1 %tmp2 +} + +define i1 @f7(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = xor i32 %a, %tmp + %tmp2 = icmp eq i32 %tmp1, 0 + ret i1 %tmp2 +} + +define i1 @f8(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = xor i32 %a, %tmp + %tmp2 = icmp eq i32 %tmp1, 0 + ret i1 %tmp2 +} + +define i1 @f9(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = xor i32 %a, %tmp + %tmp2 = icmp eq i32 %tmp1, 0 + ret i1 %tmp2 +} Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll?rev=74490&r1=74489&r2=74490&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll Mon Jun 29 20:02:20 2009 @@ -1,4 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\]} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i1 @f1(i32 %a, i32 %b) { %tmp = and i32 %a, %b @@ -23,3 +27,33 @@ %tmp1 = icmp eq i32 0, %tmp ret i1 %tmp1 } + +define i1 @f6(i32 %a, i32 %b) { + %tmp = shl i32 %b, 5 + %tmp1 = and i32 %a, %tmp + %tmp2 = icmp eq i32 %tmp1, 0 + ret i1 %tmp2 +} + +define i1 @f7(i32 %a, i32 %b) { + %tmp = lshr i32 %b, 6 + %tmp1 = and i32 %a, %tmp + %tmp2 = icmp eq i32 %tmp1, 0 + ret i1 %tmp2 +} + +define i1 @f8(i32 %a, i32 %b) { + %tmp = ashr i32 %b, 7 + %tmp1 = and i32 %a, %tmp + %tmp2 = icmp eq i32 %tmp1, 0 + ret i1 %tmp2 +} + +define i1 @f9(i32 %a, i32 %b) { + %l8 = shl i32 %a, 24 + %r8 = lshr i32 %a, 8 + %tmp = or i32 %l8, %r8 + %tmp1 = and i32 %a, %tmp + %tmp2 = icmp eq i32 %tmp1, 0 + ret i1 %tmp2 +} From gohman at apple.com Mon Jun 29 20:24:43 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Jun 2009 01:24:43 -0000 Subject: [llvm-commits] [llvm] r74491 - /llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <200906300124.n5U1OhcL008566@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 29 20:24:43 2009 New Revision: 74491 URL: http://llvm.org/viewvc/llvm-project?rev=74491&view=rev Log: Minor code simplification. Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=74491&r1=74490&r2=74491&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Mon Jun 29 20:24:43 2009 @@ -282,10 +282,9 @@ // Attempt to hoist out all instructions except for the // comparison and the branch. bool AllInvariant = true; - for (BasicBlock::iterator I = ExitingBlock->begin(), - E = ExitingBlock->end(); I != E; ) { + for (BasicBlock::iterator I = ExitingBlock->begin(); &*I != BI; ) { Instruction *Inst = I++; - if (Inst == BI || Inst == CI) + if (Inst == CI) continue; if (Inst->isTrapping()) { AllInvariant = false; From gohman at apple.com Mon Jun 29 20:25:30 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Jun 2009 01:25:30 -0000 Subject: [llvm-commits] [llvm] r74492 - /llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Message-ID: <200906300125.n5U1PVLY008598@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 29 20:25:30 2009 New Revision: 74492 URL: http://llvm.org/viewvc/llvm-project?rev=74492&view=rev Log: Minor formatting, whitespace, and 80-column fixes. Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=74492&r1=74491&r2=74492&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Mon Jun 29 20:25:30 2009 @@ -185,8 +185,9 @@ if (const SCEVMulExpr *M = dyn_cast(S)) if (const SCEVConstant *C = dyn_cast(M->getOperand(0))) if (!C->getValue()->getValue().srem(Factor)) { - const SmallVectorImpl &MOperands = M->getOperands(); - SmallVector NewMulOps(MOperands.begin(), MOperands.end()); + const SmallVectorImpl &MOperands = M->getOperands(); + SmallVector NewMulOps(MOperands.begin(), + MOperands.end()); NewMulOps[0] = SE.getConstant(C->getValue()->getValue().sdiv(Factor)); S = SE.getMulExpr(NewMulOps); @@ -368,8 +369,7 @@ if (SE.TD) if (const PointerType *PTy = dyn_cast(V->getType())) { const SmallVectorImpl &Ops = S->getOperands(); - return expandAddToGEP(&Ops[0], &Ops[Ops.size() - 1], - PTy, Ty, V); + return expandAddToGEP(&Ops[0], &Ops[Ops.size() - 1], PTy, Ty, V); } V = InsertNoopCastOfTo(V, Ty); @@ -457,10 +457,10 @@ if (CanonicalIV && SE.getTypeSizeInBits(CanonicalIV->getType()) > SE.getTypeSizeInBits(Ty)) { - const SCEV* Start = SE.getAnyExtendExpr(S->getStart(), + const SCEV *Start = SE.getAnyExtendExpr(S->getStart(), + CanonicalIV->getType()); + const SCEV *Step = SE.getAnyExtendExpr(S->getStepRecurrence(SE), CanonicalIV->getType()); - const SCEV* Step = SE.getAnyExtendExpr(S->getStepRecurrence(SE), - CanonicalIV->getType()); Value *V = expand(SE.getAddRecExpr(Start, Step, S->getLoop())); BasicBlock *SaveInsertBB = Builder.GetInsertBlock(); BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint(); From gohman at apple.com Mon Jun 29 20:28:08 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Jun 2009 01:28:08 -0000 Subject: [llvm-commits] [llvm] r74494 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp Message-ID: <200906300128.n5U1S8xn008718@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 29 20:28:08 2009 New Revision: 74494 URL: http://llvm.org/viewvc/llvm-project?rev=74494&view=rev Log: Define an operator<< for APInt to be used with std::ostream. This will allow it to be used in unittests that use gtest's EXPECT_EQ. Modified: llvm/trunk/include/llvm/ADT/APInt.h llvm/trunk/lib/Support/APInt.cpp Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=74494&r1=74493&r2=74494&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Mon Jun 29 20:28:08 2009 @@ -1426,6 +1426,8 @@ return OS; } +std::ostream &operator<<(std::ostream &o, const APInt &I); + namespace APIntOps { /// @brief Determine the smaller of two APInts considered to be signed. Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=74494&r1=74493&r2=74494&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Mon Jun 29 20:28:08 2009 @@ -2178,6 +2178,12 @@ OS << S.c_str(); } +std::ostream &operator<<(std::ostream &o, const APInt &I) { + raw_os_ostream OS(o); + OS << I; + return o; +} + // This implements a variety of operations on a representation of // arbitrary precision, two's-complement, bignum integer values. From gohman at apple.com Mon Jun 29 20:29:09 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Jun 2009 01:29:09 -0000 Subject: [llvm-commits] [llvm] r74495 - /llvm/trunk/include/llvm/CodeGen/ValueTypes.h Message-ID: <200906300129.n5U1T9tb008759@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 29 20:29:09 2009 New Revision: 74495 URL: http://llvm.org/viewvc/llvm-project?rev=74495&view=rev Log: Delete a spurious blank line at the top of the file. Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=74495&r1=74494&r2=74495&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original) +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Mon Jun 29 20:29:09 2009 @@ -1,4 +1,3 @@ - //===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===// // // The LLVM Compiler Infrastructure From daniel at zuster.org Mon Jun 29 20:49:52 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 01:49:52 -0000 Subject: [llvm-commits] [llvm] r74496 - in /llvm/trunk: include/llvm/MC/MCSymbol.h include/llvm/MC/MCValue.h tools/llvm-mc/AsmExpr.cpp tools/llvm-mc/AsmExpr.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h Message-ID: <200906300149.n5U1nqPK009394@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 20:49:52 2009 New Revision: 74496 URL: http://llvm.org/viewvc/llvm-project?rev=74496&view=rev Log: llvm-mc: Evaluation for relocatable expressions. Modified: llvm/trunk/include/llvm/MC/MCSymbol.h llvm/trunk/include/llvm/MC/MCValue.h llvm/trunk/tools/llvm-mc/AsmExpr.cpp llvm/trunk/tools/llvm-mc/AsmExpr.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCSymbol.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=74496&r1=74495&r2=74496&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) +++ llvm/trunk/include/llvm/MC/MCSymbol.h Mon Jun 29 20:49:52 2009 @@ -13,6 +13,8 @@ #include namespace llvm { + class MCSection; + class MCSymbol { MCSection *Section; std::string Name; Modified: llvm/trunk/include/llvm/MC/MCValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCValue.h?rev=74496&r1=74495&r2=74496&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCValue.h (original) +++ llvm/trunk/include/llvm/MC/MCValue.h Mon Jun 29 20:49:52 2009 @@ -15,6 +15,8 @@ #define LLVM_MC_MCVALUE_H #include "llvm/Support/DataTypes.h" +#include "llvm/MC/MCSymbol.h" +#include namespace llvm { class MCSymbol; @@ -23,6 +25,9 @@ /// form, this can hold "SymbolA - SymbolB + imm64". Not all targets supports /// relocations of this general form, but we need to represent this anyway. /// +/// In the general form, SymbolB can only be defined if SymbolA is, and both +/// must be in the same (non-external) section. +/// /// Note that this class must remain a simple POD value class, because we need /// it to live in unions etc. class MCValue { @@ -35,9 +40,21 @@ MCSymbol *getSymB() const { return SymB; } bool isConstant() const { return !SymA && !SymB; } - + + /// getAssociatedSection - For relocatable values, return the section the + /// value is associated with. + /// + /// @result - The value's associated section, or null for external or constant + /// values. + MCSection *getAssociatedSection() const { + return SymA ? SymA->getSection() : 0; + } + static MCValue get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) { MCValue R; + assert((!SymB || (SymA && SymA->getSection() && + SymA->getSection() == SymB->getSection())) && + "Invalid relocatable MCValue!"); R.Cst = Val; R.SymA = SymA; R.SymB = SymB; Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=74496&r1=74495&r2=74496&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Mon Jun 29 20:49:52 2009 @@ -9,6 +9,7 @@ #include "AsmExpr.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" using namespace llvm; @@ -16,38 +17,61 @@ } bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { + MCValue Value; + + if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isConstant()) + return false; + + Res = Value.getConstant(); + return true; +} + +bool AsmExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { switch (getKind()) { default: assert(0 && "Invalid assembly expression kind!"); case Constant: - Res = cast(this)->getValue(); + Res = MCValue::get(cast(this)->getValue()); return true; case SymbolRef: { MCSymbol *Sym = cast(this)->getSymbol(); - const MCValue *Value = Ctx.GetSymbolValue(Sym); - - // FIXME: Return more information about the failure. - if (!Value || !Value->isConstant()) - return false; - - Res = Value->getConstant(); + if (const MCValue *Value = Ctx.GetSymbolValue(Sym)) + Res = *Value; + else + Res = MCValue::get(Sym, 0, 0); return true; } case Unary: { const AsmUnaryExpr *AUE = cast(this); - int64_t Value; + MCValue Value; - if (!AUE->getSubExpr()->EvaluateAsAbsolute(Ctx, Value)) + if (!AUE->getSubExpr()->EvaluateAsRelocatable(Ctx, Value)) return false; switch (AUE->getOpcode()) { - case AsmUnaryExpr::LNot: Res = !Value; break; - case AsmUnaryExpr::Minus: Res = -Value; break; - case AsmUnaryExpr::Not: Res = ~Value; break; - case AsmUnaryExpr::Plus: Res = +Value; break; + case AsmUnaryExpr::LNot: + if (!Value.isConstant()) + return false; + Res = MCValue::get(!Value.getConstant()); + break; + case AsmUnaryExpr::Minus: + /// -(a - b + const) ==> (b - a - const) + if (Value.getSymA() && !Value.getSymA()) + return false; + Res = MCValue::get(Value.getSymB(), Value.getSymA(), + -Value.getConstant()); + break; + case AsmUnaryExpr::Not: + if (!Value.isConstant()) + return false; + Res = MCValue::get(~Value.getConstant()); + break; + case AsmUnaryExpr::Plus: + Res = Value; + break; } return true; @@ -55,36 +79,75 @@ case Binary: { const AsmBinaryExpr *ABE = cast(this); - int64_t LHS, RHS; + MCValue LHSValue, RHSValue; - if (!ABE->getLHS()->EvaluateAsAbsolute(Ctx, LHS) || - !ABE->getRHS()->EvaluateAsAbsolute(Ctx, RHS)) + if (!ABE->getLHS()->EvaluateAsRelocatable(Ctx, LHSValue) || + !ABE->getRHS()->EvaluateAsRelocatable(Ctx, RHSValue)) return false; + // We only support a few operations on non-constant expressions, handle + // those first. + if (!LHSValue.isConstant() || !RHSValue.isConstant()) { + switch (ABE->getOpcode()) { + default: + return false; + case AsmBinaryExpr::Sub: + // Negate RHS and fall through. + RHSValue = MCValue::get(RHSValue.getSymB(), RHSValue.getSymA(), + -RHSValue.getConstant()); + case AsmBinaryExpr::Add: + // (a_0 - b_0 + cst_0) + (a_1 - b_1 + cst_1) + + // We can't add or subtract two symbols. + if ((LHSValue.getSymA() && RHSValue.getSymB()) || + (LHSValue.getSymB() && RHSValue.getSymB())) + return false; + + MCSymbol *A = + LHSValue.getSymA() ? LHSValue.getSymA() : RHSValue.getSymA(); + MCSymbol *B = + LHSValue.getSymB() ? LHSValue.getSymB() : RHSValue.getSymB(); + if (B) { + // If we have a negated symbol, then we must have also have a + // non-negated symbol, and both symbols must be in the same + // non-external section. We can do this check later to permit + // expressions which eventually fold to a representable form -- such + // as (a + (0 - b)) -- if necessary. + if (!A || !A->getSection() || A->getSection() != B->getSection()) + return false; + } + Res = MCValue::get(A, B, + LHSValue.getConstant() + RHSValue.getConstant()); + return true; + } + } + // FIXME: We need target hooks for the evaluation. It may be limited in // width, and gas defines the result of comparisons differently from Apple // as (the result is sign extended). + int64_t Result, LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant(); switch (ABE->getOpcode()) { - case AsmBinaryExpr::Add: Res = LHS + RHS; break; - case AsmBinaryExpr::And: Res = LHS & RHS; break; - case AsmBinaryExpr::Div: Res = LHS / RHS; break; - case AsmBinaryExpr::EQ: Res = LHS == RHS; break; - case AsmBinaryExpr::GT: Res = LHS > RHS; break; - case AsmBinaryExpr::GTE: Res = LHS >= RHS; break; - case AsmBinaryExpr::LAnd: Res = LHS && RHS; break; - case AsmBinaryExpr::LOr: Res = LHS || RHS; break; - case AsmBinaryExpr::LT: Res = LHS < RHS; break; - case AsmBinaryExpr::LTE: Res = LHS <= RHS; break; - case AsmBinaryExpr::Mod: Res = LHS % RHS; break; - case AsmBinaryExpr::Mul: Res = LHS * RHS; break; - case AsmBinaryExpr::NE: Res = LHS != RHS; break; - case AsmBinaryExpr::Or: Res = LHS | RHS; break; - case AsmBinaryExpr::Shl: Res = LHS << RHS; break; - case AsmBinaryExpr::Shr: Res = LHS >> RHS; break; - case AsmBinaryExpr::Sub: Res = LHS - RHS; break; - case AsmBinaryExpr::Xor: Res = LHS ^ RHS; break; + case AsmBinaryExpr::Add: Result = LHS + RHS; break; + case AsmBinaryExpr::And: Result = LHS & RHS; break; + case AsmBinaryExpr::Div: Result = LHS / RHS; break; + case AsmBinaryExpr::EQ: Result = LHS == RHS; break; + case AsmBinaryExpr::GT: Result = LHS > RHS; break; + case AsmBinaryExpr::GTE: Result = LHS >= RHS; break; + case AsmBinaryExpr::LAnd: Result = LHS && RHS; break; + case AsmBinaryExpr::LOr: Result = LHS || RHS; break; + case AsmBinaryExpr::LT: Result = LHS < RHS; break; + case AsmBinaryExpr::LTE: Result = LHS <= RHS; break; + case AsmBinaryExpr::Mod: Result = LHS % RHS; break; + case AsmBinaryExpr::Mul: Result = LHS * RHS; break; + case AsmBinaryExpr::NE: Result = LHS != RHS; break; + case AsmBinaryExpr::Or: Result = LHS | RHS; break; + case AsmBinaryExpr::Shl: Result = LHS << RHS; break; + case AsmBinaryExpr::Shr: Result = LHS >> RHS; break; + case AsmBinaryExpr::Sub: Result = LHS - RHS; break; + case AsmBinaryExpr::Xor: Result = LHS ^ RHS; break; } + Res = MCValue::get(Result); return true; } } Modified: llvm/trunk/tools/llvm-mc/AsmExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.h?rev=74496&r1=74495&r2=74496&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.h (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.h Mon Jun 29 20:49:52 2009 @@ -16,6 +16,7 @@ namespace llvm { class MCContext; class MCSymbol; +class MCValue; class AsmExpr { public: @@ -39,10 +40,17 @@ /// EvaluateAsAbsolute - Try to evaluate the expression to an absolute value. /// - /// @param Res - The absolute value if evaluation succeeds. + /// @param Res - The absolute value, if evaluation succeeds. /// @result - True on success. bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; + /// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable + /// value. + /// + /// @param Res - The relocatable value, if evaluation succeeds. + /// @result - True on success. + bool EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const; + static bool classof(const AsmExpr *) { return true; } }; Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74496&r1=74495&r2=74496&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 29 20:49:52 2009 @@ -153,6 +153,18 @@ return false; } +bool AsmParser::ParseRelocatableExpression(MCValue &Res) { + AsmExpr *Expr; + + if (ParseExpression(Expr)) + return true; + + if (!Expr->EvaluateAsRelocatable(Ctx, Res)) + return TokError("expected relocatable expression"); + + return false; +} + static unsigned getBinOpPrecedence(asmtok::TokKind K, AsmBinaryExpr::Opcode &Kind) { switch (K) { Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=74496&r1=74495&r2=74496&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jun 29 20:49:52 2009 @@ -22,7 +22,8 @@ class MCContext; class MCInst; class MCStreamer; - +class MCValue; + class AsmParser { AsmLexer Lexer; MCContext &Ctx; @@ -53,15 +54,23 @@ /// @param Res - The resulting expression. The pointer value is null on error. /// @result - False on success. bool ParseExpression(AsmExpr *&Res); - - /// ParseAbsoluteExpr - Parse an expression which must evaluate to an absolute - /// value. + + /// ParseAbsoluteExpression - Parse an expression which must evaluate to an + /// absolute value. /// /// @param Res - The value of the absolute expression. The result is undefined /// on error. /// @result - False on success. bool ParseAbsoluteExpression(int64_t &Res); + /// ParseRelocatableExpression - Parse an expression which must be + /// relocatable. + /// + /// @param Res - The relocatable expression value. The result is undefined on + /// error. + /// @result - False on success. + bool ParseRelocatableExpression(MCValue &Res); + bool ParsePrimaryExpr(AsmExpr *&Res); bool ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res); bool ParseParenExpr(AsmExpr *&Res); From daniel at zuster.org Mon Jun 29 21:08:27 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 02:08:27 -0000 Subject: [llvm-commits] [llvm] r74497 - /llvm/trunk/tools/llvm-mc/AsmExpr.cpp Message-ID: <200906300208.n5U28RiM010039@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 21:08:27 2009 New Revision: 74497 URL: http://llvm.org/viewvc/llvm-project?rev=74497&view=rev Log: llvm-mc: Rewrite binary subtraction for relocatable expressions, we can't always legally negate an MCValue. Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=74497&r1=74496&r2=74497&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Mon Jun 29 21:08:27 2009 @@ -26,6 +26,29 @@ return true; } +static bool EvaluateSymbolicAdd(const MCValue &LHS, MCSymbol *RHS_A, + MCSymbol *RHS_B, int64_t RHS_Cst, + MCValue &Res) { + // We can't add or subtract two symbols. + if ((LHS.getSymA() && RHS_A) || + (LHS.getSymB() && RHS_B)) + return false; + + MCSymbol *A = LHS.getSymA() ? LHS.getSymA() : RHS_A; + MCSymbol *B = LHS.getSymB() ? LHS.getSymB() : RHS_B; + if (B) { + // If we have a negated symbol, then we must have also have a + // non-negated symbol, and both symbols must be in the same + // non-external section. We can do this check later to permit + // expressions which eventually fold to a representable form -- such + // as (a + (0 - b)) -- if necessary. + if (!A || !A->getSection() || A->getSection() != B->getSection()) + return false; + } + Res = MCValue::get(A, B, LHS.getConstant() + RHS_Cst); + return true; +} + bool AsmExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { switch (getKind()) { default: @@ -92,33 +115,17 @@ default: return false; case AsmBinaryExpr::Sub: - // Negate RHS and fall through. - RHSValue = MCValue::get(RHSValue.getSymB(), RHSValue.getSymA(), - -RHSValue.getConstant()); - case AsmBinaryExpr::Add: - // (a_0 - b_0 + cst_0) + (a_1 - b_1 + cst_1) + // Negate RHS and add. + return EvaluateSymbolicAdd(LHSValue, + RHSValue.getSymB(), RHSValue.getSymA(), + -RHSValue.getConstant(), + Res); - // We can't add or subtract two symbols. - if ((LHSValue.getSymA() && RHSValue.getSymB()) || - (LHSValue.getSymB() && RHSValue.getSymB())) - return false; - - MCSymbol *A = - LHSValue.getSymA() ? LHSValue.getSymA() : RHSValue.getSymA(); - MCSymbol *B = - LHSValue.getSymB() ? LHSValue.getSymB() : RHSValue.getSymB(); - if (B) { - // If we have a negated symbol, then we must have also have a - // non-negated symbol, and both symbols must be in the same - // non-external section. We can do this check later to permit - // expressions which eventually fold to a representable form -- such - // as (a + (0 - b)) -- if necessary. - if (!A || !A->getSection() || A->getSection() != B->getSection()) - return false; - } - Res = MCValue::get(A, B, - LHSValue.getConstant() + RHSValue.getConstant()); - return true; + case AsmBinaryExpr::Add: + return EvaluateSymbolicAdd(LHSValue, + RHSValue.getSymA(), RHSValue.getSymB(), + RHSValue.getConstant(), + Res); } } From daniel at zuster.org Mon Jun 29 21:10:03 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 02:10:03 -0000 Subject: [llvm-commits] [llvm] r74498 - in /llvm/trunk: test/MC/AsmParser/exprs.s tools/llvm-mc/AsmParser.cpp Message-ID: <200906300210.n5U2A30Y010150@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 29 21:10:03 2009 New Revision: 74498 URL: http://llvm.org/viewvc/llvm-project?rev=74498&view=rev Log: llvm-mc: Accept relocatable expressions for .org, assignments, .byte, etc. Modified: llvm/trunk/test/MC/AsmParser/exprs.s llvm/trunk/tools/llvm-mc/AsmParser.cpp Modified: llvm/trunk/test/MC/AsmParser/exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=74498&r1=74497&r2=74498&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/exprs.s (original) +++ llvm/trunk/test/MC/AsmParser/exprs.s Mon Jun 29 21:10:03 2009 @@ -3,7 +3,13 @@ // greps). // RUN: llvm-mc %s > %t - + + .text +g: +h: +j: +k: + .data .byte !1 + 2 .byte !0 .byte ~0 @@ -36,4 +42,14 @@ .set c, 10 .byte c + 1 + + d = e + 10 + .long d + + f = g - h + 5 + .long f + + i = (j + 10) - (k + 2) + .long i + \ No newline at end of file Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74498&r1=74497&r2=74498&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 29 21:10:03 2009 @@ -144,11 +144,12 @@ bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { AsmExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); if (ParseExpression(Expr)) return true; if (!Expr->EvaluateAsAbsolute(Ctx, Res)) - return TokError("expected absolute expression"); + return Error(StartLoc, "expected absolute expression"); return false; } @@ -156,11 +157,12 @@ bool AsmParser::ParseRelocatableExpression(MCValue &Res) { AsmExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); if (ParseExpression(Expr)) return true; if (!Expr->EvaluateAsRelocatable(Ctx, Res)) - return TokError("expected relocatable expression"); + return Error(StartLoc, "expected relocatable expression"); return false; } @@ -525,8 +527,8 @@ // FIXME: Use better location, we should use proper tokens. SMLoc EqualLoc = Lexer.getLoc(); - int64_t Value; - if (ParseAbsoluteExpression(Value)) + MCValue Value; + if (ParseRelocatableExpression(Value)) return true; if (Lexer.isNot(asmtok::EndOfStatement)) @@ -549,7 +551,7 @@ return Error(EqualLoc, "invalid assignment to external symbol"); // Do the assignment. - Out.EmitAssignment(Sym, MCValue::get(Value), IsDotSet); + Out.EmitAssignment(Sym, Value, IsDotSet); return false; } @@ -651,11 +653,11 @@ bool AsmParser::ParseDirectiveValue(unsigned Size) { if (Lexer.isNot(asmtok::EndOfStatement)) { for (;;) { - int64_t Expr; - if (ParseAbsoluteExpression(Expr)) + MCValue Expr; + if (ParseRelocatableExpression(Expr)) return true; - Out.EmitValue(MCValue::get(Expr), Size); + Out.EmitValue(Expr, Size); if (Lexer.is(asmtok::EndOfStatement)) break; @@ -746,8 +748,8 @@ /// ParseDirectiveOrg /// ::= .org expression [ , expression ] bool AsmParser::ParseDirectiveOrg() { - int64_t Offset; - if (ParseAbsoluteExpression(Offset)) + MCValue Offset; + if (ParseRelocatableExpression(Offset)) return true; // Parse optional fill expression. @@ -765,8 +767,10 @@ } Lexer.Lex(); - - Out.EmitValueToOffset(MCValue::get(Offset), FillExpr); + + // FIXME: Only limited forms of relocatable expressions are accepted here, it + // has to be relative to the current section. + Out.EmitValueToOffset(Offset, FillExpr); return false; } From andreas.bolka at gmx.net Mon Jun 29 21:11:02 2009 From: andreas.bolka at gmx.net (Andreas Bolka) Date: Tue, 30 Jun 2009 04:11:02 +0200 Subject: [llvm-commits] [llvm] r74451 - in /llvm/trunk: test/Analysis/LoopDependenceAnalysis/ unittests/ExecutionEngine/JIT/ In-Reply-To: <200906292041.n5TKfSrB030916@zion.cs.uiuc.edu> References: <200906292041.n5TKfSrB030916@zion.cs.uiuc.edu> Message-ID: <1246327761-sup-8433@strider> On Mon Jun 29 20:41:28 UTC 2009, Daniel Dunbar wrote: > Author: ddunbar > Date: Mon Jun 29 15:41:28 2009 > New Revision: 74451 > > URL: http://llvm.org/viewvc/llvm-project?rev=74451&view=rev > Log: > Set some svn:ignore props > > Modified: > llvm/trunk/test/Analysis/LoopDependenceAnalysis/ (props changed) > llvm/trunk/unittests/ExecutionEngine/JIT/ (props changed) Thanks! -- Andreas From a at bolka.at Mon Jun 29 21:12:11 2009 From: a at bolka.at (Andreas Bolka) Date: Tue, 30 Jun 2009 02:12:11 -0000 Subject: [llvm-commits] [llvm] r74499 - in /llvm/trunk: lib/Analysis/LoopDependenceAnalysis.cpp test/Analysis/LoopDependenceAnalysis/local-array.ll test/Analysis/LoopDependenceAnalysis/no-array.ll test/Analysis/LoopDependenceAnalysis/siv-strong1.ll test/Analysis/LoopDependenceAnalysis/siv-strong2.ll Message-ID: <200906300212.n5U2CBSE010249@zion.cs.uiuc.edu> Author: abolka Date: Mon Jun 29 21:12:10 2009 New Revision: 74499 URL: http://llvm.org/viewvc/llvm-project?rev=74499&view=rev Log: Array accesses are independent if the underlying arrays differ. Added: llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=74499&r1=74498&r2=74499&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Mon Jun 29 21:12:10 2009 @@ -22,6 +22,7 @@ #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Instructions.h" +#include "llvm/Support/Debug.h" using namespace llvm; LoopPass *llvm::createLoopDependenceAnalysisPass() { @@ -51,6 +52,20 @@ memrefs.push_back(i); } +static bool IsLoadOrStoreInst(Value *I) { + return isa(I) || isa(I); +} + +static Value *GetPointerOperand(Value *I) { + if (LoadInst *i = dyn_cast(I)) + return i->getPointerOperand(); + if (StoreInst *i = dyn_cast(I)) + return i->getPointerOperand(); + assert(0 && "Value is no load or store instruction!"); + // Never reached. + return 0; +} + //===----------------------------------------------------------------------===// // Dependence Testing //===----------------------------------------------------------------------===// @@ -65,6 +80,38 @@ bool LoopDependenceAnalysis::depends(Value *src, Value *dst) { assert(isDependencePair(src, dst) && "Values form no dependence pair!"); + DOUT << "== LDA test ==\n" << *src << *dst; + + // We only analyse loads and stores; for possible memory accesses by e.g. + // free, call, or invoke instructions we conservatively assume dependence. + if (!IsLoadOrStoreInst(src) || !IsLoadOrStoreInst(dst)) + return true; + + Value *srcPtr = GetPointerOperand(src); + Value *dstPtr = GetPointerOperand(dst); + const Value *srcObj = srcPtr->getUnderlyingObject(); + const Value *dstObj = dstPtr->getUnderlyingObject(); + const Type *srcTy = srcObj->getType(); + const Type *dstTy = dstObj->getType(); + + // For now, we only work on (pointers to) global or stack-allocated array + // values, as we know that their underlying memory areas will not overlap. + // MAYBE: relax this and test for aliasing? + if (!((isa(srcObj) || isa(srcObj)) && + (isa(dstObj) || isa(dstObj)) && + isa(srcTy) && + isa(dstTy) && + isa(cast(srcTy)->getElementType()) && + isa(cast(dstTy)->getElementType()))) + return true; + + // If the arrays are different, the underlying memory areas do not overlap + // and the memory accesses are therefore independent. + if (srcObj != dstObj) + return false; + + // We couldn't establish a more precise result, so we have to conservatively + // assume full dependence. return true; } Added: llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll?rev=74499&view=auto ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll (added) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll Mon Jun 29 21:12:10 2009 @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t +; RUN: grep {instructions: 2} %t | count 1 +; RUN: grep {0,1: dependent} %t | count 1 + +; x[5] = x[6] // with x being an array on the stack + +define void @foo(...) nounwind { +entry: + %xptr = alloca [256 x i32], align 4 + %x.ld.addr = getelementptr [256 x i32]* %xptr, i64 0, i64 6 + %x.st.addr = getelementptr [256 x i32]* %xptr, i64 0, i64 5 + br label %for.body + +for.body: + %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] + %x = load i32* %x.ld.addr + store i32 %x, i32* %x.st.addr + %i.next = add i64 %i, 1 + %exitcond = icmp eq i64 %i.next, 256 + br i1 %exitcond, label %for.end, label %for.body + +for.end: + ret void +} Added: llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll?rev=74499&view=auto ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll (added) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll Mon Jun 29 21:12:10 2009 @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t +; RUN: grep {instructions: 2} %t | count 1 +; RUN: grep {0,1: dependent} %t | count 1 + +; x[5] = x[6] // with x being a pointer passed as argument + +define void @foo(i32* nocapture %xptr) nounwind { +entry: + %x.ld.addr = getelementptr i32* %xptr, i64 6 + %x.st.addr = getelementptr i32* %xptr, i64 5 + br label %for.body + +for.body: + %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] + %x = load i32* %x.ld.addr + store i32 %x, i32* %x.st.addr + %i.next = add i64 %i, 1 + %exitcond = icmp eq i64 %i.next, 256 + br i1 %exitcond, label %for.end, label %for.body + +for.end: + ret void +} Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll?rev=74499&r1=74498&r2=74499&view=diff ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll (original) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll Mon Jun 29 21:12:10 2009 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t ; RUN: grep {instructions: 3} %t | count 1 ; RUN: grep {0,2: dependent} %t | count 1 -; RUN: grep {1,2: dependent} %t | count 1 +; RUN: grep {1,2: independent} %t | count 1 ; for (i = 0; i < 256; i++) ; x[i] = x[i] + y[i] Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll?rev=74499&r1=74498&r2=74499&view=diff ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll (original) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll Mon Jun 29 21:12:10 2009 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t ; RUN: grep {instructions: 3} %t | count 1 ; RUN: grep {0,2: dependent} %t | count 1 -; RUN: grep {1,2: dependent} %t | count 1 +; RUN: grep {1,2: independent} %t | count 1 ; for (i = 0; i < 256; i++) ; x[i+1] = x[i] + y[i] From evan.cheng at apple.com Mon Jun 29 21:15:48 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Jun 2009 02:15:48 -0000 Subject: [llvm-commits] [llvm] r74500 - in /llvm/trunk: lib/Target/ARM/ARMInstrFormats.td lib/Target/ARM/ARMInstrInfo.h lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-ldr_ext.ll test/CodeGen/Thumb2/thumb2-ldrb.ll test/CodeGen/Thumb2/thumb2-ldrh.ll Message-ID: <200906300215.n5U2FmKF010366@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 29 21:15:48 2009 New Revision: 74500 URL: http://llvm.org/viewvc/llvm-project?rev=74500&view=rev Log: A few more load instructions. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_ext.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrInfo.h llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=74500&r1=74499&r2=74500&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Jun 29 21:15:48 2009 @@ -79,7 +79,8 @@ def AddrModeT2_i12: AddrMode<10>; def AddrModeT2_i8 : AddrMode<11>; def AddrModeT2_so : AddrMode<12>; -def AddrModeT2_pc : AddrMode<13>; +def AddrModeT2_pc : AddrMode<13>; +def AddrModeT2_i8s4 : AddrMode<14>; // Instruction size. class SizeFlagVal val> { @@ -856,6 +857,8 @@ : Thumb2I; class T2Ipc pattern> : Thumb2I; +class T2Ii8s4 pattern> + : Thumb2I; class T2sI pattern> : Thumb2sI; Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=74500&r1=74499&r2=74500&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Mon Jun 29 21:15:48 2009 @@ -33,20 +33,21 @@ // This four-bit field describes the addressing mode used. AddrModeMask = 0xf, - AddrModeNone = 0, - AddrMode1 = 1, - AddrMode2 = 2, - AddrMode3 = 3, - AddrMode4 = 4, - AddrMode5 = 5, - AddrModeT1_1 = 6, - AddrModeT1_2 = 7, - AddrModeT1_4 = 8, - AddrModeT1_s = 9, // i8 * 4 for pc and sp relative data - AddrModeT2_i12= 10, - AddrModeT2_i8 = 11, - AddrModeT2_so = 12, - AddrModeT2_pc = 13, // +/- i12 for pc relative data + AddrModeNone = 0, + AddrMode1 = 1, + AddrMode2 = 2, + AddrMode3 = 3, + AddrMode4 = 4, + AddrMode5 = 5, + AddrModeT1_1 = 6, + AddrModeT1_2 = 7, + AddrModeT1_4 = 8, + AddrModeT1_s = 9, // i8 * 4 for pc and sp relative data + AddrModeT2_i12 = 10, + AddrModeT2_i8 = 11, + AddrModeT2_so = 12, + AddrModeT2_pc = 13, // +/- i12 for pc relative data + AddrModeT2_i8s4 = 14, // i8 * 4 // Size* - Flags to keep track of the size of an instruction. SizeShift = 4, Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=74500&r1=74499&r2=74500&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Jun 29 21:15:48 2009 @@ -622,13 +622,13 @@ def : Tv5Pat<(ARMcall tGPR:$dst), (tBLXr tGPR:$dst)>; // zextload i1 -> zextload i8 -def : TPat<(zextloadi1 t_addrmode_s1:$addr), - (tLDRB t_addrmode_s1:$addr)>; +def : T1Pat<(zextloadi1 t_addrmode_s1:$addr), + (tLDRB t_addrmode_s1:$addr)>; // extload -> zextload -def : TPat<(extloadi1 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>; -def : TPat<(extloadi8 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>; -def : TPat<(extloadi16 t_addrmode_s2:$addr), (tLDRH t_addrmode_s2:$addr)>; +def : T1Pat<(extloadi1 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>; +def : T1Pat<(extloadi8 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>; +def : T1Pat<(extloadi16 t_addrmode_s2:$addr), (tLDRH t_addrmode_s2:$addr)>; // Large immediate handling. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74500&r1=74499&r2=74500&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Jun 29 21:15:48 2009 @@ -136,7 +136,7 @@ let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm); } -// t2addrmode_imm8 := reg - imm8 +// t2addrmode_imm8 := reg - imm8 (also reg + imm8 for some instructions) def t2addrmode_imm8 : Operand, ComplexPattern { let PrintMethod = "printT2AddrModeImm8Operand"; @@ -383,6 +383,22 @@ } } +/// T2I_ld - Defines a set of (op r, {imm12|imm8|so_reg}) load patterns. +multiclass T2I_ld { + def i12 : T2Ii12<(outs GPR:$dst), (ins t2addrmode_imm12:$addr), + opc, " $dst, $addr", + [(set GPR:$dst, (opnode t2addrmode_imm12:$addr))]>; + def i8 : T2Ii8 <(outs GPR:$dst), (ins t2addrmode_imm8:$addr), + opc, " $dst, $addr", + [(set GPR:$dst, (opnode t2addrmode_imm8:$addr))]>; + def s : T2Iso <(outs GPR:$dst), (ins t2addrmode_so_reg:$addr), + opc, " $dst, $addr", + [(set GPR:$dst, (opnode t2addrmode_so_reg:$addr))]>; + def pci : T2Ipc <(outs GPR:$dst), (ins i32imm:$addr), + opc, " $dst, $addr", + [(set GPR:$dst, (opnode (ARMWrapper tconstpool:$addr)))]>; +} + //===----------------------------------------------------------------------===// // Instructions //===----------------------------------------------------------------------===// @@ -434,24 +450,64 @@ // // Load -let canFoldAsLoad = 1 in { -def t2LDRi12 : T2Ii12<(outs GPR:$dst), (ins t2addrmode_imm12:$addr), - "ldr", " $dst, $addr", - [(set GPR:$dst, (load t2addrmode_imm12:$addr))]>; - -def t2LDRi8 : T2Ii8<(outs GPR:$dst), (ins t2addrmode_imm8:$addr), - "ldr", " $dst, $addr", - [(set GPR:$dst, (load t2addrmode_imm8:$addr))]>; - -def t2LDRs : T2Iso<(outs GPR:$dst), (ins t2addrmode_so_reg:$addr), - "ldr", " $dst, $addr", - [(set GPR:$dst, (load t2addrmode_so_reg:$addr))]>; - -// Load tconstpool -def t2LDRpci : T2Ipc<(outs GPR:$dst), (ins i32imm:$addr), - "ldr", " $dst, $addr", - [(set GPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>; -} // canFoldAsLoad +let canFoldAsLoad = 1 in +defm t2LDR : T2I_ld<"ldr", UnOpFrag<(load node:$Src)>>; + +// Loads with zero extension +defm t2LDRH : T2I_ld<"ldrh", UnOpFrag<(zextloadi16 node:$Src)>>; +defm t2LDRB : T2I_ld<"ldrb", UnOpFrag<(zextloadi8 node:$Src)>>; + +// Loads with sign extension +defm t2LDRSH : T2I_ld<"ldrsh", UnOpFrag<(sextloadi16 node:$Src)>>; +defm t2LDRSB : T2I_ld<"ldrsb", UnOpFrag<(sextloadi8 node:$Src)>>; + +let mayLoad = 1 in { +// Load doubleword +def t2LDRDi8 : T2Ii8s4<(outs GPR:$dst), (ins t2addrmode_imm8:$addr), + "ldrd", " $dst, $addr", []>; +def t2LDRDpci : T2Ii8s4<(outs GPR:$dst), (ins i32imm:$addr), + "ldrd", " $dst, $addr", []>; +} + +// zextload i1 -> zextload i8 +def : T2Pat<(zextloadi1 t2addrmode_imm12:$addr), + (t2LDRBi12 t2addrmode_imm12:$addr)>; +def : T2Pat<(zextloadi1 t2addrmode_imm8:$addr), + (t2LDRBi8 t2addrmode_imm8:$addr)>; +def : T2Pat<(zextloadi1 t2addrmode_so_reg:$addr), + (t2LDRBs t2addrmode_so_reg:$addr)>; +def : T2Pat<(zextloadi1 (ARMWrapper tconstpool:$addr)), + (t2LDRBpci tconstpool:$addr)>; + +// extload -> zextload +// FIXME: Reduce the number of patterns by legalizing extload to zextload +// earlier? +def : T2Pat<(extloadi1 t2addrmode_imm12:$addr), + (t2LDRBi12 t2addrmode_imm12:$addr)>; +def : T2Pat<(extloadi1 t2addrmode_imm8:$addr), + (t2LDRBi8 t2addrmode_imm8:$addr)>; +def : T2Pat<(extloadi1 t2addrmode_so_reg:$addr), + (t2LDRBs t2addrmode_so_reg:$addr)>; +def : T2Pat<(extloadi1 (ARMWrapper tconstpool:$addr)), + (t2LDRBpci tconstpool:$addr)>; + +def : T2Pat<(extloadi8 t2addrmode_imm12:$addr), + (t2LDRBi12 t2addrmode_imm12:$addr)>; +def : T2Pat<(extloadi8 t2addrmode_imm8:$addr), + (t2LDRBi8 t2addrmode_imm8:$addr)>; +def : T2Pat<(extloadi8 t2addrmode_so_reg:$addr), + (t2LDRBs t2addrmode_so_reg:$addr)>; +def : T2Pat<(extloadi8 (ARMWrapper tconstpool:$addr)), + (t2LDRBpci tconstpool:$addr)>; + +def : T2Pat<(extloadi16 t2addrmode_imm12:$addr), + (t2LDRHi12 t2addrmode_imm12:$addr)>; +def : T2Pat<(extloadi16 t2addrmode_imm8:$addr), + (t2LDRHi8 t2addrmode_imm8:$addr)>; +def : T2Pat<(extloadi16 t2addrmode_so_reg:$addr), + (t2LDRHs t2addrmode_so_reg:$addr)>; +def : T2Pat<(extloadi16 (ARMWrapper tconstpool:$addr)), + (t2LDRHpci tconstpool:$addr)>; //===----------------------------------------------------------------------===// // Move Instructions. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_ext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_ext.ll?rev=74500&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_ext.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_ext.ll Mon Jun 29 21:15:48 2009 @@ -0,0 +1,28 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrb | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrh | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrsb | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrsh | count 1 + +define i32 @test1(i8* %v.pntr.s0.u1) { + %tmp.u = load i8* %v.pntr.s0.u1 + %tmp1.s = zext i8 %tmp.u to i32 + ret i32 %tmp1.s +} + +define i32 @test2(i16* %v.pntr.s0.u1) { + %tmp.u = load i16* %v.pntr.s0.u1 + %tmp1.s = zext i16 %tmp.u to i32 + ret i32 %tmp1.s +} + +define i32 @test3(i8* %v.pntr.s1.u0) { + %tmp.s = load i8* %v.pntr.s1.u0 + %tmp1.s = sext i8 %tmp.s to i32 + ret i32 %tmp1.s +} + +define i32 @test4() { + %tmp.s = load i16* null + %tmp1.s = sext i16 %tmp.s to i32 + ret i32 %tmp1.s +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll?rev=74500&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll Mon Jun 29 21:15:48 2009 @@ -0,0 +1,60 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldrb r0} | count 7 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrb | grep lsl +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr | not grep ldrb + +define i8 @f1(i8* %v) { +entry: + %tmp = load i8* %v + ret i8 %tmp +} + +define i8 @f2(i8* %v) { +entry: + %tmp2 = getelementptr i8* %v, i8 1023 + %tmp = load i8* %tmp2 + ret i8 %tmp +} + +define i8 @f3(i32 %base) { +entry: + %tmp1 = add i32 %base, 4096 + %tmp2 = inttoptr i32 %tmp1 to i8* + %tmp3 = load i8* %tmp2 + ret i8 %tmp3 +} + +define i8 @f4(i32 %base) { +entry: + %tmp1 = sub i32 %base, 128 + %tmp2 = inttoptr i32 %tmp1 to i8* + %tmp3 = load i8* %tmp2 + ret i8 %tmp3 +} + +define i8 @f5(i32 %base, i32 %offset) { +entry: + %tmp1 = add i32 %base, %offset + %tmp2 = inttoptr i32 %tmp1 to i8* + %tmp3 = load i8* %tmp2 + ret i8 %tmp3 +} + +define i8 @f6(i32 %base, i32 %offset) { +entry: + %tmp1 = shl i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i8* + %tmp4 = load i8* %tmp3 + ret i8 %tmp4 +} + +define i8 @f7(i32 %base, i32 %offset) { +entry: + %tmp1 = lshr i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i8* + %tmp4 = load i8* %tmp3 + ret i8 %tmp4 +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll?rev=74500&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll Mon Jun 29 21:15:48 2009 @@ -0,0 +1,59 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldrh r0} | count 7 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrh | grep lsl +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr | not grep ldrh + +define i16 @f1(i16* %v) { +entry: + %tmp = load i16* %v + ret i16 %tmp +} + +define i16 @f2(i16* %v) { +entry: + %tmp2 = getelementptr i16* %v, i16 1023 + %tmp = load i16* %tmp2 + ret i16 %tmp +} + +define i16 @f3(i16* %v) { +entry: + %tmp2 = getelementptr i16* %v, i16 2048 + %tmp = load i16* %tmp2 + ret i16 %tmp +} + +define i16 @f4(i32 %base) { +entry: + %tmp1 = sub i32 %base, 128 + %tmp2 = inttoptr i32 %tmp1 to i16* + %tmp3 = load i16* %tmp2 + ret i16 %tmp3 +} + +define i16 @f5(i32 %base, i32 %offset) { +entry: + %tmp1 = add i32 %base, %offset + %tmp2 = inttoptr i32 %tmp1 to i16* + %tmp3 = load i16* %tmp2 + ret i16 %tmp3 +} + +define i16 @f6(i32 %base, i32 %offset) { +entry: + %tmp1 = shl i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i16* + %tmp4 = load i16* %tmp3 + ret i16 %tmp4 +} + +define i16 @f7(i32 %base, i32 %offset) { +entry: + %tmp1 = lshr i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i16* + %tmp4 = load i16* %tmp3 + ret i16 %tmp4 +} From eli.friedman at gmail.com Mon Jun 29 22:47:25 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Mon, 29 Jun 2009 20:47:25 -0700 Subject: [llvm-commits] [llvm] r74499 - in /llvm/trunk: lib/Analysis/LoopDependenceAnalysis.cpp test/Analysis/LoopDependenceAnalysis/local-array.ll test/Analysis/LoopDependenceAnalysis/no-array.ll test/Analysis/LoopDependenceAnalysis/siv-strong1.ll test/A Message-ID: On Mon, Jun 29, 2009 at 7:12 PM, Andreas Bolka wrote: > + ?// For now, we only work on (pointers to) global or stack-allocated array > + ?// values, as we know that their underlying memory areas will not overlap. > + ?// MAYBE: relax this and test for aliasing? > + ?if (!((isa(srcObj) || isa(srcObj)) && > + ? ? ? ?(isa(dstObj) || isa(dstObj)) && > + ? ? ? ?isa(srcTy) && > + ? ? ? ?isa(dstTy) && > + ? ? ? ?isa(cast(srcTy)->getElementType()) && > + ? ? ? ?isa(cast(dstTy)->getElementType()))) > + ? ?return true; How does the type affect aliasing? -Eli From isanbard at gmail.com Mon Jun 29 23:07:12 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Jun 2009 04:07:12 -0000 Subject: [llvm-commits] [llvm] r74507 - in /llvm/trunk/lib/CompilerDriver: Action.cpp CompilationGraph.cpp Main.cpp Message-ID: <200906300407.n5U47DmP013834@zion.cs.uiuc.edu> Author: void Date: Mon Jun 29 23:07:12 2009 New Revision: 74507 URL: http://llvm.org/viewvc/llvm-project?rev=74507&view=rev Log: #include is forbidden. Remove it in favor of raw_ostream. Modified: llvm/trunk/lib/CompilerDriver/Action.cpp llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp llvm/trunk/lib/CompilerDriver/Main.cpp Modified: llvm/trunk/lib/CompilerDriver/Action.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Action.cpp?rev=74507&r1=74506&r2=74507&view=diff ============================================================================== --- llvm/trunk/lib/CompilerDriver/Action.cpp (original) +++ llvm/trunk/lib/CompilerDriver/Action.cpp Mon Jun 29 23:07:12 2009 @@ -13,10 +13,8 @@ #include "llvm/CompilerDriver/Action.h" #include "llvm/CompilerDriver/BuiltinOptions.h" - +#include "llvm/Support/raw_ostream.h" #include "llvm/System/Program.h" - -#include #include using namespace llvm; @@ -58,15 +56,15 @@ } void print_string (const std::string& str) { - std::cerr << str << ' '; + errs() << str << ' '; } } int llvmc::Action::Execute() const { if (DryRun || VerboseMode) { - std::cerr << Command_ << " "; + errs() << Command_ << " "; std::for_each(Args_.begin(), Args_.end(), print_string); - std::cerr << '\n'; + errs() << '\n'; } if (DryRun) return 0; Modified: llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp?rev=74507&r1=74506&r2=74507&view=diff ============================================================================== --- llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp (original) +++ llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp Mon Jun 29 23:07:12 2009 @@ -18,10 +18,10 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/DOTGraphTraits.h" #include "llvm/Support/GraphWriter.h" +#include "llvm/Support/raw_ostream.h" #include #include -#include #include #include #include @@ -346,8 +346,8 @@ if (!N2.ToolPtr) { ++ret; - std::cerr << "Error: there is an edge from '" << N1.ToolPtr->Name() - << "' back to the root!\n\n"; + errs() << "Error: there is an edge from '" << N1.ToolPtr->Name() + << "' back to the root!\n\n"; continue; } @@ -363,17 +363,17 @@ if (!eq) { ++ret; - std::cerr << "Error: Output->input language mismatch in the edge '" << - N1.ToolPtr->Name() << "' -> '" << N2.ToolPtr->Name() << "'!\n"; - - std::cerr << "Expected one of { "; + errs() << "Error: Output->input language mismatch in the edge '" + << N1.ToolPtr->Name() << "' -> '" << N2.ToolPtr->Name() + << "'!\n" + << "Expected one of { "; InLangs = N2.ToolPtr->InputLanguages(); for (;*InLangs; ++InLangs) { - std::cerr << '\'' << *InLangs << (*(InLangs+1) ? "', " : "'"); + errs() << '\'' << *InLangs << (*(InLangs+1) ? "', " : "'"); } - std::cerr << " }, but got '" << OutLang << "'!\n\n"; + errs() << " }, but got '" << OutLang << "'!\n\n"; } } @@ -406,9 +406,8 @@ } else if (EdgeWeight == MaxWeight) { ++ret; - std::cerr - << "Error: there are multiple maximal edges stemming from the '" - << N.ToolPtr->Name() << "' node!\n\n"; + errs() << "Error: there are multiple maximal edges stemming from the '" + << N.ToolPtr->Name() << "' node!\n\n"; break; } } @@ -440,9 +439,9 @@ } if (deleted != NodesMap.size()) { - std::cerr << "Error: there are cycles in the compilation graph!\n" - << "Try inspecting the diagram produced by " - "'llvmc --view-graph'.\n\n"; + errs() << "Error: there are cycles in the compilation graph!\n" + << "Try inspecting the diagram produced by " + << "'llvmc --view-graph'.\n\n"; return 1; } @@ -518,9 +517,9 @@ std::ofstream O(OutputFilename.c_str()); if (O.good()) { - std::cerr << "Writing '"<< OutputFilename << "' file..."; + errs() << "Writing '"<< OutputFilename << "' file..."; llvm::WriteGraph(O, this); - std::cerr << "done.\n"; + errs() << "done.\n"; O.close(); } else { Modified: llvm/trunk/lib/CompilerDriver/Main.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Main.cpp?rev=74507&r1=74506&r2=74507&view=diff ============================================================================== --- llvm/trunk/lib/CompilerDriver/Main.cpp (original) +++ llvm/trunk/lib/CompilerDriver/Main.cpp Mon Jun 29 23:07:12 2009 @@ -16,9 +16,9 @@ #include "llvm/CompilerDriver/Error.h" #include "llvm/CompilerDriver/Plugin.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/System/Path.h" -#include #include #include @@ -91,7 +91,7 @@ if (CheckGraph) { int ret = graph.Check(); if (!ret) - std::cerr << "check-graph: no errors found.\n"; + llvm::errs() << "check-graph: no errors found.\n"; return ret; } @@ -119,10 +119,10 @@ return ec.code(); } catch(const std::exception& ex) { - std::cerr << argv[0] << ": " << ex.what() << '\n'; + llvm::errs() << argv[0] << ": " << ex.what() << '\n'; } catch(...) { - std::cerr << argv[0] << ": unknown error!\n"; + llvm::errs() << argv[0] << ": unknown error!\n"; } return 1; } From dgregor at apple.com Mon Jun 29 11:25:23 2009 From: dgregor at apple.com (Douglas Gregor) Date: Mon, 29 Jun 2009 16:25:23 -0000 Subject: [llvm-commits] [llvm] r74426 - /llvm/trunk/cmake/config-ix.cmake Message-ID: <200906291625.n5TGPNSG022808@zion.cs.uiuc.edu> Author: dgregor Date: Mon Jun 29 11:25:22 2009 New Revision: 74426 URL: http://llvm.org/viewvc/llvm-project?rev=74426&view=rev Log: Fix CMake checks for pthread_getspecific and pthread_rwlock_init, from Xerxes Ranby Modified: llvm/trunk/cmake/config-ix.cmake Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=74426&r1=74425&r2=74426&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Mon Jun 29 11:25:22 2009 @@ -44,6 +44,8 @@ # library checks include(CheckLibraryExists) check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD) +check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC) +check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT) check_library_exists(dl dlopen "" HAVE_LIBDL) # function checks @@ -64,8 +66,6 @@ check_symbol_exists(malloc_zone_statistics malloc/malloc.h HAVE_MALLOC_ZONE_STATISTICS) check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) -check_symbol_exists(pthread_rwlock_init pthread.h HAVE_PTHREAD_RWLOCK_INIT) -check_symbol_exists(pthread_getspecific pthread.h HAVE_PTHREAD_GETSPECIFIC) check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) From dgregor at apple.com Mon Jun 29 11:28:03 2009 From: dgregor at apple.com (Douglas Gregor) Date: Mon, 29 Jun 2009 09:28:03 -0700 Subject: [llvm-commits] [llvm] r74284 - in /llvm/trunk: cmake/config-ix.cmake include/llvm/Config/config.h.cmake - cmake bug? In-Reply-To: <4A450A7C.6020009@zafena.se> References: <200906261435.n5QEZiEn011654@zion.cs.uiuc.edu> <4A450A7C.6020009@zafena.se> Message-ID: <48F32CDD-90A7-4923-93D2-570913D50CCE@apple.com> On Jun 26, 2009, at 10:50 AM, Xerxes R?nby wrote: > Hi Doug. > > Im having some issues with these two test when implemented using > check_symbol_exists(), they both fail when they should not. > cd llvm > svn up > cd .. > mkdir llvm-build > cd llvm-build > cmake ../llvm > ... > -- Looking for pthread_create in pthread > -- Looking for pthread_create in pthread - found > ... > -- Looking for pthread_mutex_lock > -- Looking for pthread_mutex_lock - found > -- Looking for pthread_rwlock_init > -- Looking for pthread_rwlock_init - not found. > -- Looking for pthread_getspecific > -- Looking for pthread_getspecific - not found. > > if i change config-ix.cmake to use check_library_exists() for the > tests then they both succeed on the same machine: > > -- Looking for pthread_create in pthread > -- Looking for pthread_create in pthread - found > -- Looking for pthread_getspecific in pthread > -- Looking for pthread_getspecific in pthread - found > -- Looking for pthread_rwlock_init in pthread > -- Looking for pthread_rwlock_init in pthread - found > ... > -- Looking for pthread_mutex_lock > -- Looking for pthread_mutex_lock - found > > Im a bit puzzled why check_symbol_exists() dont seem to work for > these two tests while working to find pthread_mutex_lock. > Could this be a cmake bug? No, it was my bug. By default, check_symbol_exists only looks in those libraries that are automatically linked into an executable. I should have set CMAKE_REQUIRED_LIBRARIES to include pthread. On my platform, pthread libraries are automatically linked in, so it magically worked. Thanks for the fix! I've committed it in r74426. - Doug From the.dead.shall.rise at gmail.com Mon Jun 29 12:27:32 2009 From: the.dead.shall.rise at gmail.com (Mikhail Glushenkov) Date: Mon, 29 Jun 2009 17:27:32 +0000 (UTC) Subject: [llvm-commits] =?utf-8?q?=5Bllvm=5D_r74417_-_in_/llvm/trunk=3A_Ma?= =?utf-8?q?kefile=2Erules=09include/llvm/CompilerDriver/Main=2Einc?= =?utf-8?q?=09lib/CompilerDriver/BuiltinOptions=2Ecpp=09lib/Compile?= =?utf-8?q?rDriver/Makefile_lib/CompilerDriver/Tool=2Ecpp?= References: <200906290309.n5T39LPo015790@zion.cs.uiuc.edu> Message-ID: Hi, Howard Su writes: > > > Great. I can now wait to try. How can I compile a pass as a DLL? I guess that you are thinking about *opt* plugins, but this was a *llvmc* commit. Anyway, to compile a dynamic *llvmc* plugin, just cd to the plugin directory and run make. $ cd tools/llvmc/plugins/Base $ make $ cd ../../example/Skeleton $ make $ llvmc-skeleton -load $LLVM_DIR/Release/lib/plugin_llvmc_Base.dll --help > Can you include a sample CMakefile? No, I don't use cmake. From sabre at nondot.org Mon Jun 29 23:20:47 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Jun 2009 04:20:47 -0000 Subject: [llvm-commits] [llvm] r74508 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <200906300420.n5U4KlTm014263@zion.cs.uiuc.edu> Author: lattner Date: Mon Jun 29 23:20:46 2009 New Revision: 74508 URL: http://llvm.org/viewvc/llvm-project?rev=74508&view=rev Log: add a note Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=74508&r1=74507&r2=74508&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Mon Jun 29 23:20:46 2009 @@ -1932,3 +1932,23 @@ instcombine. //===---------------------------------------------------------------------===// + +It looks like we don't have patterns (or they aren't matching) for adc with +immediate: + +define i64 @f1(i64 %a) nounwind { + %tmp = sub i64 %a, 734439407618 + ret i64 %tmp +} +$ llvm-as < t.ll | llc -march=x86 + +_f1: + movl 4(%esp), %eax + addl $4294967294, %eax + movl $4294967124, %edx + adcl 8(%esp), %edx + ret + +There is no need to clobber %edx there. + +//===---------------------------------------------------------------------===// From eli.friedman at gmail.com Tue Jun 30 00:03:00 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Mon, 29 Jun 2009 22:03:00 -0700 Subject: [llvm-commits] [llvm] r74508 - /llvm/trunk/lib/Target/X86/README.txt In-Reply-To: <200906300420.n5U4KlTm014263@zion.cs.uiuc.edu> References: <200906300420.n5U4KlTm014263@zion.cs.uiuc.edu> Message-ID: On Mon, Jun 29, 2009 at 9:20 PM, Chris Lattner wrote: > ?//===---------------------------------------------------------------------===// > + > +It looks like we don't have patterns (or they aren't matching) for adc with > +immediate: > + > +define i64 @f1(i64 %a) nounwind { > + ? %tmp = sub i64 %a, 734439407618 > + ? ret i64 %tmp > +} > +$ llvm-as < t.ll | llc -march=x86 > + > +_f1: > + ? ? ? movl ? ?4(%esp), %eax > + ? ? ? addl ? ?$4294967294, %eax > + ? ? ? movl ? ?$4294967124, %edx > + ? ? ? adcl ? ?8(%esp), %edx > + ? ? ? ret The alternative is something like the following: _f1: movl 4(%esp), %eax addl $4294967294, %eax movl 8(%esp), %edx adcl $4294967124, %edx ret This form is slightly better because it's three bytes shorter, but it's not a huge defect. > +There is no need to clobber %edx there. Huh? We *are* returning a 64-bit value, whose top half is in %edx. -Eli From sabre at nondot.org Tue Jun 30 00:22:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Jun 2009 05:22:31 -0000 Subject: [llvm-commits] [llvm] r74509 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <200906300522.n5U5MWvW016203@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 00:22:31 2009 New Revision: 74509 URL: http://llvm.org/viewvc/llvm-project?rev=74509&view=rev Log: remove a bogus note. Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=74509&r1=74508&r2=74509&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Tue Jun 30 00:22:31 2009 @@ -1932,23 +1932,3 @@ instcombine. //===---------------------------------------------------------------------===// - -It looks like we don't have patterns (or they aren't matching) for adc with -immediate: - -define i64 @f1(i64 %a) nounwind { - %tmp = sub i64 %a, 734439407618 - ret i64 %tmp -} -$ llvm-as < t.ll | llc -march=x86 - -_f1: - movl 4(%esp), %eax - addl $4294967294, %eax - movl $4294967124, %edx - adcl 8(%esp), %edx - ret - -There is no need to clobber %edx there. - -//===---------------------------------------------------------------------===// From clattner at apple.com Tue Jun 30 00:22:42 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 29 Jun 2009 22:22:42 -0700 Subject: [llvm-commits] [llvm] r74508 - /llvm/trunk/lib/Target/X86/README.txt In-Reply-To: References: <200906300420.n5U4KlTm014263@zion.cs.uiuc.edu> Message-ID: <89EF2275-2D32-4DF8-8581-EF7799F32FFA@apple.com> On Jun 29, 2009, at 10:03 PM, Eli Friedman wrote: >> >> +There is no need to clobber %edx there. > > Huh? We *are* returning a 64-bit value, whose top half is in %edx. You're right, I completely misread the asm :) -Chris From clattner at apple.com Tue Jun 30 00:24:12 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 29 Jun 2009 22:24:12 -0700 Subject: [llvm-commits] [llvm] r74499 - in /llvm/trunk: lib/Analysis/LoopDependenceAnalysis.cpp test/Analysis/LoopDependenceAnalysis/local-array.ll test/Analysis/LoopDependenceAnalysis/no-array.ll test/Analysis/LoopDependenceAnalysis/siv-strong1.ll test/Analysis/LoopDependenceAnalysis/siv-strong2.ll In-Reply-To: <200906300212.n5U2CBSE010249@zion.cs.uiuc.edu> References: <200906300212.n5U2CBSE010249@zion.cs.uiuc.edu> Message-ID: <5EA8CF17-4AA7-4F41-80FA-F82DCB42A023@apple.com> On Jun 29, 2009, at 7:12 PM, Andreas Bolka wrote: > Author: abolka > Date: Mon Jun 29 21:12:10 2009 > New Revision: 74499 > > URL: http://llvm.org/viewvc/llvm-project?rev=74499&view=rev > Log: > Array accesses are independent if the underlying arrays differ. Andreas, you should really use AliasAnalysis queries for this. If you have P[i] and Q[j] then the accesses are known not to depend on each other if P/Q are known to noalias. Please don't reinvent alias analysis in your pass :) -Chris > > Added: > llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll > llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll > Modified: > llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp > llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll > llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll > > Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=74499&r1=74498&r2=74499&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) > +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Mon Jun 29 > 21:12:10 2009 > @@ -22,6 +22,7 @@ > #include "llvm/Analysis/LoopPass.h" > #include "llvm/Analysis/ScalarEvolution.h" > #include "llvm/Instructions.h" > +#include "llvm/Support/Debug.h" > using namespace llvm; > > LoopPass *llvm::createLoopDependenceAnalysisPass() { > @@ -51,6 +52,20 @@ > memrefs.push_back(i); > } > > +static bool IsLoadOrStoreInst(Value *I) { > + return isa(I) || isa(I); > +} > + > +static Value *GetPointerOperand(Value *I) { > + if (LoadInst *i = dyn_cast(I)) > + return i->getPointerOperand(); > + if (StoreInst *i = dyn_cast(I)) > + return i->getPointerOperand(); > + assert(0 && "Value is no load or store instruction!"); > + // Never reached. > + return 0; > +} > + > // > = > = > = > ----------------------------------------------------------------------= > ==// > // Dependence Testing > // > = > = > = > ----------------------------------------------------------------------= > ==// > @@ -65,6 +80,38 @@ > > bool LoopDependenceAnalysis::depends(Value *src, Value *dst) { > assert(isDependencePair(src, dst) && "Values form no dependence > pair!"); > + DOUT << "== LDA test ==\n" << *src << *dst; > + > + // We only analyse loads and stores; for possible memory accesses > by e.g. > + // free, call, or invoke instructions we conservatively assume > dependence. > + if (!IsLoadOrStoreInst(src) || !IsLoadOrStoreInst(dst)) > + return true; > + > + Value *srcPtr = GetPointerOperand(src); > + Value *dstPtr = GetPointerOperand(dst); > + const Value *srcObj = srcPtr->getUnderlyingObject(); > + const Value *dstObj = dstPtr->getUnderlyingObject(); > + const Type *srcTy = srcObj->getType(); > + const Type *dstTy = dstObj->getType(); > + > + // For now, we only work on (pointers to) global or stack- > allocated array > + // values, as we know that their underlying memory areas will not > overlap. > + // MAYBE: relax this and test for aliasing? > + if (!((isa(srcObj) || isa(srcObj)) && > + (isa(dstObj) || isa(dstObj)) && > + isa(srcTy) && > + isa(dstTy) && > + isa(cast(srcTy)->getElementType()) && > + isa(cast(dstTy)->getElementType()))) > + return true; > + > + // If the arrays are different, the underlying memory areas do > not overlap > + // and the memory accesses are therefore independent. > + if (srcObj != dstObj) > + return false; > + > + // We couldn't establish a more precise result, so we have to > conservatively > + // assume full dependence. > return true; > } > > > Added: llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll?rev=74499&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll > (added) > +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/local-array.ll > Mon Jun 29 21:12:10 2009 > @@ -0,0 +1,24 @@ > +; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t > +; RUN: grep {instructions: 2} %t | count 1 > +; RUN: grep {0,1: dependent} %t | count 1 > + > +; x[5] = x[6] // with x being an array on the stack > + > +define void @foo(...) nounwind { > +entry: > + %xptr = alloca [256 x i32], align 4 > + %x.ld.addr = getelementptr [256 x i32]* %xptr, i64 0, i64 6 > + %x.st.addr = getelementptr [256 x i32]* %xptr, i64 0, i64 5 > + br label %for.body > + > +for.body: > + %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] > + %x = load i32* %x.ld.addr > + store i32 %x, i32* %x.st.addr > + %i.next = add i64 %i, 1 > + %exitcond = icmp eq i64 %i.next, 256 > + br i1 %exitcond, label %for.end, label %for.body > + > +for.end: > + ret void > +} > > Added: llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll?rev=74499&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll > (added) > +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/no-array.ll Mon > Jun 29 21:12:10 2009 > @@ -0,0 +1,23 @@ > +; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t > +; RUN: grep {instructions: 2} %t | count 1 > +; RUN: grep {0,1: dependent} %t | count 1 > + > +; x[5] = x[6] // with x being a pointer passed as argument > + > +define void @foo(i32* nocapture %xptr) nounwind { > +entry: > + %x.ld.addr = getelementptr i32* %xptr, i64 6 > + %x.st.addr = getelementptr i32* %xptr, i64 5 > + br label %for.body > + > +for.body: > + %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] > + %x = load i32* %x.ld.addr > + store i32 %x, i32* %x.st.addr > + %i.next = add i64 %i, 1 > + %exitcond = icmp eq i64 %i.next, 256 > + br i1 %exitcond, label %for.end, label %for.body > + > +for.end: > + ret void > +} > > Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv- > strong1.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll?rev=74499&r1=74498&r2=74499&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll > (original) > +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll > Mon Jun 29 21:12:10 2009 > @@ -1,7 +1,7 @@ > ; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t > ; RUN: grep {instructions: 3} %t | count 1 > ; RUN: grep {0,2: dependent} %t | count 1 > -; RUN: grep {1,2: dependent} %t | count 1 > +; RUN: grep {1,2: independent} %t | count 1 > > ; for (i = 0; i < 256; i++) > ; x[i] = x[i] + y[i] > > Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv- > strong2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll?rev=74499&r1=74498&r2=74499&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll > (original) > +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll > Mon Jun 29 21:12:10 2009 > @@ -1,7 +1,7 @@ > ; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t > ; RUN: grep {instructions: 3} %t | count 1 > ; RUN: grep {0,2: dependent} %t | count 1 > -; RUN: grep {1,2: dependent} %t | count 1 > +; RUN: grep {1,2: independent} %t | count 1 > > ; for (i = 0; i < 256; i++) > ; x[i+1] = x[i] + y[i] > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Jun 30 00:28:13 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 29 Jun 2009 22:28:13 -0700 Subject: [llvm-commits] [llvm] r74488 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/CMakeLists.txt lib/VMCore/LLVMContext.cpp lib/VMCore/LLVMContextImpl.h In-Reply-To: <200906300048.n5U0mucZ007464@zion.cs.uiuc.edu> References: <200906300048.n5U0mucZ007464@zion.cs.uiuc.edu> Message-ID: <8DB3CA98-C4DC-420F-92D6-7C5AD019F156@apple.com> On Jun 29, 2009, at 5:48 PM, Owen Anderson wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=74488&view=rev > Log: > Add LLVMContext, which will eventually be used as a container for > privatizing a lot of (currently) global state, including the > constant and type uniquing tables. For now, just make it a wrapper > around the existing APIs. Thanks! > +++ llvm/trunk/include/llvm/LLVMContext.h Mon Jun 29 19:48:55 2009 > @@ -0,0 +1,162 @@ > +//===-- llvm/LLVMContext.h - Class for managing "global" state --*- > C++ -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// Please follow the standard header style, adding the blob that describes what this header is all about. > +#ifndef LLVM_LLVMCONTEXT_H > +#define LLVM_LLVMCONTEXT_H > + > +#include "llvm/Support/DataTypes.h" > +#include > +#include It is really unfortunate to include vector and string in this header, would it be possible to fix these API mistakes incrementally by making this API take "start pointer + count"-style APIs? > + > +class LLVMContext { The class needs a big fat doxygen comment. You need to disable copy ctor and operator=. > +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Mon Jun 29 19:48:55 2009 > @@ -0,0 +1,379 @@ > +//===-- LLVMContext.cpp - Implement LLVMContext > -----------------------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// Likewise, please use the standard format. Note that the first line is too short and you're missing the second block. > +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Jun 29 19:48:55 2009 > @@ -0,0 +1,20 @@ > +//===-- llvm/SymbolTableListTraitsImpl.h - Implementation ------*- C > ++ -*--===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +#ifndef LLVM_LLVMCONTEXT_IMPL_H > +#define LLVM_LLVMCONTEXT_IMPL_H > + > +namespace llvm { > +class LLVMContextImpl { Same issues as the LLVMContext.h file and class. > + > +}; > + > +} > + > +#endif > \ No newline at end of file Newline plz. :) -Chris From resistor at mac.com Tue Jun 30 00:33:46 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 30 Jun 2009 05:33:46 -0000 Subject: [llvm-commits] [llvm] r74510 - in /llvm/trunk: include/llvm/ADT/Statistic.h lib/Analysis/IPA/Andersens.cpp lib/Support/Annotation.cpp Message-ID: <200906300533.n5U5XkVh016571@zion.cs.uiuc.edu> Author: resistor Date: Tue Jun 30 00:33:46 2009 New Revision: 74510 URL: http://llvm.org/viewvc/llvm-project?rev=74510&view=rev Log: Fix the build on Cygwin. Patch by Aaron Gray. Modified: llvm/trunk/include/llvm/ADT/Statistic.h llvm/trunk/lib/Analysis/IPA/Andersens.cpp llvm/trunk/lib/Support/Annotation.cpp Modified: llvm/trunk/include/llvm/ADT/Statistic.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Statistic.h?rev=74510&r1=74509&r2=74510&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Statistic.h (original) +++ llvm/trunk/include/llvm/ADT/Statistic.h Tue Jun 30 00:33:46 2009 @@ -34,10 +34,10 @@ public: const char *Name; const char *Desc; - unsigned Value; + volatile llvm::sys::cas_flag Value; bool Initialized; - unsigned getValue() const { return Value; } + llvm::sys::cas_flag getValue() const { return Value; } const char *getName() const { return Name; } const char *getDesc() const { return Desc; } Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=74510&r1=74509&r2=74510&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Tue Jun 30 00:33:46 2009 @@ -211,7 +211,7 @@ // for each location equivalent Node. struct Node { private: - static unsigned Counter; + static volatile sys::cas_flag Counter; public: Value *Val; @@ -618,7 +618,7 @@ static RegisterAnalysisGroup Y(X); // Initialize Timestamp Counter (static). -unsigned Andersens::Node::Counter = 0; +volatile llvm::sys::cas_flag Andersens::Node::Counter = 0; ModulePass *llvm::createAndersensPass() { return new Andersens(); } Modified: llvm/trunk/lib/Support/Annotation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Annotation.cpp?rev=74510&r1=74509&r2=74510&view=diff ============================================================================== --- llvm/trunk/lib/Support/Annotation.cpp (original) +++ llvm/trunk/lib/Support/Annotation.cpp Tue Jun 30 00:33:46 2009 @@ -39,7 +39,7 @@ } typedef std::map IDMapType; -static unsigned IDCounter = 0; // Unique ID counter +static volatile sys::cas_flag IDCounter = 0; // Unique ID counter // Static member to ensure initialiation on demand. static ManagedStatic IDMap; From sabre at nondot.org Tue Jun 30 01:13:23 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Jun 2009 06:13:23 -0000 Subject: [llvm-commits] [llvm] r74511 - /llvm/trunk/docs/CodingStandards.html Message-ID: <200906300613.n5U6DN40018024@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 01:13:23 2009 New Revision: 74511 URL: http://llvm.org/viewvc/llvm-project?rev=74511&view=rev Log: add a note about re-evaluating end() every time through a loop. Modified: llvm/trunk/docs/CodingStandards.html Modified: llvm/trunk/docs/CodingStandards.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.html?rev=74511&r1=74510&r2=74511&view=diff ============================================================================== --- llvm/trunk/docs/CodingStandards.html (original) +++ llvm/trunk/docs/CodingStandards.html Tue Jun 30 01:13:23 2009 @@ -50,6 +50,8 @@
  • Do not use 'using namespace std'
  • Provide a virtual method anchor for classes in headers
  • +
  • Don't evaluate end() every time through a + loop
  • Prefer Preincrement
  • Avoid std::endl
  • @@ -661,6 +663,67 @@
    + + + +
    + +

    Because C++ doesn't have a standard "foreach" loop (though it can be emulated +with macros and may be coming in C++'0x) we end up writing a lot of loops that +manually iterate from begin to end on a variety of containers or through other +data structures. One common mistake is to write a loop in this style:

    + +
    +
    +  BasicBlock *BB = ...
    +  for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I)
    +     ... use I ...
    +
    +
    + +

    The problem with this construct is that it evaluates "BB->end()" +every time through the loop. Instead of writing the loop like this, we strongly +prefer loops to be written so that they evaluate it once before the loop starts. +A convenient way to do this is like so:

    + +
    +
    +  BasicBlock *BB = ...
    +  for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
    +     ... use I ...
    +
    +
    + +

    The observant may quickly point out that these two loops may have different +semantics: if the container (a basic block in this case) is being mutated, then +"BB->end()" may change its value every time through the loop and the +second loop may not in fact be correct. If you actually do depend on this +behavior, please write the loop in the second form and add a comment indicating +that you did it intentionally.

    + +

    Why do we prefer the second form (when correct)? Writing the loop in the +first form has two problems: First it may be less efficient than evaluating it +at the start of the loop. In this case, the cost is probably minor: a few extra +loads every time through the loop. However, if the base expression is more +complex, then the cost can rise quickly. I've seen loops where the end +expression was actually something like: "SomeMap[x]->end()" and map +lookups really aren't cheap. By writing it in the first form consistently, you +eliminate the issue entirely and don't even have to think about it.

    + +

    The second (even bigger) issue is that writing the loop in the second form +hints to the reader that the loop is mutating the container (a fact that a +comment would handily confirm!). If you write the loop in the second form, it +is immediately obvious without even looking at the body of the loop that the +container isn't being modified, which makes it easier to read the code and +understand what it does.

    + +

    While the second form of the loop is a few extra keystrokes, we do strongly +prefer it.

    + +
    +
    From sabre at nondot.org Tue Jun 30 01:20:03 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Jun 2009 06:20:03 -0000 Subject: [llvm-commits] [llvm] r74512 - /llvm/trunk/docs/CodingStandards.html Message-ID: <200906300620.n5U6K3TU018247@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 01:20:03 2009 New Revision: 74512 URL: http://llvm.org/viewvc/llvm-project?rev=74512&view=rev Log: fix some issues Jeff Yasskin noticed Modified: llvm/trunk/docs/CodingStandards.html Modified: llvm/trunk/docs/CodingStandards.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.html?rev=74512&r1=74511&r2=74512&view=diff ============================================================================== --- llvm/trunk/docs/CodingStandards.html (original) +++ llvm/trunk/docs/CodingStandards.html Tue Jun 30 01:20:03 2009 @@ -700,7 +700,7 @@ semantics: if the container (a basic block in this case) is being mutated, then "BB->end()" may change its value every time through the loop and the second loop may not in fact be correct. If you actually do depend on this -behavior, please write the loop in the second form and add a comment indicating +behavior, please write the loop in the first form and add a comment indicating that you did it intentionally.

    Why do we prefer the second form (when correct)? Writing the loop in the @@ -712,7 +712,7 @@ lookups really aren't cheap. By writing it in the first form consistently, you eliminate the issue entirely and don't even have to think about it.

    -

    The second (even bigger) issue is that writing the loop in the second form +

    The second (even bigger) issue is that writing the loop in the first form hints to the reader that the loop is mutating the container (a fact that a comment would handily confirm!). If you write the loop in the second form, it is immediately obvious without even looking at the body of the loop that the From sabre at nondot.org Tue Jun 30 01:27:55 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Jun 2009 06:27:55 -0000 Subject: [llvm-commits] [llvm] r74514 - /llvm/trunk/docs/CodingStandards.html Message-ID: <200906300627.n5U6RtC9018573@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 01:27:54 2009 New Revision: 74514 URL: http://llvm.org/viewvc/llvm-project?rev=74514&view=rev Log: got confused again Modified: llvm/trunk/docs/CodingStandards.html Modified: llvm/trunk/docs/CodingStandards.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.html?rev=74514&r1=74513&r2=74514&view=diff ============================================================================== --- llvm/trunk/docs/CodingStandards.html (original) +++ llvm/trunk/docs/CodingStandards.html Tue Jun 30 01:27:54 2009 @@ -709,7 +709,7 @@ loads every time through the loop. However, if the base expression is more complex, then the cost can rise quickly. I've seen loops where the end expression was actually something like: "SomeMap[x]->end()" and map -lookups really aren't cheap. By writing it in the first form consistently, you +lookups really aren't cheap. By writing it in the second form consistently, you eliminate the issue entirely and don't even have to think about it.

    The second (even bigger) issue is that writing the loop in the first form From isanbard at gmail.com Tue Jun 30 02:05:28 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Jun 2009 07:05:28 -0000 Subject: [llvm-commits] [llvm] r74515 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp Message-ID: <200906300705.n5U75SGC019864@zion.cs.uiuc.edu> Author: void Date: Tue Jun 30 02:05:27 2009 New Revision: 74515 URL: http://llvm.org/viewvc/llvm-project?rev=74515&view=rev Log: Temporarily revert r74494. It was causing failures in the unit tests. Modified: llvm/trunk/include/llvm/ADT/APInt.h llvm/trunk/lib/Support/APInt.cpp Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=74515&r1=74514&r2=74515&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Tue Jun 30 02:05:27 2009 @@ -1426,8 +1426,6 @@ return OS; } -std::ostream &operator<<(std::ostream &o, const APInt &I); - namespace APIntOps { /// @brief Determine the smaller of two APInts considered to be signed. Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=74515&r1=74514&r2=74515&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Tue Jun 30 02:05:27 2009 @@ -2178,12 +2178,6 @@ OS << S.c_str(); } -std::ostream &operator<<(std::ostream &o, const APInt &I) { - raw_os_ostream OS(o); - OS << I; - return o; -} - // This implements a variety of operations on a representation of // arbitrary precision, two's-complement, bignum integer values. From isanbard at gmail.com Tue Jun 30 02:06:17 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Jun 2009 00:06:17 -0700 Subject: [llvm-commits] [llvm] r74494 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp In-Reply-To: <200906300128.n5U1S8xn008718@zion.cs.uiuc.edu> References: <200906300128.n5U1S8xn008718@zion.cs.uiuc.edu> Message-ID: <2201ECCB-767B-4049-AAE2-C78D5B35BF7A@gmail.com> Dan, This was causing the unittests to fail. I temporarily reverted it. Could you take a look please? -bw On Jun 29, 2009, at 6:28 PM, Dan Gohman wrote: > Author: djg > Date: Mon Jun 29 20:28:08 2009 > New Revision: 74494 > > URL: http://llvm.org/viewvc/llvm-project?rev=74494&view=rev > Log: > Define an operator<< for APInt to be used with std::ostream. > This will allow it to be used in unittests that use gtest's > EXPECT_EQ. > > Modified: > llvm/trunk/include/llvm/ADT/APInt.h > llvm/trunk/lib/Support/APInt.cpp > > Modified: llvm/trunk/include/llvm/ADT/APInt.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=74494&r1=74493&r2=74494&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/ADT/APInt.h (original) > +++ llvm/trunk/include/llvm/ADT/APInt.h Mon Jun 29 20:28:08 2009 > @@ -1426,6 +1426,8 @@ > return OS; > } > > +std::ostream &operator<<(std::ostream &o, const APInt &I); > + > namespace APIntOps { > > /// @brief Determine the smaller of two APInts considered to be > signed. > > Modified: llvm/trunk/lib/Support/APInt.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=74494&r1=74493&r2=74494&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Support/APInt.cpp (original) > +++ llvm/trunk/lib/Support/APInt.cpp Mon Jun 29 20:28:08 2009 > @@ -2178,6 +2178,12 @@ > OS << S.c_str(); > } > > +std::ostream &operator<<(std::ostream &o, const APInt &I) { > + raw_os_ostream OS(o); > + OS << I; > + return o; > +} > + > // This implements a variety of operations on a representation of > // arbitrary precision, two's-complement, bignum integer values. > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Tue Jun 30 03:49:10 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Jun 2009 08:49:10 -0000 Subject: [llvm-commits] [llvm] r74518 - in /llvm/trunk: include/llvm/CodeGen/MachineInstrBuilder.h include/llvm/CodeGen/MachineOperand.h include/llvm/CodeGen/RegisterScavenging.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineInstr.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/RegisterScavenging.cpp lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp lib/CodeGen/VirtRegRewriter.cpp lib/Target/X86/X86InstrInfo.cpp test/CodeGen/ARM/2009-06-30-RegScavengerAssert.ll Message-ID: <200906300849.n5U8nCun002075@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jun 30 03:49:04 2009 New Revision: 74518 URL: http://llvm.org/viewvc/llvm-project?rev=74518&view=rev Log: Add a bit IsUndef to MachineOperand. This indicates the def / use register operand is defined by an implicit_def. That means it can def / use any register and passes (e.g. register scavenger) can feel free to ignore them. The register allocator, when it allocates a register to a virtual register defined by an implicit_def, can allocate any physical register without worrying about overlapping live ranges. It should mark all of operands of the said virtual register so later passes will do the right thing. This is not the best solution. But it should be a lot less fragile to having the scavenger try to track what is defined by implicit_def. Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert.ll Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h llvm/trunk/include/llvm/CodeGen/MachineOperand.h llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp llvm/trunk/lib/CodeGen/RegisterScavenging.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Tue Jun 30 03:49:04 2009 @@ -29,7 +29,8 @@ Implicit = 0x4, Kill = 0x8, Dead = 0x10, - EarlyClobber = 0x20, + Undef = 0x20, + EarlyClobber = 0x40, ImplicitDefine = Implicit | Define, ImplicitKill = Implicit | Kill }; @@ -57,8 +58,9 @@ flags & RegState::Implicit, flags & RegState::Kill, flags & RegState::Dead, - SubReg, - flags & RegState::EarlyClobber)); + flags & RegState::Undef, + flags & RegState::EarlyClobber, + SubReg)); return *this; } @@ -203,6 +205,9 @@ inline unsigned getDeadRegState(bool B) { return B ? RegState::Dead : 0; } +inline unsigned getUndefRegState(bool B) { + return B ? RegState::Undef : 0; +} } // End llvm namespace Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Tue Jun 30 03:49:04 2009 @@ -75,6 +75,10 @@ /// This is only valid on definitions of registers. bool IsDead : 1; + /// IsUndef - True if this is a register def / use of "undef", i.e. register + /// defined by an IMPLICIT_DEF. This is only valid on registers. + bool IsUndef : 1; + /// IsEarlyClobber - True if this MO_Register 'def' operand is written to /// by the MachineInstr before all input registers are read. This is used to /// model the GCC inline asm '&' constraint modifier. @@ -198,6 +202,11 @@ return IsKill; } + bool isUndef() const { + assert(isReg() && "Wrong MachineOperand accessor"); + return IsUndef; + } + bool isEarlyClobber() const { assert(isReg() && "Wrong MachineOperand accessor"); return IsEarlyClobber; @@ -248,6 +257,11 @@ IsDead = Val; } + void setIsUndef(bool Val = true) { + assert(isReg() && "Wrong MachineOperand accessor"); + IsUndef = Val; + } + void setIsEarlyClobber(bool Val = true) { assert(isReg() && IsDef && "Wrong MachineOperand accessor"); IsEarlyClobber = Val; @@ -337,7 +351,8 @@ /// the specified value. If an operand is known to be an register already, /// the setReg method should be used. void ChangeToRegister(unsigned Reg, bool isDef, bool isImp = false, - bool isKill = false, bool isDead = false); + bool isKill = false, bool isDead = false, + bool isUndef = false); //===--------------------------------------------------------------------===// // Construction methods. @@ -357,13 +372,15 @@ static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp = false, bool isKill = false, bool isDead = false, - unsigned SubReg = 0, - bool isEarlyClobber = false) { + bool isUndef = false, + bool isEarlyClobber = false, + unsigned SubReg = 0) { MachineOperand Op(MachineOperand::MO_Register); Op.IsDef = isDef; Op.IsImp = isImp; Op.IsKill = isKill; Op.IsDead = isDead; + Op.IsUndef = isUndef; Op.IsEarlyClobber = isEarlyClobber; Op.Contents.Reg.RegNo = Reg; Op.Contents.Reg.Prev = 0; @@ -420,6 +437,7 @@ IsImp = MO.IsImp; IsKill = MO.IsKill; IsDead = MO.IsDead; + IsUndef = MO.IsUndef; IsEarlyClobber = MO.IsEarlyClobber; SubReg = MO.SubReg; ParentMI = MO.ParentMI; Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h (original) +++ llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h Tue Jun 30 03:49:04 2009 @@ -69,10 +69,6 @@ /// available, unset means the register is currently being used. BitVector RegsAvailable; - /// ImplicitDefed - If bit is set that means the register is defined by an - /// implicit_def instructions. That means it can be clobbered at will. - BitVector ImplicitDefed; - /// CurrDist - Distance from MBB entry to the current instruction MBBI. /// unsigned CurrDist; @@ -117,25 +113,18 @@ bool isUsed(unsigned Reg) const { return !RegsAvailable[Reg]; } bool isUnused(unsigned Reg) const { return RegsAvailable[Reg]; } - bool isImplicitlyDefined(unsigned Reg) const { return ImplicitDefed[Reg]; } - /// getRegsUsed - return all registers currently in use in used. void getRegsUsed(BitVector &used, bool includeReserved); /// setUsed / setUnused - Mark the state of one or a number of registers. /// - void setUsed(unsigned Reg, bool ImpDef = false); - void setUsed(BitVector &Regs, bool ImpDef = false) { + void setUsed(unsigned Reg); + void setUsed(BitVector &Regs) { RegsAvailable &= ~Regs; - if (ImpDef) - ImplicitDefed |= Regs; - else - ImplicitDefed &= ~Regs; } void setUnused(unsigned Reg, const MachineInstr *MI); void setUnused(BitVector &Regs) { RegsAvailable |= Regs; - ImplicitDefed &= ~Regs; } /// FindUnusedReg - Find a unused register of the specified register class Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Jun 30 03:49:04 2009 @@ -1782,8 +1782,12 @@ NewLIs.push_back(&getOrCreateInterval(NewVReg)); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.getReg() == li.reg) + if (MO.isReg() && MO.getReg() == li.reg) { MO.setReg(NewVReg); + MO.setIsUndef(); + if (MO.isKill()) + MO.setIsKill(false); + } } } } Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Jun 30 03:49:04 2009 @@ -120,7 +120,7 @@ /// the specified value. If an operand is known to be an register already, /// the setReg method should be used. void MachineOperand::ChangeToRegister(unsigned Reg, bool isDef, bool isImp, - bool isKill, bool isDead) { + bool isKill, bool isDead, bool isUndef) { // If this operand is already a register operand, use setReg to update the // register's use/def lists. if (isReg()) { @@ -143,6 +143,7 @@ IsImp = isImp; IsKill = isKill; IsDead = isDead; + IsUndef = isUndef; IsEarlyClobber = false; SubReg = 0; } @@ -206,11 +207,11 @@ OS << "%mreg" << getReg(); } - if (getSubReg() != 0) { + if (getSubReg() != 0) OS << ':' << getSubReg(); - } - if (isDef() || isKill() || isDead() || isImplicit() || isEarlyClobber()) { + if (isDef() || isKill() || isDead() || isImplicit() || isUndef() || + isEarlyClobber()) { OS << '<'; bool NeedComma = false; if (isImplicit()) { @@ -224,10 +225,15 @@ OS << "def"; NeedComma = true; } - if (isKill() || isDead()) { + if (isKill() || isDead() || isUndef()) { if (NeedComma) OS << ','; if (isKill()) OS << "kill"; if (isDead()) OS << "dead"; + if (isUndef()) { + if (isKill() || isDead()) + OS << ','; + OS << "undef"; + } } OS << '>'; } Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Tue Jun 30 03:49:04 2009 @@ -905,6 +905,17 @@ DOUT << tri_->getName(physReg) << '\n'; // Note the register is not really in use. vrm_->assignVirt2Phys(cur->reg, physReg); + // Since the register allocator is allowed to assign this virtual register + // physical register that overlaps other live intervals. Mark these + // operands as "Undef" which means later passes, e.g. register scavenger + // can ignore them. + for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(cur->reg), + RE = mri_->reg_end(); RI != RE; ++RI) { + MachineOperand &MO = RI.getOperand(); + MO.setIsUndef(); + if (MO.isKill()) + MO.setIsKill(false); + } return; } Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Tue Jun 30 03:49:04 2009 @@ -36,7 +36,7 @@ bool SeenSuperDef = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg()) + if (!MO.isReg() || MO.isUndef()) continue; if (TRI->isSuperRegister(SubReg, MO.getReg())) { if (MO.isUse()) @@ -57,28 +57,22 @@ } /// setUsed - Set the register and its sub-registers as being used. -void RegScavenger::setUsed(unsigned Reg, bool ImpDef) { +void RegScavenger::setUsed(unsigned Reg) { RegsAvailable.reset(Reg); - ImplicitDefed[Reg] = ImpDef; for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); - unsigned SubReg = *SubRegs; ++SubRegs) { + unsigned SubReg = *SubRegs; ++SubRegs) RegsAvailable.reset(SubReg); - ImplicitDefed[SubReg] = ImpDef; - } } /// setUnused - Set the register and its sub-registers as being unused. void RegScavenger::setUnused(unsigned Reg, const MachineInstr *MI) { RegsAvailable.set(Reg); - ImplicitDefed.reset(Reg); for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) - if (!RedefinesSuperRegPart(MI, Reg, TRI)) { + if (!RedefinesSuperRegPart(MI, Reg, TRI)) RegsAvailable.set(SubReg); - ImplicitDefed.reset(SubReg); - } } void RegScavenger::enterBasicBlock(MachineBasicBlock *mbb) { @@ -94,7 +88,6 @@ if (!MBB) { NumPhysRegs = TRI->getNumRegs(); RegsAvailable.resize(NumPhysRegs); - ImplicitDefed.resize(NumPhysRegs); // Create reserved registers bitvector. ReservedRegs = TRI->getReservedRegs(MF); @@ -113,7 +106,6 @@ ScavengeRestore = NULL; CurrDist = 0; DistanceMap.clear(); - ImplicitDefed.reset(); // All registers started out unused. RegsAvailable.set(); @@ -195,15 +187,13 @@ ScavengeRestore = NULL; } - bool IsImpDef = MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF; - // Separate register operands into 3 classes: uses, defs, earlyclobbers. SmallVector, 4> UseMOs; SmallVector, 4> DefMOs; SmallVector, 4> EarlyClobberMOs; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || MO.getReg() == 0) + if (!MO.isReg() || MO.getReg() == 0 || MO.isUndef()) continue; if (MO.isUse()) UseMOs.push_back(std::make_pair(&MO,i)); @@ -221,14 +211,7 @@ assert(isUsed(Reg) && "Using an undefined register!"); - // Kill of implicit_def defined registers are ignored. e.g. - // entry: 0x2029ab8, LLVM BB @0x1b06080, ID#0: - // Live Ins: %R0 - // %R0 = IMPLICIT_DEF - // %R0 = IMPLICIT_DEF - // STR %R0, %R0, %reg0, 0, 14, %reg0, Mem:ST(4,4) [0x1b06510 + 0] - // %R1 = LDR %R0, %reg0, 24, 14, %reg0, Mem:LD(4,4) [0x1b065bc + 0] - if (MO.isKill() && !isReserved(Reg) && !isImplicitlyDefined(Reg)) { + if (MO.isKill() && !isReserved(Reg)) { KillRegs.set(Reg); // Mark sub-registers as used. @@ -274,10 +257,9 @@ // Implicit def is allowed to "re-define" any register. Similarly, // implicitly defined registers can be clobbered. assert((isReserved(Reg) || isUnused(Reg) || - IsImpDef || isImplicitlyDefined(Reg) || isLiveInButUnusedBefore(Reg, MI, MBB, TRI, MRI)) && "Re-defining a live register!"); - setUsed(Reg, IsImpDef); + setUsed(Reg); } } @@ -297,7 +279,7 @@ SmallVector, 4> EarlyClobberMOs; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || MO.getReg() == 0) + if (!MO.isReg() || MO.getReg() == 0 || MO.isUndef()) continue; if (MO.isUse()) UseMOs.push_back(std::make_pair(&MO,i)); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp Tue Jun 30 03:49:04 2009 @@ -617,7 +617,7 @@ for (; NumVals; --NumVals, ++i) { unsigned Reg = cast(Node->getOperand(i))->getReg(); MI->addOperand(MachineOperand::CreateReg(Reg, true, false, false, - false, 0, true)); + false, false, true)); } break; case 1: // Use of register. Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Jun 30 03:49:04 2009 @@ -356,7 +356,7 @@ SmallVector *KillRegs = NULL) { for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isReg() || !MO.isUse() || !MO.isKill()) + if (!MO.isReg() || !MO.isUse() || !MO.isKill() || MO.isUndef()) continue; unsigned Reg = MO.getReg(); if (TargetRegisterInfo::isVirtualRegister(Reg)) @@ -390,12 +390,12 @@ MachineOperand *DefOp = NULL; for (unsigned i = 0, e = DefMI->getNumOperands(); i != e; ++i) { MachineOperand &MO = DefMI->getOperand(i); - if (MO.isReg() && MO.isDef()) { - if (MO.getReg() == Reg) - DefOp = &MO; - else if (!MO.isDead()) - HasLiveDef = true; - } + if (!MO.isReg() || !MO.isUse() || !MO.isKill() || MO.isUndef()) + continue; + if (MO.getReg() == Reg) + DefOp = &MO; + else if (!MO.isDead()) + HasLiveDef = true; } if (!DefOp) return false; @@ -430,7 +430,7 @@ std::vector &KillOps) { for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isReg() || !MO.isUse()) + if (!MO.isReg() || !MO.isUse() || MO.isUndef()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) @@ -1289,8 +1289,7 @@ if (InvalidateRegDef(PrevMII, *MII, KillRegs[j], HasOtherDef)) { MachineInstr *DeadDef = PrevMII; if (ReMatDefs.count(DeadDef) && !HasOtherDef) { - // FIXME: This assumes a remat def does not have side - // effects. + // FIXME: This assumes a remat def does not have side effects. VRM.RemoveMachineInstrFromMaps(DeadDef); MBB.erase(DeadDef); ++NumDRM; @@ -1569,6 +1568,8 @@ if (MO.isImplicit()) // If the virtual register is implicitly defined, emit a implicit_def // before so scavenger knows it's "defined". + // FIXME: This is a horrible hack done the by register allocator to + // remat a definition with virtual register operand. VirtUseOps.insert(VirtUseOps.begin(), i); else VirtUseOps.push_back(i); @@ -1595,6 +1596,7 @@ MI.getOperand(i).setReg(RReg); MI.getOperand(i).setSubReg(0); if (VRM.isImplicitlyDefined(VirtReg)) + // FIXME: Is this needed? BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(TargetInstrInfo::IMPLICIT_DEF), RReg); continue; @@ -1604,22 +1606,16 @@ if (!MO.isUse()) continue; // Handle defs in the loop below (handle use&def here though) - bool AvoidReload = false; - if (LIs->hasInterval(VirtReg)) { - LiveInterval &LI = LIs->getInterval(VirtReg); - if (!LI.liveAt(LIs->getUseIndex(LI.beginNumber()))) - // Must be defined by an implicit def. It should not be spilled. Note, - // this is for correctness reason. e.g. - // 8 %reg1024 = IMPLICIT_DEF - // 12 %reg1024 = INSERT_SUBREG %reg1024, %reg1025, 2 - // The live range [12, 14) are not part of the r1024 live interval since - // it's defined by an implicit def. It will not conflicts with live - // interval of r1025. Now suppose both registers are spilled, you can - // easily see a situation where both registers are reloaded before - // the INSERT_SUBREG and both target registers that would overlap. - AvoidReload = true; - } - + bool AvoidReload = MO.isUndef(); + // Check if it is defined by an implicit def. It should not be spilled. + // Note, this is for correctness reason. e.g. + // 8 %reg1024 = IMPLICIT_DEF + // 12 %reg1024 = INSERT_SUBREG %reg1024, %reg1025, 2 + // The live range [12, 14) are not part of the r1024 live interval since + // it's defined by an implicit def. It will not conflicts with live + // interval of r1025. Now suppose both registers are spilled, you can + // easily see a situation where both registers are reloaded before + // the INSERT_SUBREG and both target registers that would overlap. bool DoReMat = VRM.isReMaterialized(VirtReg); int SSorRMId = DoReMat ? VRM.getReMatId(VirtReg) : VRM.getStackSlot(VirtReg); Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=74518&r1=74517&r2=74518&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Jun 30 03:49:04 2009 @@ -2459,7 +2459,8 @@ getDefRegState(MO.isDef()) | RegState::Implicit | getKillRegState(MO.isKill()) | - getDeadRegState(MO.isDead())); + getDeadRegState(MO.isDead()) | + getUndefRegState(MO.isUndef())); } // Change CMP32ri r, 0 back to TEST32rr r, r, etc. unsigned NewOpc = 0; Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert.ll?rev=74518&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert.ll Tue Jun 30 03:49:04 2009 @@ -0,0 +1,122 @@ +; RUN: llvm-as < %s | llc -march=arm -mtriple=armv6-apple-darwin9 + + at nn = external global i32 ; [#uses=1] + at al_len = external global i32 ; [#uses=2] + at no_mat = external global i32 ; [#uses=2] + at no_mis = external global i32 ; [#uses=2] +@"\01LC12" = external constant [29 x i8], align 1 ; <[29 x i8]*> [#uses=1] +@"\01LC16" = external constant [33 x i8], align 1 ; <[33 x i8]*> [#uses=1] +@"\01LC17" = external constant [47 x i8], align 1 ; <[47 x i8]*> [#uses=1] + +declare arm_apcscc i32 @printf(i8* nocapture, ...) nounwind + +declare arm_apcscc void @diff(i8*, i8*, i32, i32, i32, i32) nounwind + +define arm_apcscc void @SIM(i8* %A, i8* %B, i32 %M, i32 %N, i32 %K, [256 x i32]* %V, i32 %Q, i32 %R, i32 %nseq) nounwind { +entry: + br i1 undef, label %bb5, label %bb + +bb: ; preds = %bb, %entry + br label %bb + +bb5: ; preds = %entry + br i1 undef, label %bb6, label %bb8 + +bb6: ; preds = %bb6, %bb5 + br i1 undef, label %bb8, label %bb6 + +bb8: ; preds = %bb6, %bb5 + br label %bb15 + +bb9: ; preds = %bb15 + br i1 undef, label %bb10, label %bb11 + +bb10: ; preds = %bb9 + unreachable + +bb11: ; preds = %bb9 + %0 = load i32* undef, align 4 ; [#uses=2] + %1 = add i32 %0, 1 ; [#uses=2] + store i32 %1, i32* undef, align 4 + %2 = load i32* undef, align 4 ; [#uses=1] + store i32 %2, i32* @nn, align 4 + store i32 0, i32* @al_len, align 4 + store i32 0, i32* @no_mat, align 4 + store i32 0, i32* @no_mis, align 4 + %3 = getelementptr i8* %B, i32 %0 ; [#uses=1] + tail call arm_apcscc void @diff(i8* undef, i8* %3, i32 undef, i32 undef, i32 undef, i32 undef) nounwind + %4 = sitofp i32 undef to double ; [#uses=1] + %5 = fdiv double %4, 1.000000e+01 ; [#uses=1] + %6 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([29 x i8]* @"\01LC12", i32 0, i32 0), double %5) nounwind ; [#uses=0] + %7 = load i32* @al_len, align 4 ; [#uses=1] + %8 = load i32* @no_mat, align 4 ; [#uses=1] + %9 = load i32* @no_mis, align 4 ; [#uses=1] + %10 = sub i32 %7, %8 ; [#uses=1] + %11 = sub i32 %10, %9 ; [#uses=1] + %12 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([33 x i8]* @"\01LC16", i32 0, i32 0), i32 %11) nounwind ; [#uses=0] + %13 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([47 x i8]* @"\01LC17", i32 0, i32 0), i32 undef, i32 %1, i32 undef, i32 undef) nounwind ; [#uses=0] + br i1 undef, label %bb15, label %bb12 + +bb12: ; preds = %bb11 + br label %bb228.i + +bb74.i: ; preds = %bb228.i + br i1 undef, label %bb138.i, label %bb145.i + +bb138.i: ; preds = %bb74.i + br label %bb145.i + +bb145.i: ; preds = %bb228.i, %bb138.i, %bb74.i + br i1 undef, label %bb146.i, label %bb151.i + +bb146.i: ; preds = %bb145.i + br i1 undef, label %bb228.i, label %bb151.i + +bb151.i: ; preds = %bb146.i, %bb145.i + br i1 undef, label %bb153.i, label %bb228.i + +bb153.i: ; preds = %bb151.i + br i1 undef, label %bb220.i, label %bb.nph.i98 + +bb.nph.i98: ; preds = %bb153.i + br label %bb158.i + +bb158.i: ; preds = %bb218.i, %bb.nph.i98 + br i1 undef, label %bb168.i, label %bb160.i + +bb160.i: ; preds = %bb158.i + br i1 undef, label %bb161.i, label %bb168.i + +bb161.i: ; preds = %bb160.i + br i1 undef, label %bb168.i, label %bb163.i + +bb163.i: ; preds = %bb161.i + br i1 undef, label %bb167.i, label %bb168.i + +bb167.i: ; preds = %bb163.i + br label %bb168.i + +bb168.i: ; preds = %bb167.i, %bb163.i, %bb161.i, %bb160.i, %bb158.i + br i1 undef, label %bb211.i, label %bb218.i + +bb211.i: ; preds = %bb168.i + br label %bb218.i + +bb218.i: ; preds = %bb211.i, %bb168.i + br i1 undef, label %bb220.i, label %bb158.i + +bb220.i: ; preds = %bb218.i, %bb153.i + br i1 undef, label %bb221.i, label %bb228.i + +bb221.i: ; preds = %bb220.i + br label %bb228.i + +bb228.i: ; preds = %bb221.i, %bb220.i, %bb151.i, %bb146.i, %bb12 + br i1 undef, label %bb74.i, label %bb145.i + +bb15: ; preds = %bb11, %bb8 + br i1 undef, label %return, label %bb9 + +return: ; preds = %bb15 + ret void +} From xerxes at zafena.se Tue Jun 30 04:04:03 2009 From: xerxes at zafena.se (=?ISO-8859-1?Q?Xerxes_R=E5nby?=) Date: Tue, 30 Jun 2009 11:04:03 +0200 Subject: [llvm-commits] [patch] cmake add new cpp files to tools/llvm-mc/CMakeLists.txt and lib/CompilerDriver/CMakeLists.txt Message-ID: <4A49D503.7000702@zafena.se> Hi! Fixing cmake CMakeLists.txt files have started to become my new daily morning routine. ;) This patch fix: Linking CXX executable ../../bin/llvm-mc CMakeFiles/llvm-mc.dir/AsmParser.cpp.o: In function `llvm::AsmParser::ParseRelocatableExpression(llvm::MCValue&)': /usr/src/openembedded/overo/tmp/work/i686-linux/llvm2.6-native-2.5+svnr74515-r1/trunk/tools/llvm-mc/AsmParser.cpp:164: undefined reference to `llvm::AsmExpr::EvaluateAsRelocatable(llvm::MCContext&, llvm::MCValue&) const' CMakeFiles/llvm-mc.dir/AsmParser.cpp.o: In function `llvm::AsmParser::ParseAbsoluteExpression(long long&)': /usr/src/openembedded/overo/tmp/work/i686-linux/llvm2.6-native-2.5+svnr74515-r1/trunk/tools/llvm-mc/AsmParser.cpp:151: undefined reference to `llvm::AsmExpr::EvaluateAsAbsolute(llvm::MCContext&, long long&) const' CMakeFiles/llvm-mc.dir/AsmParser.cpp.o: In function `~AsmConstantExpr': And possibly some CompilerDriver issues. Cheers Xerxes -------------- next part -------------- A non-text attachment was scrubbed... Name: 30jun_add_new_cpp_files_to_cmake.patch Type: text/x-patch Size: 821 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/0425c2b5/attachment.bin From evan.cheng at apple.com Tue Jun 30 04:19:52 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Jun 2009 09:19:52 -0000 Subject: [llvm-commits] [llvm] r74519 - in /llvm/trunk: include/llvm/CodeGen/RegisterScavenging.h lib/CodeGen/RegisterScavenging.cpp test/CodeGen/ARM/2009-06-30-RegScavengerAssert2.ll Message-ID: <200906300919.n5U9JujO003617@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jun 30 04:19:42 2009 New Revision: 74519 URL: http://llvm.org/viewvc/llvm-project?rev=74519&view=rev Log: Temporarily restore the scavenger implicit_def checking code. MachineOperand isUndef mark is not being put on implicit_def of physical registers (created for parameter passing, etc.). Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert2.ll Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h?rev=74519&r1=74518&r2=74519&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h (original) +++ llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h Tue Jun 30 04:19:42 2009 @@ -69,6 +69,10 @@ /// available, unset means the register is currently being used. BitVector RegsAvailable; + /// ImplicitDefed - If bit is set that means the register is defined by an + /// implicit_def instructions. That means it can be clobbered at will. + BitVector ImplicitDefed; + /// CurrDist - Distance from MBB entry to the current instruction MBBI. /// unsigned CurrDist; @@ -113,18 +117,25 @@ bool isUsed(unsigned Reg) const { return !RegsAvailable[Reg]; } bool isUnused(unsigned Reg) const { return RegsAvailable[Reg]; } + bool isImplicitlyDefined(unsigned Reg) const { return ImplicitDefed[Reg]; } + /// getRegsUsed - return all registers currently in use in used. void getRegsUsed(BitVector &used, bool includeReserved); /// setUsed / setUnused - Mark the state of one or a number of registers. /// - void setUsed(unsigned Reg); - void setUsed(BitVector &Regs) { + void setUsed(unsigned Reg, bool ImpDef = false); + void setUsed(BitVector &Regs, bool ImpDef = false) { RegsAvailable &= ~Regs; + if (ImpDef) + ImplicitDefed |= Regs; + else + ImplicitDefed &= ~Regs; } void setUnused(unsigned Reg, const MachineInstr *MI); void setUnused(BitVector &Regs) { RegsAvailable |= Regs; + ImplicitDefed &= ~Regs; } /// FindUnusedReg - Find a unused register of the specified register class Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=74519&r1=74518&r2=74519&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Tue Jun 30 04:19:42 2009 @@ -57,22 +57,28 @@ } /// setUsed - Set the register and its sub-registers as being used. -void RegScavenger::setUsed(unsigned Reg) { +void RegScavenger::setUsed(unsigned Reg, bool ImpDef) { RegsAvailable.reset(Reg); + ImplicitDefed[Reg] = ImpDef; for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); - unsigned SubReg = *SubRegs; ++SubRegs) + unsigned SubReg = *SubRegs; ++SubRegs) { RegsAvailable.reset(SubReg); + ImplicitDefed[SubReg] = ImpDef; + } } /// setUnused - Set the register and its sub-registers as being unused. void RegScavenger::setUnused(unsigned Reg, const MachineInstr *MI) { RegsAvailable.set(Reg); + ImplicitDefed.reset(Reg); for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) - if (!RedefinesSuperRegPart(MI, Reg, TRI)) + if (!RedefinesSuperRegPart(MI, Reg, TRI)) { RegsAvailable.set(SubReg); + ImplicitDefed.reset(SubReg); + } } void RegScavenger::enterBasicBlock(MachineBasicBlock *mbb) { @@ -88,6 +94,7 @@ if (!MBB) { NumPhysRegs = TRI->getNumRegs(); RegsAvailable.resize(NumPhysRegs); + ImplicitDefed.resize(NumPhysRegs); // Create reserved registers bitvector. ReservedRegs = TRI->getReservedRegs(MF); @@ -106,6 +113,7 @@ ScavengeRestore = NULL; CurrDist = 0; DistanceMap.clear(); + ImplicitDefed.reset(); // All registers started out unused. RegsAvailable.set(); @@ -187,6 +195,8 @@ ScavengeRestore = NULL; } + bool IsImpDef = MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF; + // Separate register operands into 3 classes: uses, defs, earlyclobbers. SmallVector, 4> UseMOs; SmallVector, 4> DefMOs; @@ -211,7 +221,14 @@ assert(isUsed(Reg) && "Using an undefined register!"); - if (MO.isKill() && !isReserved(Reg)) { + // Kill of implicit_def defined registers are ignored. e.g. + // entry: 0x2029ab8, LLVM BB @0x1b06080, ID#0: + // Live Ins: %R0 + // %R0 = IMPLICIT_DEF + // %R0 = IMPLICIT_DEF + // STR %R0, %R0, %reg0, 0, 14, %reg0, Mem:ST(4,4) [0x1b06510 + 0] + // %R1 = LDR %R0, %reg0, 24, 14, %reg0, Mem:LD(4,4) [0x1b065bc + 0] + if (MO.isKill() && !isReserved(Reg) && !isImplicitlyDefined(Reg)) { KillRegs.set(Reg); // Mark sub-registers as used. @@ -257,9 +274,10 @@ // Implicit def is allowed to "re-define" any register. Similarly, // implicitly defined registers can be clobbered. assert((isReserved(Reg) || isUnused(Reg) || + IsImpDef || isImplicitlyDefined(Reg) || isLiveInButUnusedBefore(Reg, MI, MBB, TRI, MRI)) && "Re-defining a live register!"); - setUsed(Reg); + setUsed(Reg, IsImpDef); } } Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert2.ll?rev=74519&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert2.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert2.ll Tue Jun 30 04:19:42 2009 @@ -0,0 +1,116 @@ +; RUN: llvm-as < %s | llc -march=arm -mtriple=armv6-apple-darwin9 + + at no_mat = external global i32 ; [#uses=1] + at no_mis = external global i32 ; [#uses=2] +@"\01LC11" = external constant [33 x i8], align 1 ; <[33 x i8]*> [#uses=1] +@"\01LC15" = external constant [33 x i8], align 1 ; <[33 x i8]*> [#uses=1] +@"\01LC17" = external constant [47 x i8], align 1 ; <[47 x i8]*> [#uses=1] + +declare arm_apcscc i32 @printf(i8* nocapture, ...) nounwind + +declare arm_apcscc void @diff(i8*, i8*, i32, i32, i32, i32) nounwind + +define arm_apcscc void @SIM(i8* %A, i8* %B, i32 %M, i32 %N, i32 %K, [256 x i32]* %V, i32 %Q, i32 %R, i32 %nseq) nounwind { +entry: + br i1 undef, label %bb5, label %bb + +bb: ; preds = %bb, %entry + br label %bb + +bb5: ; preds = %entry + br i1 undef, label %bb6, label %bb8 + +bb6: ; preds = %bb6, %bb5 + br i1 undef, label %bb8, label %bb6 + +bb8: ; preds = %bb6, %bb5 + br label %bb15 + +bb9: ; preds = %bb15 + br i1 undef, label %bb10, label %bb11 + +bb10: ; preds = %bb9 + unreachable + +bb11: ; preds = %bb9 + %0 = load i32* undef, align 4 ; [#uses=3] + %1 = add i32 %0, 1 ; [#uses=2] + store i32 %1, i32* undef, align 4 + %2 = load i32* undef, align 4 ; [#uses=2] + %3 = sub i32 %2, %0 ; [#uses=1] + store i32 0, i32* @no_mat, align 4 + store i32 0, i32* @no_mis, align 4 + %4 = getelementptr i8* %B, i32 %0 ; [#uses=1] + tail call arm_apcscc void @diff(i8* undef, i8* %4, i32 undef, i32 %3, i32 undef, i32 undef) nounwind + %5 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([33 x i8]* @"\01LC11", i32 0, i32 0), i32 %tmp13) nounwind ; [#uses=0] + %6 = load i32* @no_mis, align 4 ; [#uses=1] + %7 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([33 x i8]* @"\01LC15", i32 0, i32 0), i32 %6) nounwind ; [#uses=0] + %8 = tail call arm_apcscc i32 (i8*, ...)* @printf(i8* getelementptr ([47 x i8]* @"\01LC17", i32 0, i32 0), i32 undef, i32 %1, i32 undef, i32 %2) nounwind ; [#uses=0] + br i1 undef, label %bb15, label %bb12 + +bb12: ; preds = %bb11 + br label %bb228.i + +bb74.i: ; preds = %bb228.i + br i1 undef, label %bb138.i, label %bb145.i + +bb138.i: ; preds = %bb74.i + br label %bb145.i + +bb145.i: ; preds = %bb228.i, %bb138.i, %bb74.i + br i1 undef, label %bb146.i, label %bb151.i + +bb146.i: ; preds = %bb145.i + br i1 undef, label %bb228.i, label %bb151.i + +bb151.i: ; preds = %bb146.i, %bb145.i + br i1 undef, label %bb153.i, label %bb228.i + +bb153.i: ; preds = %bb151.i + br i1 undef, label %bb220.i, label %bb.nph.i98 + +bb.nph.i98: ; preds = %bb153.i + br label %bb158.i + +bb158.i: ; preds = %bb218.i, %bb.nph.i98 + br i1 undef, label %bb168.i, label %bb160.i + +bb160.i: ; preds = %bb158.i + br i1 undef, label %bb161.i, label %bb168.i + +bb161.i: ; preds = %bb160.i + br i1 undef, label %bb168.i, label %bb163.i + +bb163.i: ; preds = %bb161.i + br i1 undef, label %bb167.i, label %bb168.i + +bb167.i: ; preds = %bb163.i + br label %bb168.i + +bb168.i: ; preds = %bb167.i, %bb163.i, %bb161.i, %bb160.i, %bb158.i + br i1 undef, label %bb211.i, label %bb218.i + +bb211.i: ; preds = %bb168.i + br label %bb218.i + +bb218.i: ; preds = %bb211.i, %bb168.i + br i1 undef, label %bb220.i, label %bb158.i + +bb220.i: ; preds = %bb218.i, %bb153.i + br i1 undef, label %bb221.i, label %bb228.i + +bb221.i: ; preds = %bb220.i + br label %bb228.i + +bb228.i: ; preds = %bb221.i, %bb220.i, %bb151.i, %bb146.i, %bb12 + br i1 undef, label %bb74.i, label %bb145.i + +bb15: ; preds = %bb11, %bb8 + %indvar11 = phi i32 [ 0, %bb8 ], [ %tmp13, %bb11 ] ; [#uses=2] + %tmp13 = add i32 %indvar11, 1 ; [#uses=2] + %count.0 = sub i32 undef, %indvar11 ; [#uses=0] + br i1 undef, label %return, label %bb9 + +return: ; preds = %bb15 + ret void +} From rafael.espindola at gmail.com Tue Jun 30 07:18:38 2009 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 30 Jun 2009 12:18:38 -0000 Subject: [llvm-commits] [llvm] r74523 - in /llvm/trunk: lib/Target/X86/X86FloatingPoint.cpp test/CodeGen/X86/inline-asm-fpstack4.ll Message-ID: <200906301218.n5UCIioJ009485@zion.cs.uiuc.edu> Author: rafael Date: Tue Jun 30 07:18:16 2009 New Revision: 74523 URL: http://llvm.org/viewvc/llvm-project?rev=74523&view=rev Log: Fix PR4484. This was caused by me confounding FP0 and ST(0). Added: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=74523&r1=74522&r2=74523&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Tue Jun 30 07:18:16 2009 @@ -990,16 +990,18 @@ } case X86::FpSET_ST0_32: case X86::FpSET_ST0_64: - case X86::FpSET_ST0_80: + case X86::FpSET_ST0_80: { + unsigned RegOnTop = getStackEntry(0); // FpSET_ST0_80 is generated by copyRegToReg for both function return // and inline assembly with the "st" constrain. In the latter case, - // it is possible for FP0 to be alive after this instruction. - if (!MI->killsRegister(X86::FP0)) { + // it is possible for ST(0) to be alive after this instruction. + if (!MI->killsRegister(X86::FP0 + RegOnTop)) { // Duplicate ST0 duplicateToTop(0, 7 /*temp register*/, I); } --StackTop; // "Forget" we have something on the top of stack! break; + } case X86::FpSET_ST1_32: case X86::FpSET_ST1_64: case X86::FpSET_ST1_80: Added: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll?rev=74523&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll (added) +++ llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll Tue Jun 30 07:18:16 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86 > %t +; PR4484 + +declare x86_fp80 @ceil() + +declare void @test(x86_fp80) + +define void @test2(x86_fp80 %a) { +entry: + %0 = call x86_fp80 @ceil() + call void asm sideeffect "fistpl $0", "{st},~{st}"(x86_fp80 %a) + call void @test(x86_fp80 %0) + ret void +} + From xerxes at zafena.se Tue Jun 30 07:48:16 2009 From: xerxes at zafena.se (=?ISO-8859-1?Q?Xerxes_R=E5nby?=) Date: Tue, 30 Jun 2009 14:48:16 +0200 Subject: [llvm-commits] [patch] cmake target lib dependencies chain update in order to build examples Message-ID: <4A4A0990.9020203@zafena.se> Problem using cmake with -DLLVM_EXAMPLES:BOOL=ON : [ 99%] Built target HowToUseJIT Linking CXX executable ../../bin/Kaleidoscope ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function `llvm::X86TargetMachine::addInstSelector(llvm::PassManagerBase&, llvm::CodeGenOpt::Level)': X86TargetMachine.cpp:(.text+0x720): undefined reference to `llvm::EnableFastISel' X86TargetMachine.cpp:(.text+0x733): undefined reference to `llvm::createDeadMachineInstructionElimPass()' ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function `llvm::X86TargetLowering::~X86TargetLowering()': X86TargetMachine.cpp:(.text._ZN4llvm17X86TargetLoweringD1Ev[llvm::X86TargetLowering::~X86TargetLowering()]+0x17): undefined reference to `llvm::TargetLowering::~TargetLowering()' ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function `llvm::TargetInstrInfoImpl::~TargetInstrInfoImpl()': X86TargetMachine.cpp:(.text._ZN4llvm19TargetInstrInfoImplD2Ev[llvm::TargetInstrInfoImpl::~TargetInstrInfoImpl()]+0x7): undefined reference to `vtable for llvm::TargetInstrInfoImpl' ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function `llvm::LLVMTargetMachine::~LLVMTargetMachine()': X86TargetMachine.cpp:(.text._ZN4llvm17LLVMTargetMachineD2Ev[llvm::LLVMTargetMachine::~LLVMTargetMachine()]+0x7): undefined reference to `vtable for llvm::LLVMTargetMachine' The patch updates all targets with codegen and asmprinter to deal with this issue. Ciao! Xerxes -------------- next part -------------- A non-text attachment was scrubbed... Name: 30jun_cmake_examples_dependencies.patch Type: text/x-patch Size: 4084 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/19fa87fb/attachment.bin From ofv at wanadoo.es Tue Jun 30 09:12:36 2009 From: ofv at wanadoo.es (Oscar Fuentes) Date: Tue, 30 Jun 2009 14:12:36 -0000 Subject: [llvm-commits] [llvm] r74526 - /llvm/trunk/lib/System/Win32/ThreadLocal.inc Message-ID: <200906301412.n5UECgbI013320@zion.cs.uiuc.edu> Author: ofv Date: Tue Jun 30 09:12:28 2009 New Revision: 74526 URL: http://llvm.org/viewvc/llvm-project?rev=74526&view=rev Log: Fixed assert that checks return value of TlsSetValue. See http://msdn.microsoft.com/en-us/library/ms686818(VS.85).aspx Patch by Olaf Krzikalla! Modified: llvm/trunk/lib/System/Win32/ThreadLocal.inc Modified: llvm/trunk/lib/System/Win32/ThreadLocal.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/ThreadLocal.inc?rev=74526&r1=74525&r2=74526&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/ThreadLocal.inc (original) +++ llvm/trunk/lib/System/Win32/ThreadLocal.inc Tue Jun 30 09:12:28 2009 @@ -43,7 +43,7 @@ void ThreadLocalImpl::setInstance(const void* d){ DWORD* tls = static_cast(data); int errorcode = TlsSetValue(*tls, const_cast(d)); - assert(errorcode == 0); + assert(errorcode != 0); } } From dgregor at apple.com Tue Jun 30 09:37:44 2009 From: dgregor at apple.com (Douglas Gregor) Date: Tue, 30 Jun 2009 14:37:44 -0000 Subject: [llvm-commits] [llvm] r74527 - /llvm/trunk/tools/llvm-mc/CMakeLists.txt Message-ID: <200906301437.n5UEbmTU014054@zion.cs.uiuc.edu> Author: dgregor Date: Tue Jun 30 09:37:26 2009 New Revision: 74527 URL: http://llvm.org/viewvc/llvm-project?rev=74527&view=rev Log: Fix CMake build Modified: llvm/trunk/tools/llvm-mc/CMakeLists.txt Modified: llvm/trunk/tools/llvm-mc/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/CMakeLists.txt?rev=74527&r1=74526&r2=74527&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/CMakeLists.txt (original) +++ llvm/trunk/tools/llvm-mc/CMakeLists.txt Tue Jun 30 09:37:26 2009 @@ -2,6 +2,7 @@ add_llvm_tool(llvm-mc llvm-mc.cpp + AsmExpr.cpp AsmLexer.cpp AsmParser.cpp MC-X86Specific.cpp From daniel at zuster.org Tue Jun 30 11:03:04 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 16:03:04 -0000 Subject: [llvm-commits] [llvm] r74529 - /llvm/trunk/tools/llvm-mc/AsmExpr.cpp Message-ID: <200906301603.n5UG36km017175@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jun 30 11:02:47 2009 New Revision: 74529 URL: http://llvm.org/viewvc/llvm-project?rev=74529&view=rev Log: Suppress may-be-used-uninitialized warning. Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=74529&r1=74528&r2=74529&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Tue Jun 30 11:02:47 2009 @@ -132,7 +132,8 @@ // FIXME: We need target hooks for the evaluation. It may be limited in // width, and gas defines the result of comparisons differently from Apple // as (the result is sign extended). - int64_t Result, LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant(); + int64_t LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant(); + int64_t Result = 0; switch (ABE->getOpcode()) { case AsmBinaryExpr::Add: Result = LHS + RHS; break; case AsmBinaryExpr::And: Result = LHS & RHS; break; From daniel at zuster.org Tue Jun 30 11:12:23 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 16:12:23 -0000 Subject: [llvm-commits] [llvm] r74530 - /llvm/trunk/unittests/ADT/TripleTest.cpp Message-ID: <200906301612.n5UGCSw0017468@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jun 30 11:11:58 2009 New Revision: 74530 URL: http://llvm.org/viewvc/llvm-project?rev=74530&view=rev Log: Intentionally break a unittest to test my buildbot gtest command. - Apologies in advance for the noise. Modified: llvm/trunk/unittests/ADT/TripleTest.cpp Modified: llvm/trunk/unittests/ADT/TripleTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=74530&r1=74529&r2=74530&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/TripleTest.cpp (original) +++ llvm/trunk/unittests/ADT/TripleTest.cpp Tue Jun 30 11:11:58 2009 @@ -132,6 +132,8 @@ EXPECT_EQ(Triple::PC, T.getVendor()); EXPECT_EQ(Triple::Darwin, T.getOS()); EXPECT_EQ("i386-pc-darwin", T.getTriple()); + + EXPECT_EQ("true", "false"); } } From daniel at zuster.org Tue Jun 30 11:27:20 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 16:27:20 -0000 Subject: [llvm-commits] [llvm] r74531 - /llvm/trunk/unittests/ADT/TripleTest.cpp Message-ID: <200906301627.n5UGRQYK017989@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jun 30 11:26:57 2009 New Revision: 74531 URL: http://llvm.org/viewvc/llvm-project?rev=74531&view=rev Log: Revert my intentional breakage. Modified: llvm/trunk/unittests/ADT/TripleTest.cpp Modified: llvm/trunk/unittests/ADT/TripleTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=74531&r1=74530&r2=74531&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/TripleTest.cpp (original) +++ llvm/trunk/unittests/ADT/TripleTest.cpp Tue Jun 30 11:26:57 2009 @@ -132,8 +132,6 @@ EXPECT_EQ(Triple::PC, T.getVendor()); EXPECT_EQ(Triple::Darwin, T.getOS()); EXPECT_EQ("i386-pc-darwin", T.getTriple()); - - EXPECT_EQ("true", "false"); } } From rafael.espindola at gmail.com Tue Jun 30 11:40:14 2009 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 30 Jun 2009 16:40:14 -0000 Subject: [llvm-commits] [llvm] r74534 - in /llvm/trunk: lib/Target/X86/X86FloatingPoint.cpp test/CodeGen/X86/inline-asm-fpstack4.ll test/CodeGen/X86/inline-asm-fpstack5.ll Message-ID: <200906301640.n5UGeFSW018353@zion.cs.uiuc.edu> Author: rafael Date: Tue Jun 30 11:40:03 2009 New Revision: 74534 URL: http://llvm.org/viewvc/llvm-project?rev=74534&view=rev Log: Fix PR4485. Avoid unnecessary duplication of operand 0 of X86::FpSET_ST0_80. This duplication would cause one register to remain on the stack at the function return. Added: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack5.ll Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=74534&r1=74533&r2=74534&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Tue Jun 30 11:40:03 2009 @@ -991,13 +991,16 @@ case X86::FpSET_ST0_32: case X86::FpSET_ST0_64: case X86::FpSET_ST0_80: { - unsigned RegOnTop = getStackEntry(0); + unsigned Op0 = getFPReg(MI->getOperand(0)); + // FpSET_ST0_80 is generated by copyRegToReg for both function return // and inline assembly with the "st" constrain. In the latter case, // it is possible for ST(0) to be alive after this instruction. - if (!MI->killsRegister(X86::FP0 + RegOnTop)) { - // Duplicate ST0 + if (!MI->killsRegister(X86::FP0 + Op0)) { + // Duplicate Op0 duplicateToTop(0, 7 /*temp register*/, I); + } else { + moveToTop(Op0, I); } --StackTop; // "Forget" we have something on the top of stack! break; Modified: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll?rev=74534&r1=74533&r2=74534&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll (original) +++ llvm/trunk/test/CodeGen/X86/inline-asm-fpstack4.ll Tue Jun 30 11:40:03 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 > %t +; RUN: llvm-as < %s | llc -march=x86 ; PR4484 declare x86_fp80 @ceil() Added: llvm/trunk/test/CodeGen/X86/inline-asm-fpstack5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-fpstack5.ll?rev=74534&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/inline-asm-fpstack5.ll (added) +++ llvm/trunk/test/CodeGen/X86/inline-asm-fpstack5.ll Tue Jun 30 11:40:03 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86 +; PR4485 + +define void @test(x86_fp80* %a) { +entry: + %0 = load x86_fp80* %a, align 16 + %1 = fmul x86_fp80 %0, 0xK4006B400000000000000 + %2 = fmul x86_fp80 %1, 0xK4012F424000000000000 + tail call void asm sideeffect "fistpl $0", "{st},~{st}"(x86_fp80 %2) + %3 = load x86_fp80* %a, align 16 + %4 = fmul x86_fp80 %3, 0xK4006B400000000000000 + %5 = fmul x86_fp80 %4, 0xK4012F424000000000000 + tail call void asm sideeffect "fistpl $0", "{st},~{st}"(x86_fp80 %5) + ret void +} From resistor at mac.com Tue Jun 30 12:07:11 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 30 Jun 2009 17:07:11 -0000 Subject: [llvm-commits] [llvm] r74537 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp lib/VMCore/LLVMContextImpl.h Message-ID: <200906301707.n5UH7F0i019317@zion.cs.uiuc.edu> Author: resistor Date: Tue Jun 30 12:06:46 2009 New Revision: 74537 URL: http://llvm.org/viewvc/llvm-project?rev=74537&view=rev Log: Fix up header comments to make Chris happy. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.h Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74537&r1=74536&r2=74537&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Tue Jun 30 12:06:46 2009 @@ -6,6 +6,11 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// This file declares LLVMContext, a container of "global" state in LLVM, such +// as the global type and constant uniquing tables. +// +//===----------------------------------------------------------------------===// #ifndef LLVM_LLVMCONTEXT_H #define LLVM_LLVMCONTEXT_H @@ -35,6 +40,11 @@ class APFloat; class Value; +/// This is an important class for using LLVM in a threaded context. It +/// (opaquely) owns and manages the core "global" data of LLVM's core +/// infrastructure, including the type and constant uniquing tables. +/// LLVMContext itself provides no locking guarantees, so you should be careful +/// to have one context per thread. class LLVMContext { LLVMContextImpl* pImpl; public: Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74537&r1=74536&r2=74537&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Jun 30 12:06:46 2009 @@ -6,6 +6,11 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// This file implements LLVMContext, as a wrapper around the opaque +// class LLVMContextImpl. +// +//===----------------------------------------------------------------------===// #include "llvm/LLVMContext.h" #include "llvm/Constants.h" Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=74537&r1=74536&r2=74537&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Jun 30 12:06:46 2009 @@ -6,6 +6,11 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// This file declares LLVMContextImpl, the opaque implementation +// of LLVMContext. +// +//===----------------------------------------------------------------------===// #ifndef LLVM_LLVMCONTEXT_IMPL_H #define LLVM_LLVMCONTEXT_IMPL_H @@ -17,4 +22,4 @@ } -#endif \ No newline at end of file +#endif From sabre at nondot.org Tue Jun 30 12:10:20 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Jun 2009 17:10:20 -0000 Subject: [llvm-commits] [llvm] r74538 - /llvm/trunk/docs/FAQ.html Message-ID: <200906301710.n5UHAKx4019414@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 12:10:19 2009 New Revision: 74538 URL: http://llvm.org/viewvc/llvm-project?rev=74538&view=rev Log: add a FAQ. Modified: llvm/trunk/docs/FAQ.html Modified: llvm/trunk/docs/FAQ.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/FAQ.html?rev=74538&r1=74537&r2=74538&view=diff ============================================================================== --- llvm/trunk/docs/FAQ.html (original) +++ llvm/trunk/docs/FAQ.html Tue Jun 30 12:10:19 2009 @@ -124,6 +124,10 @@

  • What is this "undef" thing that shows up in my code?
  • + +
  • Why does instcombine + simplifycfg turn + a call to a function with a mismatched calling convention into "unreachable"? + Why not make the verifier reject it?
  • @@ -780,6 +784,143 @@ value specified for it.

    + + + + +
    +

    This is a common problem run into by authors of front-ends that are using +custom calling conventions: you need to make sure to set the right calling +convention on both the function and on each call to the function. For example, +this code:

    + +
    +define fastcc void @foo() {
    +        ret void
    +}
    +define void @bar() {
    +        call void @foo( )
    +        ret void
    +}
    +
    + +

    Is optimized to:

    + +
    +define fastcc void @foo() {
    +	ret void
    +}
    +define void @bar() {
    +	unreachable
    +}
    +
    + +

    ... with "opt -instcombine -simplifycfg". This often bites people because +"all their code disappears". Setting the calling convention on the caller and +callee is required for indirect calls to work, so people often ask why not make +the verifier reject this sort of thing.

    + +

    The answer is that this code has undefined behavior, but it is not illegal. +If we made it illegal, then every transformation that could potentially create +this would have to ensure that it doesn't, and there is valid code that can +create this sort of construct (in dead code). The sorts of things that can +cause this to happen are fairly contrived, but we still need to accept them. +Here's an example:

    + +
    +define fastcc void @foo() {
    +        ret void
    +}
    +define internal void @bar(void()* %FP, i1 %cond) {
    +        br i1 %cond, label %T, label %F
    +T:  
    +        call void %FP()
    +        ret void
    +F:
    +        call fastcc void %FP()
    +        ret void
    +}
    +define void @test() {
    +        %X = or i1 false, false
    +        call void @bar(void()* @foo, i1 %X)
    +        ret void
    +} 
    +
    + +

    In this example, "test" always passes @foo/false into bar, which ensures that + it is dynamically called with the right calling conv (thus, the code is + perfectly well defined). If you run this through the inliner, you get this + (the explicit "or" is there so that the inliner doesn't dead code eliminate + a bunch of stuff): +

    + +
    +define fastcc void @foo() {
    +	ret void
    +}
    +define void @test() {
    +	%X = or i1 false, false
    +	br i1 %X, label %T.i, label %F.i
    +T.i:
    +	call void @foo()
    +	br label %bar.exit
    +F.i:
    +	call fastcc void @foo()
    +	br label %bar.exit
    +bar.exit:
    +	ret void
    +}
    +
    + +

    Here you can see that the inlining pass made an undefined call to @foo with + the wrong calling convention. We really don't want to make the inliner have + to know about this sort of thing, so it needs to be valid code. In this case, + dead code elimination can trivially remove the undefined code. However, if %X + was an input argument to @test, the inliner would produce this: +

    + +
    +define fastcc void @foo() {
    +	ret void
    +}
    +
    +define void @test(i1 %X) {
    +	br i1 %X, label %T.i, label %F.i
    +T.i:
    +	call void @foo()
    +	br label %bar.exit
    +F.i:
    +	call fastcc void @foo()
    +	br label %bar.exit
    +bar.exit:
    +	ret void
    +}
    +
    + +

    The interesting thing about this is that %X must be false for the +code to be well-defined, but no amount of dead code elimination will be able to +delete the broken call as unreachable. However, since instcombine/simplifycfg +turns the undefined call into unreachable, we end up with a branch on a +condition that goes to unreachable: a branch to unreachable can never happen, so +"-inline -instcombine -simplifycfg" is able to produce:

    + +
    +define fastcc void @foo() {
    +	ret void
    +}
    +define void @test(i1 %X) {
    +F.i:
    +	call fastcc void @foo()
    +	ret void
    +}
    +
    + +
    +
    From resistor at mac.com Tue Jun 30 12:50:55 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 30 Jun 2009 17:50:55 -0000 Subject: [llvm-commits] [llvm] r74542 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp Message-ID: <200906301751.n5UHp10J020679@zion.cs.uiuc.edu> Author: resistor Date: Tue Jun 30 12:50:28 2009 New Revision: 74542 URL: http://llvm.org/viewvc/llvm-project?rev=74542&view=rev Log: Add wrappers for type construction to LLVMContext. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74542&r1=74541&r2=74542&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Tue Jun 30 12:50:28 2009 @@ -35,6 +35,8 @@ class StructType; class ArrayType; class VectorType; +class OpaqueType; +class FunctionType; class Type; class APInt; class APFloat; @@ -165,6 +167,34 @@ Constant* getConstantVector(const std::vector& V); Constant* getConstantVector(Constant* const* Vals, unsigned NumVals); ConstantVector* getConstantVectorAllOnes(const VectorType* Ty); + + // FunctionType accessors + FunctionType* getFunctionType(const Type* Result, + const std::vector& Params, + bool isVarArg); + + // IntegerType accessors + const IntegerType* getIntegerType(unsigned NumBits); + + // OpaqueType accessors + OpaqueType* getOpaqueType(); + + // StructType accessors + StructType* getStructType(const std::vector& Params, + bool isPacked = false); + + // ArrayType accessors + ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements); + + // PointerType accessors + PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace); + PointerType* getPointerTypeUnqualified(const Type* ElementType); + + // VectorType accessors + VectorType* getVectorType(const Type* ElementType, unsigned NumElements); + VectorType* getVectorTypeInteger(const VectorType* VTy); + VectorType* getVectorTypeExtendedElement(const VectorType* VTy); + VectorType* getVectorTypeTruncatedElement(const VectorType* VTy); }; } Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74542&r1=74541&r2=74542&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Jun 30 12:50:28 2009 @@ -14,6 +14,7 @@ #include "llvm/LLVMContext.h" #include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "LLVMContextImpl.h" using namespace llvm; @@ -382,3 +383,60 @@ ConstantVector* LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) { return ConstantVector::getAllOnesValue(Ty); } + +// FunctionType accessors +FunctionType* LLVMContext::getFunctionType(const Type* Result, + const std::vector& Params, + bool isVarArg) { + return FunctionType::get(Result, Params, isVarArg); +} + +// IntegerType accessors +const IntegerType* LLVMContext::getIntegerType(unsigned NumBits) { + return IntegerType::get(NumBits); +} + +// OpaqueType accessors +OpaqueType* LLVMContext::getOpaqueType() { + return OpaqueType::get(); +} + +// StructType accessors +StructType* LLVMContext::getStructType(const std::vector& Params, + bool isPacked) { + return StructType::get(Params, isPacked); +} + +// ArrayType accessors +ArrayType* LLVMContext::getArrayType(const Type* ElementType, + uint64_t NumElements) { + return ArrayType::get(ElementType, NumElements); +} + +// PointerType accessors +PointerType* LLVMContext::getPointerType(const Type* ElementType, + unsigned AddressSpace) { + return PointerType::get(ElementType, AddressSpace); +} + +PointerType* LLVMContext::getPointerTypeUnqualified(const Type* ElementType) { + return PointerType::getUnqual(ElementType); +} + +// VectorType accessors +VectorType* LLVMContext::getVectorType(const Type* ElementType, + unsigned NumElements) { + return VectorType::get(ElementType, NumElements); +} + +VectorType* LLVMContext::getVectorTypeInteger(const VectorType* VTy) { + return VectorType::getInteger(VTy); +} + +VectorType* LLVMContext::getVectorTypeExtendedElement(const VectorType* VTy) { + return VectorType::getExtendedElementVectorType(VTy); +} + +VectorType* LLVMContext::getVectorTypeTruncatedElement(const VectorType* VTy) { + return VectorType::getTruncatedElementVectorType(VTy); +} From david_goodwin at apple.com Tue Jun 30 13:04:20 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 30 Jun 2009 18:04:20 -0000 Subject: [llvm-commits] [llvm] r74543 - in /llvm/trunk/lib/Target/ARM: ARMConstantIslandPass.cpp ARMISelDAGToDAG.cpp ARMInstrFormats.td ARMInstrInfo.cpp ARMInstrThumb.td ARMInstrThumb2.td ARMMachineFunctionInfo.h Message-ID: <200906301804.n5UI4OTq021073@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jun 30 13:04:13 2009 New Revision: 74543 URL: http://llvm.org/viewvc/llvm-project?rev=74543&view=rev Log: Add conditional and unconditional thumb-2 branch. Add thumb-2 jump table. Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=74543&r1=74542&r2=74543&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Tue Jun 30 13:04:13 2009 @@ -124,6 +124,7 @@ const TargetInstrInfo *TII; ARMFunctionInfo *AFI; bool isThumb; + bool isThumb2; public: static char ID; ARMConstantIslands() : MachineFunctionPass(&ID) {} @@ -213,6 +214,7 @@ TII = Fn.getTarget().getInstrInfo(); AFI = Fn.getInfo(); isThumb = AFI->isThumbFunction(); + isThumb2 = AFI->isThumb2Function(); HasFarJump = false; @@ -376,6 +378,7 @@ int UOpc = Opc; switch (Opc) { case ARM::tBR_JTr: + case ARM::t2BR_JTr: // A Thumb table jump may involve padding; for the offsets to // be right, functions containing these must be 4-byte aligned. AFI->setAlign(2U); @@ -402,6 +405,16 @@ Bits = 11; Scale = 2; break; + case ARM::t2Bcc: + isCond = true; + UOpc = ARM::t2B; + Bits = 20; + Scale = 2; + break; + case ARM::t2B: + Bits = 24; + Scale = 2; + break; } // Record this immediate branch. @@ -575,7 +588,7 @@ // There doesn't seem to be meaningful DebugInfo available; this doesn't // correspond to anything in the source. BuildMI(OrigBB, DebugLoc::getUnknownLoc(), - TII->get(isThumb ? ARM::tB : ARM::B)).addMBB(NewBB); + TII->get(isThumb ? ((isThumb2) ? ARM::t2B : ARM::tB) : ARM::B)).addMBB(NewBB); NumSplit++; // Update the CFG. All succs of OrigBB are now succs of NewBB. @@ -719,7 +732,8 @@ MachineBasicBlock *Succ = *MBB->succ_begin(); MachineBasicBlock *Pred = *MBB->pred_begin(); MachineInstr *PredMI = &Pred->back(); - if (PredMI->getOpcode() == ARM::B || PredMI->getOpcode() == ARM::tB) + if (PredMI->getOpcode() == ARM::B || PredMI->getOpcode() == ARM::tB + || PredMI->getOpcode() == ARM::t2B) return PredMI->getOperand(0).getMBB() == Succ; return false; } @@ -751,7 +765,8 @@ // Thumb jump tables require padding. They should be at the end; // following unconditional branches are removed by AnalyzeBranch. MachineInstr *ThumbJTMI = NULL; - if (prior(MBB->end())->getOpcode() == ARM::tBR_JTr) + if ((prior(MBB->end())->getOpcode() == ARM::tBR_JTr) + || (prior(MBB->end())->getOpcode() == ARM::t2BR_JTr)) ThumbJTMI = prior(MBB->end()); if (ThumbJTMI) { unsigned newMIOffset = GetOffsetOf(ThumbJTMI); @@ -842,7 +857,16 @@ /// getUnconditionalBrDisp - Returns the maximum displacement that can fit in /// the specific unconditional branch instruction. static inline unsigned getUnconditionalBrDisp(int Opc) { - return (Opc == ARM::tB) ? ((1<<10)-1)*2 : ((1<<23)-1)*4; + switch (Opc) { + case ARM::tB: + return ((1<<10)-1)*2; + case ARM::t2B: + return ((1<<23)-1)*2; + default: + break; + } + + return ((1<<23)-1)*4; } /// AcceptWater - Small amount of common code factored out of the following. @@ -938,7 +962,7 @@ // range, but if the preceding conditional branch is out of range, the // targets will be exchanged, and the altered branch may be out of // range, so the machinery has to know about it. - int UncondBr = isThumb ? ARM::tB : ARM::B; + int UncondBr = isThumb ? ((isThumb2) ? ARM::t2B : ARM::tB) : ARM::B; BuildMI(UserMBB, DebugLoc::getUnknownLoc(), TII->get(UncondBr)).addMBB(*NewMBB); unsigned MaxDisp = getUnconditionalBrDisp(UncondBr); @@ -1168,7 +1192,7 @@ ARMConstantIslands::FixUpUnconditionalBr(MachineFunction &Fn, ImmBranch &Br) { MachineInstr *MI = Br.MI; MachineBasicBlock *MBB = MI->getParent(); - assert(isThumb && "Expected a Thumb function!"); + assert(isThumb && !isThumb2 && "Expected a Thumb-1 function!"); // Use BL to implement far jump. Br.MaxDisp = (1 << 21) * 2; Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=74543&r1=74542&r2=74543&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Jun 30 13:04:13 2009 @@ -858,7 +858,12 @@ // Emits: (tBcc:void (bb:Other):$dst, (imm:i32):$cc) // Pattern complexity = 6 cost = 1 size = 0 - unsigned Opc = Subtarget->isThumb() ? ARM::tBcc : ARM::Bcc; + // Pattern: (ARMbrcond:void (bb:Other):$dst, (imm:i32):$cc) + // Emits: (t2Bcc:void (bb:Other):$dst, (imm:i32):$cc) + // Pattern complexity = 6 cost = 1 size = 0 + + unsigned Opc = Subtarget->isThumb() ? + ((Subtarget->hasThumb2()) ? ARM::t2Bcc : ARM::tBcc) : ARM::Bcc; SDValue Chain = Op.getOperand(0); SDValue N1 = Op.getOperand(1); SDValue N2 = Op.getOperand(2); Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=74543&r1=74542&r2=74543&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Tue Jun 30 13:04:13 2009 @@ -801,6 +801,10 @@ : Thumb1I; class T1Is pattern> : Thumb1I; +class T1Ix2 pattern> + : Thumb1I; +class T1JTI pattern> + : Thumb1I; // Two-address instructions class T1It pattern> @@ -865,6 +869,8 @@ class T2XI pattern> : Thumb2XI; +class T2JTI pattern> + : Thumb2XI; // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode. class T2Pat : Pat { Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=74543&r1=74542&r2=74543&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Tue Jun 30 13:04:13 2009 @@ -350,11 +350,11 @@ // If there is only one terminator instruction, process it. unsigned LastOpc = LastInst->getOpcode(); if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) { - if (LastOpc == ARM::B || LastOpc == ARM::tB) { + if (LastOpc == ARM::B || LastOpc == ARM::tB || LastOpc == ARM::t2B) { TBB = LastInst->getOperand(0).getMBB(); return false; } - if (LastOpc == ARM::Bcc || LastOpc == ARM::tBcc) { + if (LastOpc == ARM::Bcc || LastOpc == ARM::tBcc || LastOpc == ARM::t2Bcc) { // Block ends with fall-through condbranch. TBB = LastInst->getOperand(0).getMBB(); Cond.push_back(LastInst->getOperand(1)); @@ -371,10 +371,12 @@ if (SecondLastInst && I != MBB.begin() && isUnpredicatedTerminator(--I)) return true; - // If the block ends with ARM::B/ARM::tB and a ARM::Bcc/ARM::tBcc, handle it. + // If the block ends with ARM::B/ARM::tB/ARM::t2B and a + // ARM::Bcc/ARM::tBcc/ARM::t2Bcc, handle it. unsigned SecondLastOpc = SecondLastInst->getOpcode(); if ((SecondLastOpc == ARM::Bcc && LastOpc == ARM::B) || - (SecondLastOpc == ARM::tBcc && LastOpc == ARM::tB)) { + (SecondLastOpc == ARM::tBcc && LastOpc == ARM::tB) || + (SecondLastOpc == ARM::t2Bcc && LastOpc == ARM::t2B)) { TBB = SecondLastInst->getOperand(0).getMBB(); Cond.push_back(SecondLastInst->getOperand(1)); Cond.push_back(SecondLastInst->getOperand(2)); @@ -384,8 +386,9 @@ // If the block ends with two unconditional branches, handle it. The second // one is not executed, so remove it. - if ((SecondLastOpc == ARM::B || SecondLastOpc==ARM::tB) && - (LastOpc == ARM::B || LastOpc == ARM::tB)) { + if ((SecondLastOpc == ARM::B || SecondLastOpc==ARM::tB || + SecondLastOpc==ARM::t2B) && + (LastOpc == ARM::B || LastOpc == ARM::tB || LastOpc == ARM::t2B)) { TBB = SecondLastInst->getOperand(0).getMBB(); I = LastInst; if (AllowModify) @@ -397,8 +400,9 @@ // branch. The branch folder can create these, and we must get rid of them for // correctness of Thumb constant islands. if ((SecondLastOpc == ARM::BR_JTr || SecondLastOpc==ARM::BR_JTm || - SecondLastOpc == ARM::BR_JTadd || SecondLastOpc==ARM::tBR_JTr) && - (LastOpc == ARM::B || LastOpc == ARM::tB)) { + SecondLastOpc == ARM::BR_JTadd || SecondLastOpc==ARM::tBR_JTr || + SecondLastOpc==ARM::t2BR_JTr) && + (LastOpc == ARM::B || LastOpc == ARM::tB || LastOpc == ARM::t2B)) { I = LastInst; if (AllowModify) I->eraseFromParent(); @@ -413,8 +417,10 @@ unsigned ARMBaseInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const { MachineFunction &MF = *MBB.getParent(); ARMFunctionInfo *AFI = MF.getInfo(); - int BOpc = AFI->isThumbFunction() ? ARM::tB : ARM::B; - int BccOpc = AFI->isThumbFunction() ? ARM::tBcc : ARM::Bcc; + int BOpc = AFI->isThumbFunction() ? + (AFI->isThumb2Function() ? ARM::t2B : ARM::tB) : ARM::B; + int BccOpc = AFI->isThumbFunction() ? + (AFI->isThumb2Function() ? ARM::t2Bcc : ARM::tBcc) : ARM::Bcc; MachineBasicBlock::iterator I = MBB.end(); if (I == MBB.begin()) return 0; @@ -445,8 +451,10 @@ DebugLoc dl = DebugLoc::getUnknownLoc(); MachineFunction &MF = *MBB.getParent(); ARMFunctionInfo *AFI = MF.getInfo(); - int BOpc = AFI->isThumbFunction() ? ARM::tB : ARM::B; - int BccOpc = AFI->isThumbFunction() ? ARM::tBcc : ARM::Bcc; + int BOpc = AFI->isThumbFunction() ? + (AFI->isThumb2Function() ? ARM::t2B : ARM::tB) : ARM::B; + int BccOpc = AFI->isThumbFunction() ? + (AFI->isThumb2Function() ? ARM::t2Bcc : ARM::tBcc) : ARM::Bcc; // Shouldn't be a fall through. assert(TBB && "InsertBranch must not be told to insert a fallthrough"); @@ -695,8 +703,10 @@ case ARM::tBX_RET_vararg: case ARM::tPOP_RET: case ARM::B: - case ARM::tB: // Uncond branch. + case ARM::tB: + case ARM::t2B: // Uncond branch. case ARM::tBR_JTr: + case ARM::t2BR_JTr: case ARM::BR_JTr: // Jumptable branch. case ARM::BR_JTm: // Jumptable branch through mem. case ARM::BR_JTadd: // Jumptable branch add to pc. @@ -721,8 +731,9 @@ PredicateInstruction(MachineInstr *MI, const SmallVectorImpl &Pred) const { unsigned Opc = MI->getOpcode(); - if (Opc == ARM::B || Opc == ARM::tB) { - MI->setDesc(get(Opc == ARM::B ? ARM::Bcc : ARM::tBcc)); + if (Opc == ARM::B || Opc == ARM::tB || Opc == ARM::t2B) { + MI->setDesc(get((Opc == ARM::B) ? ARM::Bcc : + ((Opc == ARM::tB) ? ARM::tBcc : ARM::t2Bcc))); MI->addOperand(MachineOperand::CreateImm(Pred[0].getImm())); MI->addOperand(MachineOperand::CreateReg(Pred[1].getReg(), false)); return true; @@ -835,7 +846,8 @@ case ARM::BR_JTr: case ARM::BR_JTm: case ARM::BR_JTadd: - case ARM::tBR_JTr: { + case ARM::tBR_JTr: + case ARM::t2BR_JTr: { // These are jumptable branches, i.e. a branch followed by an inlined // jumptable. The size is 4 + 4 * number of entries. unsigned NumOps = TID.getNumOperands(); @@ -853,7 +865,8 @@ // bytes, we can use 16-bit entries instead. Then there won't be an // alignment issue. return getNumJTEntries(JT, JTI) * 4 + - (MI->getOpcode()==ARM::tBR_JTr ? 2 : 4); + ((MI->getOpcode()==ARM::tBR_JTr || + MI->getOpcode()==ARM::t2BR_JTr) ? 2 : 4); } default: // Otherwise, pseudo-instruction sizes are zero. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=74543&r1=74542&r2=74543&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Tue Jun 30 13:04:13 2009 @@ -187,23 +187,24 @@ let isBranch = 1, isTerminator = 1 in { let isBarrier = 1 in { let isPredicable = 1 in - def tB : TI<(outs), (ins brtarget:$target), "b $target", - [(br bb:$target)]>; + def tB : T1I<(outs), (ins brtarget:$target), "b $target", + [(br bb:$target)]>; // Far jump - def tBfar : TIx2<(outs), (ins brtarget:$target), "bl $target\t@ far jump",[]>; + def tBfar : T1Ix2<(outs), (ins brtarget:$target), + "bl $target\t@ far jump",[]>; - def tBR_JTr : TJTI<(outs), - (ins tGPR:$target, jtblock_operand:$jt, i32imm:$id), - "cpy pc, $target \n\t.align\t2\n$jt", - [(ARMbrjt tGPR:$target, tjumptable:$jt, imm:$id)]>; + def tBR_JTr : T1JTI<(outs), + (ins tGPR:$target, jtblock_operand:$jt, i32imm:$id), + "cpy pc, $target \n\t.align\t2\n$jt", + [(ARMbrjt tGPR:$target, tjumptable:$jt, imm:$id)]>; } } // FIXME: should be able to write a pattern for ARMBrcond, but can't use // a two-value operand where a dag node expects two operands. :( let isBranch = 1, isTerminator = 1 in - def tBcc : TI<(outs), (ins brtarget:$target, pred:$cc), "b$cc $target", + def tBcc : T1I<(outs), (ins brtarget:$target, pred:$cc), "b$cc $target", [/*(ARMbrcond bb:$target, imm:$cc)*/]>; //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74543&r1=74542&r2=74543&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jun 30 13:04:13 2009 @@ -688,6 +688,28 @@ // FIXME: Conditional moves +//===----------------------------------------------------------------------===// +// Control-Flow Instructions +// + +let isBranch = 1, isTerminator = 1, isBarrier = 1 in { +let isPredicable = 1 in +def t2B : T2XI<(outs), (ins brtarget:$target), + "b $target", + [(br bb:$target)]>; + +def t2BR_JTr : T2JTI<(outs), + (ins tGPR:$target, jtblock_operand:$jt, i32imm:$id), + "cpy pc, $target \n\t.align\t2\n$jt", + [(ARMbrjt tGPR:$target, tjumptable:$jt, imm:$id)]>; +} + +// FIXME: should be able to write a pattern for ARMBrcond, but can't use +// a two-value operand where a dag node expects two operands. :( +let isBranch = 1, isTerminator = 1 in +def t2Bcc : T2I<(outs), (ins brtarget:$target), + "b", " $target", + [/*(ARMbrcond bb:$target, imm:$cc)*/]>; //===----------------------------------------------------------------------===// // Non-Instruction Patterns Modified: llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h?rev=74543&r1=74542&r2=74543&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h Tue Jun 30 13:04:13 2009 @@ -30,6 +30,11 @@ /// Used to initialized Align, so must precede it. bool isThumb; + /// hasThumb2 - True if the target architecture supports Thumb2. Do not use + /// to determine if function is compiled under Thumb mode, for that use + /// 'isThumb'. + bool hasThumb2; + /// Align - required alignment. ARM functions and Thumb functions with /// constant pools require 4-byte alignment; other Thumb functions /// require only 2-byte alignment. @@ -91,7 +96,8 @@ public: ARMFunctionInfo() : - isThumb(false), + isThumb(false), + hasThumb2(false), Align(2U), VarArgsRegSaveSize(0), HasStackFrame(false), LRSpilledForFarJump(false), R3IsLiveIn(false), @@ -102,6 +108,7 @@ explicit ARMFunctionInfo(MachineFunction &MF) : isThumb(MF.getTarget().getSubtarget().isThumb()), + hasThumb2(MF.getTarget().getSubtarget().hasThumb2()), Align(isThumb ? 1U : 2U), VarArgsRegSaveSize(0), HasStackFrame(false), LRSpilledForFarJump(false), R3IsLiveIn(false), @@ -112,6 +119,7 @@ JumpTableUId(0), ConstPoolEntryUId(0) {} bool isThumbFunction() const { return isThumb; } + bool isThumb2Function() const { return isThumb && hasThumb2; } unsigned getAlign() const { return Align; } void setAlign(unsigned a) { Align = a; } From dalej at apple.com Tue Jun 30 13:14:06 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 18:14:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74544 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906301814.n5UIEDsW021402@zion.cs.uiuc.edu> Author: johannes Date: Tue Jun 30 13:13:46 2009 New Revision: 74544 URL: http://llvm.org/viewvc/llvm-project?rev=74544&view=rev Log: Next bit of multiple alternative constraints handling in asm's. This implements the mechanics of getting things to work after we've picked a tuple of constraints. Currently the 2nd tuple is picked arbitrarily, which of course leads, randomly, to some new successes and new failures in the bits of the gcc testsuite that exercise this. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74544&r1=74543&r2=74544&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 30 13:13:46 2009 @@ -3986,15 +3986,61 @@ /// constraints. Look through the operands and constraint possibilities /// and pick a tuple where all the operands match. Replace the strings /// in Constraints[] with the shorter strings from that tuple (malloc'ed, -/// caller is responsible for cleaning it up). +/// caller is responsible for cleaning it up). Later processing can alter what +/// Constraints points to, so to make sure we delete everything, the addresses +/// of everything we allocated also are returned in ReplacementStrings. +/// Casting back and forth from char* to const char* is Ugly, but we have to +/// interface with C code that expects const char*. /// /// gcc's algorithm for picking "the best" tuple is quite complicated, and /// is performed after things like SROA, not before. At the moment we are /// just trying to pick one that will work. This may get refined. static void -ChooseConstraintTuple(const char **Constraints, tree exp, unsigned NumInputs, - unsigned NumOutputs, unsigned NumChoices) +ChooseConstraintTuple (const char **Constraints, tree exp, unsigned NumInputs, + unsigned NumOutputs, unsigned NumChoices, + const char **ReplacementStrings) { + unsigned int CommasToSkip; + // TEMPORARY: assume the second set of constraints is the right one. + // This is totally wrong, of course, but allows the mechanics of string + // handling to be tested. + CommasToSkip = 1; + + for (unsigned int i=0; i1) { + ReplacementStrings = + (const char **)alloca((NumOutputs + NumInputs) * sizeof(const char *)); + ChooseConstraintTuple(Constraints, exp, NumInputs, NumOutputs, NumChoices, + ReplacementStrings); + } std::vector CallOps; std::vector CallArgTypes; @@ -4087,9 +4138,11 @@ const char *Constraint = Constraints[ValNum]; bool IsInOut, AllowsReg, AllowsMem; if (!parse_output_constraint(&Constraint, ValNum, NumInputs, NumOutputs, - &AllowsMem, &AllowsReg, &IsInOut)) + &AllowsMem, &AllowsReg, &IsInOut)) { + if (NumChoices>1) + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return 0; - + } assert(Constraint[0] == '=' && "Not an output constraint?"); // Output constraints must be addressable if they aren't simple register @@ -4156,9 +4209,11 @@ bool AllowsReg, AllowsMem; if (!parse_input_constraint(Constraints+ValNum, ValNum-NumOutputs, NumInputs, NumOutputs, NumInOut, - Constraints, &AllowsMem, &AllowsReg)) + Constraints, &AllowsMem, &AllowsReg)) { + if (NumChoices>1) + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return 0; - + } bool isIndirect = false; if (AllowsReg || !AllowsMem) { // Register operand. const Type *LLVMTy = ConvertType(type); @@ -4211,6 +4266,8 @@ error("%Hunsupported inline asm: input constraint with a matching " "output constraint of incompatible type!", &EXPR_LOCATION(exp)); + if (NumChoices>1) + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return 0; } unsigned OTyBits = TD.getTypeSizeInBits(OTy); @@ -4267,6 +4324,8 @@ // FIXME: Figure out what ASM_USES means. error("%Hcode warrior/ms asm not supported yet in %qs", &EXPR_LOCATION(exp), TREE_STRING_POINTER(ASM_STRING(exp))); + if (NumChoices>1) + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return 0; } @@ -4284,6 +4343,8 @@ case -2: // Invalid. error("%Hunknown register name %qs in %", &EXPR_LOCATION(exp), RegName); + if (NumChoices>1) + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return 0; case -3: // cc ConstraintStr += ",~{cc}"; @@ -4320,6 +4381,8 @@ // Make sure we're created a valid inline asm expression. if (!InlineAsm::Verify(FTy, ConstraintStr)) { error("%HInvalid or unsupported inline assembly!", &EXPR_LOCATION(exp)); + if (NumChoices>1) + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return 0; } @@ -4345,6 +4408,8 @@ if (const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo()) TAI->ExpandInlineAsm(CV); + if (NumChoices>1) + FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs); return 0; } From dalej at apple.com Tue Jun 30 13:46:30 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 18:46:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74545 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906301846.n5UIkXFx022628@zion.cs.uiuc.edu> Author: johannes Date: Tue Jun 30 13:46:16 2009 New Revision: 74545 URL: http://llvm.org/viewvc/llvm-project?rev=74545&view=rev Log: Humor versions of gcc that are too stupid to figure out ReplacementStrings can't be used undefined. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74545&r1=74544&r2=74545&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 30 13:46:16 2009 @@ -4109,7 +4109,7 @@ // If there are multiple constraint tuples, pick one. Constraints is // altered to point to shorter strings (which are malloc'ed), and everything // below Just Works as in the NumChoices==1 case. - const char** ReplacementStrings; + const char** ReplacementStrings = 0; if (NumChoices>1) { ReplacementStrings = (const char **)alloca((NumOutputs + NumInputs) * sizeof(const char *)); From kremenek at apple.com Tue Jun 30 14:05:30 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 30 Jun 2009 19:05:30 -0000 Subject: [llvm-commits] [llvm] r74546 - /llvm/tags/checker/checker-0.212/ Message-ID: <200906301905.n5UJ5Uin023288@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jun 30 14:05:29 2009 New Revision: 74546 URL: http://llvm.org/viewvc/llvm-project?rev=74546&view=rev Log: Tagging checker-0.212. Added: llvm/tags/checker/checker-0.212/ - copied from r74545, llvm/trunk/ From greened at obbligato.org Tue Jun 30 14:25:00 2009 From: greened at obbligato.org (David Greene) Date: Tue, 30 Jun 2009 19:25:00 -0000 Subject: [llvm-commits] [llvm] r74548 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86ATTAsmPrinter.h AsmPrinter/X86IntelAsmPrinter.h X86InstrInfo.td Message-ID: <200906301925.n5UJP1Pg023960@zion.cs.uiuc.edu> Author: greened Date: Tue Jun 30 14:24:59 2009 New Revision: 74548 URL: http://llvm.org/viewvc/llvm-project?rev=74548&view=rev Log: Add 256-bit memory operand support. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=74548&r1=74547&r2=74548&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Tue Jun 30 14:24:59 2009 @@ -140,6 +140,9 @@ void printi128mem(const MachineInstr *MI, unsigned OpNo) { printMemReference(MI, OpNo); } + void printi256mem(const MachineInstr *MI, unsigned OpNo) { + printMemReference(MI, OpNo); + } void printf32mem(const MachineInstr *MI, unsigned OpNo) { printMemReference(MI, OpNo); } @@ -152,6 +155,9 @@ void printf128mem(const MachineInstr *MI, unsigned OpNo) { printMemReference(MI, OpNo); } + void printf256mem(const MachineInstr *MI, unsigned OpNo) { + printMemReference(MI, OpNo); + } void printlea32mem(const MachineInstr *MI, unsigned OpNo) { printLeaMemReference(MI, OpNo); } Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h?rev=74548&r1=74547&r2=74548&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h Tue Jun 30 14:24:59 2009 @@ -76,6 +76,10 @@ O << "XMMWORD PTR "; printMemReference(MI, OpNo); } + void printi256mem(const MachineInstr *MI, unsigned OpNo) { + O << "YMMWORD PTR "; + printMemReference(MI, OpNo); + } void printf32mem(const MachineInstr *MI, unsigned OpNo) { O << "DWORD PTR "; printMemReference(MI, OpNo); @@ -92,6 +96,10 @@ O << "XMMWORD PTR "; printMemReference(MI, OpNo); } + void printf256mem(const MachineInstr *MI, unsigned OpNo) { + O << "YMMWORD PTR "; + printMemReference(MI, OpNo); + } void printlea32mem(const MachineInstr *MI, unsigned OpNo) { O << "DWORD PTR "; printLeaMemReference(MI, OpNo); Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=74548&r1=74547&r2=74548&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Jun 30 14:24:59 2009 @@ -180,10 +180,12 @@ def i32mem : X86MemOperand<"printi32mem">; def i64mem : X86MemOperand<"printi64mem">; def i128mem : X86MemOperand<"printi128mem">; +def i256mem : X86MemOperand<"printi256mem">; def f32mem : X86MemOperand<"printf32mem">; def f64mem : X86MemOperand<"printf64mem">; def f80mem : X86MemOperand<"printf80mem">; def f128mem : X86MemOperand<"printf128mem">; +def f256mem : X86MemOperand<"printf256mem">; // A version of i8mem for use on x86-64 that uses GR64_NOREX instead of // plain GR64, so that it doesn't potentially require a REX prefix. From david_goodwin at apple.com Tue Jun 30 14:50:31 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 30 Jun 2009 19:50:31 -0000 Subject: [llvm-commits] [llvm] r74549 - in /llvm/trunk: lib/Target/ARM/ARMCodeEmitter.cpp lib/Target/ARM/ARMConstantIslandPass.cpp lib/Target/ARM/ARMInstrInfo.cpp lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-jumptbl.ll Message-ID: <200906301950.n5UJoaYf025220@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jun 30 14:50:22 2009 New Revision: 74549 URL: http://llvm.org/viewvc/llvm-project?rev=74549&view=rev Log: Improve Thumb-2 jump table support. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-jumptbl.ll Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=74549&r1=74548&r2=74549&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Tue Jun 30 14:50:22 2009 @@ -1155,16 +1155,17 @@ const TargetInstrDesc &TID = MI.getDesc(); // Handle jump tables. - if (TID.Opcode == ARM::BR_JTr || TID.Opcode == ARM::BR_JTadd) { + if (TID.Opcode == ARM::BR_JTr || TID.Opcode == ARM::BR_JTadd || + TID.Opcode == ARM::t2BR_JTr || TID.Opcode == ARM::t2BR_JTadd) { // First emit a ldr pc, [] instruction. emitDataProcessingInstruction(MI, ARM::PC); // Then emit the inline jump table. - unsigned JTIndex = (TID.Opcode == ARM::BR_JTr) + unsigned JTIndex = (TID.Opcode == ARM::BR_JTr || TID.Opcode == ARM::t2BR_JTr) ? MI.getOperand(1).getIndex() : MI.getOperand(2).getIndex(); emitInlineJumpTable(JTIndex); return; - } else if (TID.Opcode == ARM::BR_JTm) { + } else if (TID.Opcode == ARM::BR_JTm || TID.Opcode == ARM::t2BR_JTm) { // First emit a ldr pc, [] instruction. emitLoadStoreInstruction(MI, ARM::PC); Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=74549&r1=74548&r2=74549&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Tue Jun 30 14:50:22 2009 @@ -379,6 +379,8 @@ switch (Opc) { case ARM::tBR_JTr: case ARM::t2BR_JTr: + case ARM::t2BR_JTm: + case ARM::t2BR_JTadd: // A Thumb table jump may involve padding; for the offsets to // be right, functions containing these must be 4-byte aligned. AFI->setAlign(2U); @@ -766,7 +768,9 @@ // following unconditional branches are removed by AnalyzeBranch. MachineInstr *ThumbJTMI = NULL; if ((prior(MBB->end())->getOpcode() == ARM::tBR_JTr) - || (prior(MBB->end())->getOpcode() == ARM::t2BR_JTr)) + || (prior(MBB->end())->getOpcode() == ARM::t2BR_JTr) + || (prior(MBB->end())->getOpcode() == ARM::t2BR_JTm) + || (prior(MBB->end())->getOpcode() == ARM::t2BR_JTadd)) ThumbJTMI = prior(MBB->end()); if (ThumbJTMI) { unsigned newMIOffset = GetOffsetOf(ThumbJTMI); Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=74549&r1=74548&r2=74549&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Tue Jun 30 14:50:22 2009 @@ -401,7 +401,8 @@ // correctness of Thumb constant islands. if ((SecondLastOpc == ARM::BR_JTr || SecondLastOpc==ARM::BR_JTm || SecondLastOpc == ARM::BR_JTadd || SecondLastOpc==ARM::tBR_JTr || - SecondLastOpc==ARM::t2BR_JTr) && + SecondLastOpc == ARM::t2BR_JTr || SecondLastOpc==ARM::t2BR_JTm || + SecondLastOpc == ARM::t2BR_JTadd) && (LastOpc == ARM::B || LastOpc == ARM::tB || LastOpc == ARM::t2B)) { I = LastInst; if (AllowModify) @@ -708,7 +709,9 @@ case ARM::tBR_JTr: case ARM::t2BR_JTr: case ARM::BR_JTr: // Jumptable branch. + case ARM::t2BR_JTm: case ARM::BR_JTm: // Jumptable branch through mem. + case ARM::t2BR_JTadd: case ARM::BR_JTadd: // Jumptable branch add to pc. return true; default: return false; @@ -846,8 +849,10 @@ case ARM::BR_JTr: case ARM::BR_JTm: case ARM::BR_JTadd: - case ARM::tBR_JTr: - case ARM::t2BR_JTr: { + case ARM::t2BR_JTr: + case ARM::t2BR_JTm: + case ARM::t2BR_JTadd: + case ARM::tBR_JTr: { // These are jumptable branches, i.e. a branch followed by an inlined // jumptable. The size is 4 + 4 * number of entries. unsigned NumOps = TID.getNumOperands(); @@ -865,8 +870,7 @@ // bytes, we can use 16-bit entries instead. Then there won't be an // alignment issue. return getNumJTEntries(JT, JTI) * 4 + - ((MI->getOpcode()==ARM::tBR_JTr || - MI->getOpcode()==ARM::t2BR_JTr) ? 2 : 4); + ((MI->getOpcode()==ARM::tBR_JTr) ? 2 : 4); } default: // Otherwise, pseudo-instruction sizes are zero. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74549&r1=74548&r2=74549&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jun 30 14:50:22 2009 @@ -698,11 +698,25 @@ "b $target", [(br bb:$target)]>; -def t2BR_JTr : T2JTI<(outs), - (ins tGPR:$target, jtblock_operand:$jt, i32imm:$id), - "cpy pc, $target \n\t.align\t2\n$jt", - [(ARMbrjt tGPR:$target, tjumptable:$jt, imm:$id)]>; -} +let isNotDuplicable = 1, isIndirectBranch = 1 in { +def t2BR_JTr : T2JTI<(outs), (ins GPR:$target, jtblock_operand:$jt, i32imm:$id), + "mov pc, $target \n$jt", + [(ARMbrjt GPR:$target, tjumptable:$jt, imm:$id)]>; + +def t2BR_JTm : + T2JTI<(outs), + (ins t2addrmode_so_reg:$target, jtblock_operand:$jt, i32imm:$id), + "ldr pc, $target \n$jt", + [(ARMbrjt (i32 (load t2addrmode_so_reg:$target)), tjumptable:$jt, + imm:$id)]>; + +def t2BR_JTadd : + T2JTI<(outs), + (ins GPR:$target, GPR:$idx, jtblock_operand:$jt, i32imm:$id), + "add pc, $target, $idx \n$jt", + [(ARMbrjt (add GPR:$target, GPR:$idx), tjumptable:$jt, imm:$id)]>; +} // isNotDuplicate, isIndirectBranch +} // isBranch, isTerminator, isBarrier // FIXME: should be able to write a pattern for ARMBrcond, but can't use // a two-value operand where a dag node expects two operands. :( Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-jumptbl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-jumptbl.ll?rev=74549&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-jumptbl.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-jumptbl.ll Tue Jun 30 14:50:22 2009 @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldr\\W*pc,} | count 1 + +define i32 @foo(i32 %a) nounwind { +entry: + switch i32 %a, label %bb4 [ + i32 1, label %bb5 + i32 2, label %bb1 + i32 3, label %bb2 + i32 5, label %bb3 + ] + +bb1: ; preds = %entry + ret i32 1 + +bb2: ; preds = %entry + ret i32 1234 + +bb3: ; preds = %entry + ret i32 3456 + +bb4: ; preds = %entry + ret i32 0 + +bb5: ; preds = %entry + ret i32 12 +} From anton at korobeynikov.info Tue Jun 30 14:56:51 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 30 Jun 2009 23:56:51 +0400 Subject: [llvm-commits] [llvm] r74549 - in /llvm/trunk: lib/Target/ARM/ARMCodeEmitter.cpp lib/Target/ARM/ARMConstantIslandPass.cpp lib/Target/ARM/ARMInstrInfo.cpp lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-jumptbl.ll In-Reply-To: <200906301950.n5UJoaYf025220@zion.cs.uiuc.edu> References: <200906301950.n5UJoaYf025220@zion.cs.uiuc.edu> Message-ID: Hi David > - ?if (TID.Opcode == ARM::BR_JTr || TID.Opcode == ARM::BR_JTadd) { > + ?if (TID.Opcode == ARM::BR_JTr || TID.Opcode == ARM::BR_JTadd || > + ? ? ?TID.Opcode == ARM::t2BR_JTr || TID.Opcode == ARM::t2BR_JTadd) { Seeing all this - maybe it will make sense to factor out such code in separate predicate? E.g. isJumpTableOpcode(), etc? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From gohman at apple.com Tue Jun 30 15:11:03 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Jun 2009 20:11:03 -0000 Subject: [llvm-commits] [llvm] r74550 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp unittests/ADT/APIntTest.cpp Message-ID: <200906302011.n5UKBAmU025991@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 30 15:10:56 2009 New Revision: 74550 URL: http://llvm.org/viewvc/llvm-project?rev=74550&view=rev Log: Reapply 74494, this time removing the conflicting definition of operator<< in APIntTest.cpp. Modified: llvm/trunk/include/llvm/ADT/APInt.h llvm/trunk/lib/Support/APInt.cpp llvm/trunk/unittests/ADT/APIntTest.cpp Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=74550&r1=74549&r2=74550&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Tue Jun 30 15:10:56 2009 @@ -1426,6 +1426,8 @@ return OS; } +std::ostream &operator<<(std::ostream &o, const APInt &I); + namespace APIntOps { /// @brief Determine the smaller of two APInts considered to be signed. Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=74550&r1=74549&r2=74550&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Tue Jun 30 15:10:56 2009 @@ -2178,6 +2178,12 @@ OS << S.c_str(); } +std::ostream &llvm::operator<<(std::ostream &o, const APInt &I) { + raw_os_ostream OS(o); + OS << I; + return o; +} + // This implements a variety of operations on a representation of // arbitrary precision, two's-complement, bignum integer values. Modified: llvm/trunk/unittests/ADT/APIntTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APIntTest.cpp?rev=74550&r1=74549&r2=74550&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/APIntTest.cpp (original) +++ llvm/trunk/unittests/ADT/APIntTest.cpp Tue Jun 30 15:10:56 2009 @@ -17,19 +17,6 @@ namespace { -// Make the Google Test failure output equivalent to APInt::dump() -std::ostream& operator<<(std::ostream &OS, const llvm::APInt& I) { - llvm::raw_os_ostream raw_os(OS); - - SmallString<40> S, U; - I.toStringUnsigned(U); - I.toStringSigned(S); - raw_os << "APInt(" << I.getBitWidth()<< "b, " - << U.c_str() << "u " << S.c_str() << "s)"; - raw_os.flush(); - return OS; -} - // Test that APInt shift left works when bitwidth > 64 and shiftamt == 0 TEST(APIntTest, ShiftLeftByZero) { APInt One = APInt::getNullValue(65) + 1; From gohman at apple.com Tue Jun 30 15:13:32 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Jun 2009 20:13:32 -0000 Subject: [llvm-commits] [llvm] r74551 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <200906302013.n5UKDXPl026100@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 30 15:13:32 2009 New Revision: 74551 URL: http://llvm.org/viewvc/llvm-project?rev=74551&view=rev Log: Minor code cleanups. Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=74551&r1=74550&r2=74551&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Jun 30 15:13:32 2009 @@ -110,7 +110,9 @@ //===----------------------------------------------------------------------===// // Implementation of the SCEV class. // + SCEV::~SCEV() {} + void SCEV::dump() const { print(errs()); errs() << '\n'; @@ -387,7 +389,6 @@ return true; } - void SCEVAddRecExpr::print(raw_ostream &OS) const { OS << "{" << *Operands[0]; for (unsigned i = 1, e = Operands.size(); i != e; ++i) @@ -743,6 +744,7 @@ "This is not a conversion to a SCEVable type!"); Ty = getEffectiveSCEVType(Ty); + // Fold if the operand is constant. if (const SCEVConstant *SC = dyn_cast(Op)) return getConstant( cast(ConstantExpr::getTrunc(SC->getValue(), Ty))); @@ -787,6 +789,7 @@ "This is not a conversion to a SCEVable type!"); Ty = getEffectiveSCEVType(Ty); + // Fold if the operand is constant. if (const SCEVConstant *SC = dyn_cast(Op)) { const Type *IntTy = getEffectiveSCEVType(Ty); Constant *C = ConstantExpr::getZExt(SC->getValue(), IntTy); @@ -882,6 +885,7 @@ "This is not a conversion to a SCEVable type!"); Ty = getEffectiveSCEVType(Ty); + // Fold if the operand is constant. if (const SCEVConstant *SC = dyn_cast(Op)) { const Type *IntTy = getEffectiveSCEVType(Ty); Constant *C = ConstantExpr::getSExt(SC->getValue(), IntTy); @@ -4241,7 +4245,7 @@ // The maximum backedge count is similar, except using the minimum start // value and the maximum end value. - const SCEV* MaxBECount = getBECount(MinStart, MaxEnd, Step);; + const SCEV* MaxBECount = getBECount(MinStart, MaxEnd, Step); return BackedgeTakenInfo(BECount, MaxBECount); } From a at bolka.at Tue Jun 30 16:33:58 2009 From: a at bolka.at (Andreas Bolka) Date: Tue, 30 Jun 2009 21:33:58 -0000 Subject: [llvm-commits] [llvm] r74553 - /llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Message-ID: <200906302133.n5ULXxmo029056@zion.cs.uiuc.edu> Author: abolka Date: Tue Jun 30 16:33:56 2009 New Revision: 74553 URL: http://llvm.org/viewvc/llvm-project?rev=74553&view=rev Log: Drop redundant print impl. Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h?rev=74553&r1=74552&r2=74553&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Tue Jun 30 16:33:56 2009 @@ -48,9 +48,6 @@ void print(raw_ostream&, const Module* = 0) const; virtual void print(std::ostream&, const Module* = 0) const; - void print(std::ostream *OS, const Module *M = 0) const { - if (OS) print(*OS, M); - } }; // class LoopDependenceAnalysis From david_goodwin at apple.com Tue Jun 30 16:51:31 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 30 Jun 2009 14:51:31 -0700 Subject: [llvm-commits] [llvm] r74549 - in /llvm/trunk: lib/Target/ARM/ARMCodeEmitter.cpp lib/Target/ARM/ARMConstantIslandPass.cpp lib/Target/ARM/ARMInstrInfo.cpp lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-jumptbl.ll In-Reply-To: References: <200906301950.n5UJoaYf025220@zion.cs.uiuc.edu> Message-ID: Perhaps, though we are not always interested in all jump table opcodes. For instance, the code you show is not checking for all the jump table opcodes, there are also the move versions BR_JTm and t2BR_JTm. David On Jun 30, 2009, at 12:56 PM, Anton Korobeynikov wrote: > Hi David > >> - if (TID.Opcode == ARM::BR_JTr || TID.Opcode == ARM::BR_JTadd) { >> + if (TID.Opcode == ARM::BR_JTr || TID.Opcode == ARM::BR_JTadd || >> + TID.Opcode == ARM::t2BR_JTr || TID.Opcode == >> ARM::t2BR_JTadd) { > Seeing all this - maybe it will make sense to factor out such code in > separate predicate? E.g. isJumpTableOpcode(), etc? > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State > University > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From david_goodwin at apple.com Tue Jun 30 17:11:34 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 30 Jun 2009 22:11:34 -0000 Subject: [llvm-commits] [llvm] r74555 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-str.ll test/CodeGen/Thumb2/thumb2-strb.ll test/CodeGen/Thumb2/thumb2-strh.ll Message-ID: <200906302211.n5UMBYMc030183@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jun 30 17:11:34 2009 New Revision: 74555 URL: http://llvm.org/viewvc/llvm-project?rev=74555&view=rev Log: Add thumb-2 store word, halfword, and byte. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74555&r1=74554&r2=74555&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jun 30 17:11:34 2009 @@ -399,6 +399,19 @@ [(set GPR:$dst, (opnode (ARMWrapper tconstpool:$addr)))]>; } +/// T2I_st - Defines a set of (op r, {imm12|imm8|so_reg}) store patterns. +multiclass T2I_st { + def i12 : T2Ii12<(outs), (ins GPR:$src, t2addrmode_imm12:$addr), + opc, " $src, $addr", + [(opnode GPR:$src, t2addrmode_imm12:$addr)]>; + def i8 : T2Ii8 <(outs), (ins GPR:$src, t2addrmode_imm8:$addr), + opc, " $src, $addr", + [(opnode GPR:$src, t2addrmode_imm8:$addr)]>; + def s : T2Iso <(outs), (ins GPR:$src, t2addrmode_so_reg:$addr), + opc, " $src, $addr", + [(opnode GPR:$src, t2addrmode_so_reg:$addr)]>; +} + //===----------------------------------------------------------------------===// // Instructions //===----------------------------------------------------------------------===// @@ -509,6 +522,11 @@ def : T2Pat<(extloadi16 (ARMWrapper tconstpool:$addr)), (t2LDRHpci tconstpool:$addr)>; +// Store +defm t2STR : T2I_st<"str", BinOpFrag<(store node:$LHS, node:$RHS)>>; +defm t2STRB : T2I_st<"strb", BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>; +defm t2STRH : T2I_st<"strh", BinOpFrag<(truncstorei16 node:$LHS, node:$RHS)>>; + //===----------------------------------------------------------------------===// // Move Instructions. // Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll?rev=74555&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll Tue Jun 30 17:11:34 2009 @@ -0,0 +1,63 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#-128\\\]$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 + +define i32 @f1(i32 %a, i32* %v) { + store i32 %a, i32* %v + ret i32 %a +} + +define i32 @f2(i32 %a, i32* %v) { + %tmp2 = getelementptr i32* %v, i32 1023 + store i32 %a, i32* %tmp2 + ret i32 %a +} + +define i32 @f2a(i32 %a, i32* %v) { + %tmp2 = getelementptr i32* %v, i32 -32 + store i32 %a, i32* %tmp2 + ret i32 %a +} + +define i32 @f3(i32 %a, i32* %v) { + %tmp2 = getelementptr i32* %v, i32 1024 + store i32 %a, i32* %tmp2 + ret i32 %a +} + +define i32 @f4(i32 %a, i32 %base) { +entry: + %tmp1 = sub i32 %base, 128 + %tmp2 = inttoptr i32 %tmp1 to i32* + store i32 %a, i32* %tmp2 + ret i32 %a +} + +define i32 @f5(i32 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = add i32 %base, %offset + %tmp2 = inttoptr i32 %tmp1 to i32* + store i32 %a, i32* %tmp2 + ret i32 %a +} + +define i32 @f6(i32 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = shl i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i32* + store i32 %a, i32* %tmp3 + ret i32 %a +} + +define i32 @f7(i32 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = lshr i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i32* + store i32 %a, i32* %tmp3 + ret i32 %a +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll?rev=74555&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll Tue Jun 30 17:11:34 2009 @@ -0,0 +1,63 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#-128\\\]$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 + +define i8 @f1(i8 %a, i8* %v) { + store i8 %a, i8* %v + ret i8 %a +} + +define i8 @f2(i8 %a, i8* %v) { + %tmp2 = getelementptr i8* %v, i32 4092 + store i8 %a, i8* %tmp2 + ret i8 %a +} + +define i8 @f2a(i8 %a, i8* %v) { + %tmp2 = getelementptr i8* %v, i32 -128 + store i8 %a, i8* %tmp2 + ret i8 %a +} + +define i8 @f3(i8 %a, i8* %v) { + %tmp2 = getelementptr i8* %v, i32 4096 + store i8 %a, i8* %tmp2 + ret i8 %a +} + +define i8 @f4(i8 %a, i32 %base) { +entry: + %tmp1 = sub i32 %base, 128 + %tmp2 = inttoptr i32 %tmp1 to i8* + store i8 %a, i8* %tmp2 + ret i8 %a +} + +define i8 @f5(i8 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = add i32 %base, %offset + %tmp2 = inttoptr i32 %tmp1 to i8* + store i8 %a, i8* %tmp2 + ret i8 %a +} + +define i8 @f6(i8 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = shl i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i8* + store i8 %a, i8* %tmp3 + ret i8 %a +} + +define i8 @f7(i8 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = lshr i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i8* + store i8 %a, i8* %tmp3 + ret i8 %a +} Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll?rev=74555&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll Tue Jun 30 17:11:34 2009 @@ -0,0 +1,63 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#-128\\\]$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 + +define i16 @f1(i16 %a, i16* %v) { + store i16 %a, i16* %v + ret i16 %a +} + +define i16 @f2(i16 %a, i16* %v) { + %tmp2 = getelementptr i16* %v, i32 2046 + store i16 %a, i16* %tmp2 + ret i16 %a +} + +define i16 @f2a(i16 %a, i16* %v) { + %tmp2 = getelementptr i16* %v, i32 -64 + store i16 %a, i16* %tmp2 + ret i16 %a +} + +define i16 @f3(i16 %a, i16* %v) { + %tmp2 = getelementptr i16* %v, i32 2048 + store i16 %a, i16* %tmp2 + ret i16 %a +} + +define i16 @f4(i16 %a, i32 %base) { +entry: + %tmp1 = sub i32 %base, 128 + %tmp2 = inttoptr i32 %tmp1 to i16* + store i16 %a, i16* %tmp2 + ret i16 %a +} + +define i16 @f5(i16 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = add i32 %base, %offset + %tmp2 = inttoptr i32 %tmp1 to i16* + store i16 %a, i16* %tmp2 + ret i16 %a +} + +define i16 @f6(i16 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = shl i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i16* + store i16 %a, i16* %tmp3 + ret i16 %a +} + +define i16 @f7(i16 %a, i32 %base, i32 %offset) { +entry: + %tmp1 = lshr i32 %offset, 2 + %tmp2 = add i32 %base, %tmp1 + %tmp3 = inttoptr i32 %tmp2 to i16* + store i16 %a, i16* %tmp3 + ret i16 %a +} From evan.cheng at apple.com Tue Jun 30 17:25:02 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Jun 2009 15:25:02 -0700 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: References: Message-ID: <7313C026-43B9-4990-A4B6-1A78909E4B67@apple.com> Dale, can you review? Thanks, Evan On Jun 27, 2009, at 8:15 AM, Tilmann Scheller wrote: > Hello, > > attached is a series of patches which implement the SVR4 ABI for > PowerPC. Patches were made against revision 74382 and need to be > applied in order. A patch which adds SVR4 support to llvm-gcc will > follow soon. > > The current state of LLVM on 32-bit PowerPC Linux: > compat.exp passes all tests (those are the ABI tests from the GCC > test suite) > C-only nightly tester results: 1638 TEST-PASS / 96 TEST-FAIL > llvm-gcc bootstraps at -O0 with a stage 2/3 comparison failure of > varasm.o > > These patches were not tested on Darwin PPC, so it would be really > great if someone with a Darwin PPC nightly tester (Evan? :) ) could > make a run with the patches applied. Just to make sure that I did not > introduce any major regressions :) > > Feedback welcome! > > Greetings, > > Tilmann > <0001-Small-cleanups-in-the-PowerPC-backend.patch><0002-Add- > NumFixedArgs-attribute-to-CallSDNode-which-indic.patch><0003- > Implement-the-SVR4-ABI-for-PowerPC.patch><0004-Refactor-ABI-code-in- > the-PowerPC- > backend.patch>_______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From kremenek at apple.com Tue Jun 30 17:26:32 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 30 Jun 2009 22:26:32 -0000 Subject: [llvm-commits] [llvm] r74557 - /llvm/tags/checker/checker-0.212/ Message-ID: <200906302226.n5UMQW9l030612@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jun 30 17:26:32 2009 New Revision: 74557 URL: http://llvm.org/viewvc/llvm-project?rev=74557&view=rev Log: Removing checker-0.212. Removed: llvm/tags/checker/checker-0.212/ From kremenek at apple.com Tue Jun 30 17:32:13 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 30 Jun 2009 22:32:13 -0000 Subject: [llvm-commits] [llvm] r74560 - /llvm/tags/checker/checker-0.212/ Message-ID: <200906302232.n5UMWDOR030791@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jun 30 17:32:12 2009 New Revision: 74560 URL: http://llvm.org/viewvc/llvm-project?rev=74560&view=rev Log: Tagging checker-0.212. Added: llvm/tags/checker/checker-0.212/ - copied from r74559, llvm/trunk/ From sabre at nondot.org Tue Jun 30 17:33:54 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Jun 2009 22:33:54 -0000 Subject: [llvm-commits] [compiler-rt] r74562 - /compiler-rt/trunk/www/ Message-ID: <200906302233.n5UMXs2O030852@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 17:33:54 2009 New Revision: 74562 URL: http://llvm.org/viewvc/llvm-project?rev=74562&view=rev Log: add directory for web page. Added: compiler-rt/trunk/www/ From isanbard at gmail.com Tue Jun 30 17:38:32 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Jun 2009 22:38:32 -0000 Subject: [llvm-commits] [llvm] r74564 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/IA64/ lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/X... Message-ID: <200906302238.n5UMcY5I031037@zion.cs.uiuc.edu> Author: void Date: Tue Jun 30 17:38:32 2009 New Revision: 74564 URL: http://llvm.org/viewvc/llvm-project?rev=74564&view=rev Log: Add an "alignment" field to the MachineFunction object. It makes more sense to have the alignment be calculated up front, and have the back-ends obey whatever alignment is decided upon. This allows for future work that would allow for precise no-op placement and the like. Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/MachineFunction.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.h llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.h llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.h llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Tue Jun 30 17:38:32 2009 @@ -111,6 +111,9 @@ // Tracks debug locations. DebugLocTracker DebugLocInfo; + // The alignment of the function. + unsigned Alignment; + public: MachineFunction(const Function *Fn, const TargetMachine &TM); ~MachineFunction(); @@ -148,6 +151,14 @@ MachineConstantPool *getConstantPool() { return ConstantPool; } const MachineConstantPool *getConstantPool() const { return ConstantPool; } + /// getAlignment - Return the alignment of the function. + /// + unsigned getAlignment() const { return Alignment; } + + /// setAlignment - Set the alignment of the function. + /// + void setAlignment(unsigned A) { Alignment = A; } + /// MachineFunctionInfo - Keep track of various per-function pieces of /// information for backends that would like to do so. /// Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Tue Jun 30 17:38:32 2009 @@ -736,6 +736,9 @@ /// PIC relocation models. virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; + /// getFunctionAlignment - Return the alignment of this function. + virtual unsigned getFunctionAlignment(const Function *) const = 0; + //===--------------------------------------------------------------------===// // TargetLowering Optimization Methods // Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Tue Jun 30 17:38:32 2009 @@ -14,6 +14,10 @@ //===----------------------------------------------------------------------===// #include "llvm/DerivedTypes.h" +#include "llvm/Function.h" +#include "llvm/Instructions.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Config/config.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -22,15 +26,12 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetFrameInfo.h" -#include "llvm/Function.h" -#include "llvm/Instructions.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/GraphWriter.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/Config/config.h" #include #include using namespace llvm; @@ -124,6 +125,7 @@ MachineFrameInfo(*TM.getFrameInfo()); ConstantPool = new (Allocator.Allocate()) MachineConstantPool(TM.getTargetData()); + Alignment = TM.getTargetLowering()->getFunctionAlignment(F); // Set up jump table. const TargetData &TD = *TM.getTargetData(); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -455,6 +455,11 @@ } } +/// getFunctionAlignment - Return the alignment of this function. +unsigned ARMTargetLowering::getFunctionAlignment(const Function *F) const { + return getTargetMachine().getSubtarget().isThumb() ? 1 : 2; +} + //===----------------------------------------------------------------------===// // Lowering Code //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Tue Jun 30 17:38:32 2009 @@ -197,6 +197,9 @@ return Subtarget; } + /// getFunctionAlignment - Return the alignment of this function. + virtual unsigned getFunctionAlignment(const Function *F) const; + private: /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can /// make the right decision when generating code for different targets. Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -235,15 +235,16 @@ printVisibility(CurrentFnName, F->getVisibility()); if (AFI->isThumbFunction()) { - EmitAlignment(1, F, AFI->getAlign()); + EmitAlignment(MF.getAlignment(), F, AFI->getAlign()); O << "\t.code\t16\n"; O << "\t.thumb_func"; if (Subtarget->isTargetDarwin()) O << "\t" << CurrentFnName; O << "\n"; InCPMode = false; - } else - EmitAlignment(2, F); + } else { + EmitAlignment(MF.getAlignment(), F); + } O << CurrentFnName << ":\n"; // Emit pre-function debug information. Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -181,6 +181,11 @@ } } +/// getFunctionAlignment - Return the function alignment. +unsigned AlphaTargetLowering::getFunctionAlignment(const Function *F) const { + return 4; +} + static SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) { MVT PtrVT = Op.getValueType(); JumpTableSDNode *JT = cast(Op); Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Tue Jun 30 17:38:32 2009 @@ -103,6 +103,9 @@ virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; + /// getFunctionAlignment - Return the function alignment. + virtual unsigned getFunctionAlignment(const Function *F) const; + private: // Helpers for custom lowering. void LowerVAARG(SDNode *N, SDValue &Chain, SDValue &DataPtr, Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -155,7 +155,7 @@ const Function *F = MF.getFunction(); SwitchToSection(TAI->SectionForGlobal(F)); - EmitAlignment(4, F); + EmitAlignment(MF.getAlignment(), F); switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -433,7 +433,7 @@ const Function *F = MF.getFunction(); SwitchToSection(TAI->SectionForGlobal(F)); - EmitAlignment(3, F); + EmitAlignment(MF.getAlignment(), F); switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -481,6 +481,11 @@ return ((i != node_names.end()) ? i->second : 0); } +/// getFunctionAlignment - Return the function alignment. +unsigned SPUTargetLowering::getFunctionAlignment(const Function *) const { + return 3; +} + //===----------------------------------------------------------------------===// // Return the Cell SPU's SETCC result type //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h Tue Jun 30 17:38:32 2009 @@ -148,6 +148,9 @@ virtual bool isLegalAddressImmediate(GlobalValue *) const; virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; + + /// getFunctionAlignment - Return the function alignment. + virtual unsigned getFunctionAlignment(const Function *F) const; }; } Modified: llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -137,7 +137,7 @@ SwitchToSection(TAI->SectionForGlobal(F)); // Print out labels for the function. - EmitAlignment(5); + EmitAlignment(MF.getAlignment()); O << "\t.global\t" << CurrentFnName << '\n'; printVisibility(CurrentFnName, F->getVisibility()); Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -148,6 +148,11 @@ return MVT::i1; } +/// getFunctionAlignment - Return the function alignment. +unsigned IA64TargetLowering::getFunctionAlignment(const Function *) const { + return 5; +} + void IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG, SmallVectorImpl &ArgValues, DebugLoc dl) { Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.h (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.h Tue Jun 30 17:38:32 2009 @@ -70,6 +70,8 @@ /// (currently, only "ret void") virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); + /// getFunctionAlignment - Return the function alignment. + virtual unsigned getFunctionAlignment(const Function *F) const; }; } Modified: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -97,10 +97,7 @@ SwitchToSection(TAI->SectionForGlobal(F)); - unsigned FnAlign = 4; - if (F->hasFnAttr(Attribute::OptimizeForSize)) - FnAlign = 1; - + unsigned FnAlign = MF.getAlignment(); EmitAlignment(FnAlign, F); switch (F->getLinkage()) { Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -127,6 +127,11 @@ } } +/// getFunctionAlignment - Return the alignment of this function. +unsigned MSP430TargetLowering::getFunctionAlignment(const Function *F) const { + return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; +} + //===----------------------------------------------------------------------===// // Calling Convention Implementation //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h Tue Jun 30 17:38:32 2009 @@ -74,6 +74,9 @@ /// DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; + /// getFunctionAlignment - Return the alignment of this function. + virtual unsigned getFunctionAlignment(const Function *F) const; + SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG); SDValue LowerCALL(SDValue Op, SelectionDAG &DAG); SDValue LowerRET(SDValue Op, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -230,7 +230,7 @@ SwitchToSection(TAI->SectionForGlobal(F)); // 2 bits aligned - EmitAlignment(2, F); + EmitAlignment(MF.getAlignment(), F); O << "\t.globl\t" << CurrentFnName << '\n'; O << "\t.ent\t" << CurrentFnName << '\n'; Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -154,11 +154,14 @@ computeRegisterProperties(); } - MVT MipsTargetLowering::getSetCCResultType(MVT VT) const { return MVT::i32; } +/// getFunctionAlignment - Return the function alignment. +unsigned MipsTargetLowering::getFunctionAlignment(const Function *) const { + return 2; +} SDValue MipsTargetLowering:: LowerOperation(SDValue Op, SelectionDAG &DAG) Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Tue Jun 30 17:38:32 2009 @@ -84,6 +84,8 @@ /// getSetCCResultType - get the ISD::SETCC result ValueType MVT getSetCCResultType(MVT VT) const; + /// getFunctionAlignment - Return the function alignment. + virtual unsigned getFunctionAlignment(const Function *F) const; private: // Subtarget Info const MipsSubtarget *Subtarget; Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Tue Jun 30 17:38:32 2009 @@ -145,6 +145,11 @@ unsigned GetTmpSize() { return TmpSize; } void SetTmpSize(unsigned Size) { TmpSize = Size; } + /// getFunctionAlignment - Return the function alignment. + virtual unsigned getFunctionAlignment(const Function *) const { + // FIXME: The function never seems to be aligned. + return 1; + } private: // If the Node is a BUILD_PAIR representing a direct Address, // then this function will return true. Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -596,7 +596,7 @@ printVisibility(CurrentFnName, F->getVisibility()); - EmitAlignment(2, F); + EmitAlignment(MF.getAlignment(), F); O << CurrentFnName << ":\n"; // Emit pre-function debug information. @@ -773,7 +773,7 @@ printVisibility(CurrentFnName, F->getVisibility()); - EmitAlignment(F->hasFnAttr(Attribute::OptimizeForSize) ? 2 : 4, F); + EmitAlignment(MF.getAlignment(), F); O << CurrentFnName << ":\n"; // Emit pre-function debug information. Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -428,11 +428,17 @@ } } - MVT PPCTargetLowering::getSetCCResultType(MVT VT) const { return MVT::i32; } +/// getFunctionAlignment - Return the function alignment. +unsigned PPCTargetLowering::getFunctionAlignment(const Function *F) const { + if (getTargetMachine().getSubtarget().isDarwin()) + return F->hasFnAttr(Attribute::OptimizeForSize) ? 2 : 4; + else + return 2; +} //===----------------------------------------------------------------------===// // Node matching predicates, for use by the tblgen matching code. Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Tue Jun 30 17:38:32 2009 @@ -337,6 +337,9 @@ virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; + /// getFunctionAlignment - Return the function alignment. + virtual unsigned getFunctionAlignment(const Function *F) const; + private: SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const; SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const; Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -109,7 +109,7 @@ // Print out the label for the function. const Function *F = MF.getFunction(); SwitchToSection(TAI->SectionForGlobal(F)); - EmitAlignment(4, F); + EmitAlignment(MF.getAlignment(), F); O << "\t.globl\t" << CurrentFnName << '\n'; printVisibility(CurrentFnName, F->getVisibility()); Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -1047,3 +1047,8 @@ // The Sparc target isn't yet aware of offsets. return false; } + +/// getFunctionAlignment - Return the function alignment. +unsigned SparcTargetLowering::getFunctionAlignment(const Function *) const { + return 4; +} Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.h Tue Jun 30 17:38:32 2009 @@ -73,6 +73,9 @@ MVT VT) const; virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; + + /// getFunctionAlignment - Return the function alignment. + virtual unsigned getFunctionAlignment(const Function *F) const; }; } // end namespace llvm Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -154,21 +154,13 @@ } } - - void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) { + unsigned FnAlign = MF.getAlignment(); const Function *F = MF.getFunction(); decorateName(CurrentFnName, F); SwitchToSection(TAI->SectionForGlobal(F)); - - // FIXME: A function's alignment should be part of MachineFunction. There - // shouldn't be a policy decision here. - unsigned FnAlign = 4; - if (F->hasFnAttr(Attribute::OptimizeForSize)) - FnAlign = 1; - switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -132,6 +132,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); unsigned CC = F->getCallingConv(); + unsigned FnAlign = MF.getAlignment(); // Populate function information map. Actually, We don't want to populate // non-stdcall or non-fastcall functions' information right now. @@ -141,10 +142,6 @@ decorateName(CurrentFnName, F); SwitchToTextSection("_text", F); - - unsigned FnAlign = 4; - if (F->hasFnAttr(Attribute::OptimizeForSize)) - FnAlign = 1; switch (F->getLinkage()) { default: assert(0 && "Unsupported linkage type!"); case Function::PrivateLinkage: Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -1027,6 +1027,11 @@ return Table; } +/// getFunctionAlignment - Return the alignment of this function. +unsigned X86TargetLowering::getFunctionAlignment(const Function *F) const { + return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; +} + //===----------------------------------------------------------------------===// // Return Value Calling Convention Implementation //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Jun 30 17:38:32 2009 @@ -380,7 +380,7 @@ MVT getOptimalMemOpType(uint64_t Size, unsigned Align, bool isSrcConst, bool isSrcStr, SelectionDAG &DAG) const; - + /// LowerOperation - Provide custom lowering hooks for some operations. /// virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); @@ -533,7 +533,10 @@ , SmallSet & #endif ); - + + /// getFunctionAlignment - Return the alignment of this function. + virtual unsigned getFunctionAlignment(const Function *F) const; + private: /// Subtarget - Keep a pointer to the X86Subtarget around so that we can /// make the right decision when generating code for different targets. Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Tue Jun 30 17:38:32 2009 @@ -277,7 +277,7 @@ break; } // (1 << 1) byte aligned - EmitAlignment(1, F, 1); + EmitAlignment(MF.getAlignment(), F, 1); if (TAI->hasDotTypeDotSizeDirective()) { O << "\t.type " << CurrentFnName << ", at function\n"; } Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Tue Jun 30 17:38:32 2009 @@ -187,6 +187,12 @@ } } +/// getFunctionAlignment - Return the alignment of this function. +unsigned XCoreTargetLowering:: +getFunctionAlignment(const Function *) const { + return 1; +} + //===----------------------------------------------------------------------===// // Misc Lower Operation implementation //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.h?rev=74564&r1=74563&r2=74564&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.h (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Tue Jun 30 17:38:32 2009 @@ -84,6 +84,9 @@ virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty) const; + /// getFunctionAlignment - Return the alignment of this function. + virtual unsigned getFunctionAlignment(const Function *F) const; + private: const XCoreTargetMachine &TM; const XCoreSubtarget &Subtarget; From resistor at mac.com Tue Jun 30 17:40:07 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 30 Jun 2009 15:40:07 -0700 Subject: [llvm-commits] [PATCH] Add an LLVMContext member to Module Message-ID: <4060B161-5D56-4BD3-BE4E-55129CC6C901@mac.com> Here's the first of many patches related to pushing LLVMContext through the existing APIs. This adds an LLVMContext member to each Module, which involves threading LLVMContext through large parts of the bitcode reader, the ASM parser, and all of the tools. --Owen -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-context.diff Type: application/octet-stream Size: 78053 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/73e18718/attachment.obj From daniel at zuster.org Tue Jun 30 17:49:27 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 22:49:27 -0000 Subject: [llvm-commits] [llvm] r74565 - in /llvm/trunk: include/llvm/MC/MCValue.h test/MC/AsmParser/exprs.s tools/llvm-mc/AsmExpr.cpp Message-ID: <200906302249.n5UMnRqN031401@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jun 30 17:49:27 2009 New Revision: 74565 URL: http://llvm.org/viewvc/llvm-project?rev=74565&view=rev Log: llvm-mc: Symbols in a relocatable expression of the (a - b + cst) form are allowed to be undefined when the expression is seen, we cannot enforce the same-section requirement until the entire assembly file has been seen. Modified: llvm/trunk/include/llvm/MC/MCValue.h llvm/trunk/test/MC/AsmParser/exprs.s llvm/trunk/tools/llvm-mc/AsmExpr.cpp Modified: llvm/trunk/include/llvm/MC/MCValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCValue.h?rev=74565&r1=74564&r2=74565&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCValue.h (original) +++ llvm/trunk/include/llvm/MC/MCValue.h Tue Jun 30 17:49:27 2009 @@ -26,7 +26,8 @@ /// relocations of this general form, but we need to represent this anyway. /// /// In the general form, SymbolB can only be defined if SymbolA is, and both -/// must be in the same (non-external) section. +/// must be in the same (non-external) section. The latter constraint is not +/// enforced, since a symbol's section may not be known at construction. /// /// Note that this class must remain a simple POD value class, because we need /// it to live in unions etc. @@ -52,9 +53,7 @@ static MCValue get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) { MCValue R; - assert((!SymB || (SymA && SymA->getSection() && - SymA->getSection() == SymB->getSection())) && - "Invalid relocatable MCValue!"); + assert((!SymB || SymA) && "Invalid relocatable MCValue!"); R.Cst = Val; R.SymA = SymA; R.SymB = SymB; Modified: llvm/trunk/test/MC/AsmParser/exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=74565&r1=74564&r2=74565&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/exprs.s (original) +++ llvm/trunk/test/MC/AsmParser/exprs.s Tue Jun 30 17:49:27 2009 @@ -52,4 +52,11 @@ i = (j + 10) - (k + 2) .long i + l = m - n + 4 + + .text +m: +n: + nop + \ No newline at end of file Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=74565&r1=74564&r2=74565&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Tue Jun 30 17:49:27 2009 @@ -37,12 +37,11 @@ MCSymbol *A = LHS.getSymA() ? LHS.getSymA() : RHS_A; MCSymbol *B = LHS.getSymB() ? LHS.getSymB() : RHS_B; if (B) { - // If we have a negated symbol, then we must have also have a - // non-negated symbol, and both symbols must be in the same - // non-external section. We can do this check later to permit - // expressions which eventually fold to a representable form -- such + // If we have a negated symbol, then we must have also have a non-negated + // symbol in order to encode the expression. We can do this check later to + // permit expressions which eventually fold to a representable form -- such // as (a + (0 - b)) -- if necessary. - if (!A || !A->getSection() || A->getSection() != B->getSection()) + if (!A) return false; } Res = MCValue::get(A, B, LHS.getConstant() + RHS_Cst); From david_goodwin at apple.com Tue Jun 30 17:50:01 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 30 Jun 2009 22:50:01 -0000 Subject: [llvm-commits] [llvm] r74566 - in /llvm/trunk/lib/Target/ARM: ARMISelDAGToDAG.cpp ARMInstrThumb2.td Message-ID: <200906302250.n5UMo1rW031433@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jun 30 17:50:01 2009 New Revision: 74566 URL: http://llvm.org/viewvc/llvm-project?rev=74566&view=rev Log: Thumb-2 load and store double description. But nothing yet creates them. Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=74566&r1=74565&r2=74566&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Jun 30 17:50:01 2009 @@ -100,6 +100,8 @@ SDValue &OffImm); bool SelectT2AddrModeImm8(SDValue Op, SDValue N, SDValue &Base, SDValue &OffImm); + bool SelectT2AddrModeImm8s4(SDValue Op, SDValue N, SDValue &Base, + SDValue &OffImm); bool SelectT2AddrModeSoReg(SDValue Op, SDValue N, SDValue &Base, SDValue &OffReg, SDValue &ShImm); @@ -613,6 +615,31 @@ return false; } +bool ARMDAGToDAGISel::SelectT2AddrModeImm8s4(SDValue Op, SDValue N, + SDValue &Base, SDValue &OffImm) { + if (N.getOpcode() == ISD::ADD) { + if (ConstantSDNode *RHS = dyn_cast(N.getOperand(1))) { + int RHSC = (int)RHS->getZExtValue(); + if (((RHSC & 0x3) == 0) && (RHSC < 0 && RHSC > -0x400)) { // 8 bits. + Base = N.getOperand(0); + OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32); + return true; + } + } + } else if (N.getOpcode() == ISD::SUB) { + if (ConstantSDNode *RHS = dyn_cast(N.getOperand(1))) { + int RHSC = (int)RHS->getZExtValue(); + if (((RHSC & 0x3) == 0) && (RHSC >= 0 && RHSC < 0x400)) { // 8 bits. + Base = N.getOperand(0); + OffImm = CurDAG->getTargetConstant(-RHSC, MVT::i32); + return true; + } + } + } + + return false; +} + bool ARMDAGToDAGISel::SelectT2AddrModeSoReg(SDValue Op, SDValue N, SDValue &Base, SDValue &OffReg, SDValue &ShImm) { Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74566&r1=74565&r2=74566&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jun 30 17:50:01 2009 @@ -143,6 +143,13 @@ let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm); } +// t2addrmode_imm8s4 := reg + (imm8 << 2) +def t2addrmode_imm8s4 : Operand, + ComplexPattern { + let PrintMethod = "printT2AddrModeImm8Operand"; + let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm); +} + // t2addrmode_so_reg := reg + reg << imm2 def t2addrmode_so_reg : Operand, ComplexPattern { @@ -476,7 +483,7 @@ let mayLoad = 1 in { // Load doubleword -def t2LDRDi8 : T2Ii8s4<(outs GPR:$dst), (ins t2addrmode_imm8:$addr), +def t2LDRDi8 : T2Ii8s4<(outs GPR:$dst), (ins t2addrmode_imm8s4:$addr), "ldrd", " $dst, $addr", []>; def t2LDRDpci : T2Ii8s4<(outs GPR:$dst), (ins i32imm:$addr), "ldrd", " $dst, $addr", []>; @@ -527,6 +534,11 @@ defm t2STRB : T2I_st<"strb", BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>; defm t2STRH : T2I_st<"strh", BinOpFrag<(truncstorei16 node:$LHS, node:$RHS)>>; +// Store doubleword +let mayLoad = 1 in +def t2STRDi8 : T2Ii8s4<(outs), (ins GPR:$src, t2addrmode_imm8s4:$addr), + "strd", " $src, $addr", []>; + //===----------------------------------------------------------------------===// // Move Instructions. // From sabre at nondot.org Tue Jun 30 17:56:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Jun 2009 22:56:43 -0000 Subject: [llvm-commits] [compiler-rt] r74567 - in /compiler-rt/trunk/www: content.css index.html menu.css menu.html.incl Message-ID: <200906302256.n5UMuhlk031639@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 17:56:43 2009 New Revision: 74567 URL: http://llvm.org/viewvc/llvm-project?rev=74567&view=rev Log: initial web page for compiler_rt Added: compiler-rt/trunk/www/content.css compiler-rt/trunk/www/index.html compiler-rt/trunk/www/menu.css compiler-rt/trunk/www/menu.html.incl Added: compiler-rt/trunk/www/content.css URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/www/content.css?rev=74567&view=auto ============================================================================== --- compiler-rt/trunk/www/content.css (added) +++ compiler-rt/trunk/www/content.css Tue Jun 30 17:56:43 2009 @@ -0,0 +1,25 @@ +html, body { + padding:0px; + font-size:small; font-family:"Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, Helvetica, sans-serif; background-color: #fff; color: #222; + line-height:1.5; +} + +h1, h2, h3, tt { color: #000 } + +h1 { padding-top:0px; margin-top:0px;} +h2 { color:#333333; padding-top:0.5em; } +h3 { padding-top: 0.5em; margin-bottom: -0.25em; color:#2d58b7} +li { padding-bottom: 0.5em; } +ul { padding-left:1.5em; } + +/* Slides */ +IMG.img_slide { + display: block; + margin-left: auto; + margin-right: auto +} + +.itemTitle { color:#2d58b7 } + +/* Tables */ +tr { vertical-align:top } Added: compiler-rt/trunk/www/index.html URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/www/index.html?rev=74567&view=auto ============================================================================== --- compiler-rt/trunk/www/index.html (added) +++ compiler-rt/trunk/www/index.html Tue Jun 30 17:56:43 2009 @@ -0,0 +1,67 @@ + + + + + + "compiler_rt" Runtime Library + + + + + +
    + +

    "compiler_rt" Runtime Library

    + + +

    The compiler_rt project is a simple library that provides an implementation + of the low-level target-specific hooks required by code generation and + other runtime components. For example, when compiling for a 32-bit target, + converting a double to a 64-bit unsigned integer is compiling into a runtime + call to the "__fixunsdfdi" function. The compiler_rt library provides + optimized implementations of this and other low-level routines.

    + + +

    Goals

    + + +

    Different targets require different routines. The compiler_rt project aims + to implement these routines in both target-independent C form as well as + providing heavily optimized assembly versions of the routines in some + cases. It should be very easy to bring compiler_rt to support a new + target by adding the new routines needed by that target.

    + +

    Where it make sense, the compiler_rt project aims to implement interfaces + that are drop-in compatible with the libgcc interfaces.

    + + +

    Features

    + + +

    The current feature set of compiler_rt is:

    + +
      +
    • Full support for the libgcc interfaces required by these targets: +
        +
      • Darwin i386
      • +
      • Darwin X86-64
      • +
      • Darwin PowerPC
      • +
      • Darwin PowerPC 64
      • +
    • + +
    • High performance hand tuned implementations of commonly used functions + like __floatundidf in assembly that are dramatically faster than the + libgcc implementations.
    • +
    • A target-independent implementation of the Apple "Blocks" runtime + interfaces.
    • +
    + + +

    Get it and get involved!

    + + +

    TODO.

    +
    + + Added: compiler-rt/trunk/www/menu.css URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/www/menu.css?rev=74567&view=auto ============================================================================== --- compiler-rt/trunk/www/menu.css (added) +++ compiler-rt/trunk/www/menu.css Tue Jun 30 17:56:43 2009 @@ -0,0 +1,39 @@ +/***************/ +/* page layout */ +/***************/ + +[id=menu] { + position:fixed; + width:25ex; +} +[id=content] { + /* ***** EDIT THIS VALUE IF CONTENT OVERLAPS MENU ***** */ + position:absolute; + left:29ex; + padding-right:4ex; +} + +/**************/ +/* menu style */ +/**************/ + +#menu .submenu { + padding-top:1em; + display:block; +} + +#menu label { + display:block; + font-weight: bold; + text-align: center; + background-color: rgb(192,192,192); +} +#menu a { + padding:0 .2em; + display:block; + text-align: center; + background-color: rgb(235,235,235); +} +#menu a:visited { + color:rgb(100,50,100); +} \ No newline at end of file Added: compiler-rt/trunk/www/menu.html.incl URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/www/menu.html.incl?rev=74567&view=auto ============================================================================== --- compiler-rt/trunk/www/menu.html.incl (added) +++ compiler-rt/trunk/www/menu.html.incl Tue Jun 30 17:56:43 2009 @@ -0,0 +1,19 @@ + From daniel at zuster.org Tue Jun 30 18:02:44 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 23:02:44 -0000 Subject: [llvm-commits] [llvm] r74568 - /llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Message-ID: <200906302302.n5UN2i7T031825@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jun 30 18:02:44 2009 New Revision: 74568 URL: http://llvm.org/viewvc/llvm-project?rev=74568&view=rev Log: llvm-mc: Accept relocatable expressions when parsing displacements and immediates. Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=74568&r1=74567&r2=74568&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Tue Jun 30 18:02:44 2009 @@ -30,13 +30,12 @@ } Reg; struct { - // FIXME: Should be a general expression. - int64_t Val; + MCValue Val; } Imm; struct { unsigned SegReg; - int64_t Disp; // FIXME: Should be a general expression. + MCValue Disp; unsigned BaseReg; unsigned Scale; unsigned ScaleReg; @@ -49,13 +48,13 @@ Res.Reg.RegNo = RegNo; return Res; } - static X86Operand CreateImm(int64_t Val) { + static X86Operand CreateImm(MCValue Val) { X86Operand Res; Res.Kind = Immediate; Res.Imm.Val = Val; return Res; } - static X86Operand CreateMem(unsigned SegReg, int64_t Disp, unsigned BaseReg, + static X86Operand CreateMem(unsigned SegReg, MCValue Disp, unsigned BaseReg, unsigned Scale, unsigned ScaleReg) { X86Operand Res; Res.Kind = Memory; @@ -86,12 +85,13 @@ case asmtok::Dollar: { // $42 -> immediate. Lexer.Lex(); - int64_t Val; - if (ParseAbsoluteExpression(Val)) - return TokError("expected integer constant"); - Op = X86Operand::CreateReg(Val); + MCValue Val; + if (ParseRelocatableExpression(Val)) + return true; + Op = X86Operand::CreateImm(Val); return false; - case asmtok::Star: + } + case asmtok::Star: { Lexer.Lex(); // Eat the star. if (Lexer.is(asmtok::Register)) { @@ -116,9 +116,9 @@ // of a memory operand with a missing displacement "(%ebx)" or "(,%eax)". The // only way to do this without lookahead is to eat the ( and see what is after // it. - int64_t Disp = 0; + MCValue Disp = MCValue::get(0, 0, 0); if (Lexer.isNot(asmtok::LParen)) { - if (ParseAbsoluteExpression(Disp)) return true; + if (ParseRelocatableExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. @@ -139,7 +139,7 @@ // memory operand consumed. } else { // It must be an parenthesized expression, parse it now. - if (ParseAbsoluteExpression(Disp)) + if (ParseRelocatableExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized From dalej at apple.com Tue Jun 30 18:10:22 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 23:10:22 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74569 - /llvm-gcc-4.2/trunk/gcc/config/darwin-c.c Message-ID: <200906302310.n5UNAMoW032101@zion.cs.uiuc.edu> Author: johannes Date: Tue Jun 30 18:10:22 2009 New Revision: 74569 URL: http://llvm.org/viewvc/llvm-project?rev=74569&view=rev Log: Detect an error cleanly instead of crashing. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin-c.c Modified: llvm-gcc-4.2/trunk/gcc/config/darwin-c.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin-c.c?rev=74569&r1=74568&r2=74569&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin-c.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin-c.c Tue Jun 30 18:10:22 2009 @@ -1161,6 +1161,14 @@ argument = TREE_CHAIN (argument); } + /* APPLE LOCAL begin 7020016 */ + if (argument == NULL_TREE) + { + error ("argument number of CFString format too large"); + *no_add_attrs = true; + return false; + } + /* APPLE LOCAL end 7020016 */ if (!objc_check_cfstringref_type (TREE_VALUE (argument))) { error ("format CFString argument not an 'CFStringRef' type"); From dalej at apple.com Tue Jun 30 18:18:07 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 23:18:07 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74570 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906302318.n5UNI7ei032326@zion.cs.uiuc.edu> Author: johannes Date: Tue Jun 30 18:18:07 2009 New Revision: 74570 URL: http://llvm.org/viewvc/llvm-project?rev=74570&view=rev Log: Add high-level matching algorithm for multiple alternative constraints in asm. The low-level part, matching one possible constraint against one operand, is not done (of course, this is the hard part). For variety, this time alternative 0 is always matched, with more random variation in tests that use this. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74570&r1=74569&r2=74570&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 30 18:18:07 2009 @@ -3981,6 +3981,14 @@ return Result; } +/// See if operand "exp" can use the indicated Constraint (which is +/// terminated by a null or a comma). +/// Returns: -1=no, 0=yes but auxiliary instructions needed, 1=yes and free +int MatchWeight(const char *Constraint, tree exp, bool isInput) { + /// TEMPORARY. This has the effect that alternative 0 is always chosen. + return 0; +} + /// ChooseConstraintTuple: we know each of the NumInputs+NumOutputs strings /// in Constraints[] is a comma-separated list of NumChoices different /// constraints. Look through the operands and constraint possibilities @@ -4000,13 +4008,67 @@ unsigned NumOutputs, unsigned NumChoices, const char **ReplacementStrings) { - unsigned int CommasToSkip; - // TEMPORARY: assume the second set of constraints is the right one. - // This is totally wrong, of course, but allows the mechanics of string - // handling to be tested. - CommasToSkip = 1; - + int MaxWeight = 0; + unsigned int CommasToSkip = 0; + int Weights[NumChoices]; + // RunningConstraints is pointers into the Constraints strings which + // are incremented as we go to point to the beginning of each + // comma-separated alternative. + const char* RunningConstraints[NumInputs+NumOutputs]; + memcpy(RunningConstraints, Constraints, + (NumInputs+NumOutputs) * sizeof(const char*)); + // The entire point of this loop is to compute CommasToSkip. + for (unsigned int i=0; iMaxWeight) { + CommasToSkip = i; + MaxWeight = Weights[i]; + } + } + // We have picked an alternative (the CommasToSkip'th one). + // Change Constraints to point to malloc'd copies of the appropriate + // constraints picked out of the original strings. for (unsigned int i=0; i Author: ddunbar Date: Tue Jun 30 18:37:44 2009 New Revision: 74572 URL: http://llvm.org/viewvc/llvm-project?rev=74572&view=rev Log: Fill in some methods for the MCValue field of an MCOperand. Modified: llvm/trunk/include/llvm/MC/MCInst.h Modified: llvm/trunk/include/llvm/MC/MCInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInst.h?rev=74572&r1=74571&r2=74572&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCInst.h (original) +++ llvm/trunk/include/llvm/MC/MCInst.h Tue Jun 30 18:37:44 2009 @@ -31,7 +31,7 @@ kRegister, ///< Register operand. kImmediate, ///< Immediate operand. kMBBLabel, ///< Basic block label. - kMCValue + kMCValue ///< Relocatable immediate operand. }; unsigned char Kind; @@ -49,9 +49,11 @@ MCOperand() : Kind(kInvalid) {} MCOperand(const MCOperand &RHS) { *this = RHS; } + bool isValid() const { return Kind != kInvalid; } bool isReg() const { return Kind == kRegister; } bool isImm() const { return Kind == kImmediate; } bool isMBBLabel() const { return Kind == kMBBLabel; } + bool isMCValue() const { return Kind == kMCValue; } /// getReg - Returns the register number. unsigned getReg() const { @@ -82,6 +84,15 @@ assert(isMBBLabel() && "Wrong accessor"); return MBBLabel.BlockNo; } + + const MCValue &getMCValue() const { + assert(isMCValue() && "This is not an MCValue"); + return MCValueVal; + } + void setMCValue(const MCValue &Val) { + assert(isMCValue() && "This is not an MCValue"); + MCValueVal = Val; + } void MakeReg(unsigned Reg) { Kind = kRegister; @@ -96,6 +107,10 @@ MBBLabel.FunctionNo = Fn; MBBLabel.BlockNo = MBB; } + void MakeMCValue(const MCValue &Val) { + Kind = kMCValue; + MCValueVal = Val; + } }; @@ -119,7 +134,6 @@ void addOperand(const MCOperand &Op) { Operands.push_back(Op); } - }; From daniel at zuster.org Tue Jun 30 18:38:38 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 23:38:38 -0000 Subject: [llvm-commits] [llvm] r74573 - in /llvm/trunk/tools/llvm-mc: AsmParser.cpp AsmParser.h MC-X86Specific.cpp Message-ID: <200906302338.n5UNcchR000469@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jun 30 18:38:38 2009 New Revision: 74573 URL: http://llvm.org/viewvc/llvm-project?rev=74573&view=rev Log: llvm-mc: Introduce method to match a parsed x86 instruction into an MCInst. Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74573&r1=74572&r2=74573&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Jun 30 18:38:38 2009 @@ -506,7 +506,7 @@ } MCInst Inst; - if (ParseX86InstOperands(Inst)) + if (ParseX86InstOperands(IDVal, Inst)) return true; if (Lexer.isNot(asmtok::EndOfStatement)) Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=74573&r1=74572&r2=74573&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Tue Jun 30 18:38:38 2009 @@ -25,12 +25,14 @@ class MCValue; class AsmParser { +public: + struct X86Operand; + +private: AsmLexer Lexer; MCContext &Ctx; MCStreamer &Out; - struct X86Operand; - public: AsmParser(SourceMgr &SM, MCContext &ctx, MCStreamer &OutStr) : Lexer(SM), Ctx(ctx), Out(OutStr) {} @@ -76,7 +78,7 @@ bool ParseParenExpr(AsmExpr *&Res); // X86 specific. - bool ParseX86InstOperands(MCInst &Inst); + bool ParseX86InstOperands(const char *InstName, MCInst &Inst); bool ParseX86Operand(X86Operand &Op); bool ParseX86MemOperand(X86Operand &Op); Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=74573&r1=74572&r2=74573&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Tue Jun 30 18:38:38 2009 @@ -65,10 +65,6 @@ Res.Mem.ScaleReg = ScaleReg; return Res; } - - void AddToMCInst(MCInst &I) { - // FIXME: Add in x86 order here. - } }; bool AsmParser::ParseX86Operand(X86Operand &Op) { @@ -195,27 +191,34 @@ return false; } +/// MatchX86Inst - Convert a parsed instruction name and operand list into a +/// concrete instruction. +static bool MatchX86Inst(const char *Name, + llvm::SmallVector &Operands, + MCInst &Inst) { + return false; +} + /// ParseX86InstOperands - Parse the operands of an X86 instruction and return /// them as the operands of an MCInst. -bool AsmParser::ParseX86InstOperands(MCInst &Inst) { - // If no operands are present, just return. - if (Lexer.is(asmtok::EndOfStatement)) - return false; +bool AsmParser::ParseX86InstOperands(const char *InstName, MCInst &Inst) { + llvm::SmallVector Operands; - // Read the first operand. - X86Operand Op; - if (ParseX86Operand(Op)) - return true; - Op.AddToMCInst(Inst); - - while (Lexer.is(asmtok::Comma)) { - Lexer.Lex(); // Eat the comma. - - // Parse and remember the operand. - Op = X86Operand(); - if (ParseX86Operand(Op)) + if (Lexer.isNot(asmtok::EndOfStatement)) { + // Read the first operand. + Operands.push_back(X86Operand()); + if (ParseX86Operand(Operands.back())) return true; - Op.AddToMCInst(Inst); + + while (Lexer.is(asmtok::Comma)) { + Lexer.Lex(); // Eat the comma. + + // Parse and remember the operand. + Operands.push_back(X86Operand()); + if (ParseX86Operand(Operands.back())) + return true; + } } - return false; + + return MatchX86Inst(InstName, Operands, Inst); } From resistor at mac.com Tue Jun 30 18:40:00 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 30 Jun 2009 23:40:00 -0000 Subject: [llvm-commits] [llvm] r74574 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp Message-ID: <200906302340.n5UNe0NR000520@zion.cs.uiuc.edu> Author: resistor Date: Tue Jun 30 18:39:59 2009 New Revision: 74574 URL: http://llvm.org/viewvc/llvm-project?rev=74574&view=rev Log: Add a global context, for easing backwards compatibility. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74574&r1=74573&r2=74574&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Tue Jun 30 18:39:59 2009 @@ -197,6 +197,9 @@ VectorType* getVectorTypeTruncatedElement(const VectorType* VTy); }; +/// FOR BACKWARDS COMPATIBILITY - Returns a global context. +LLVMContext* getGlobalContext(); + } #endif Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74574&r1=74573&r2=74574&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Jun 30 18:39:59 2009 @@ -15,10 +15,17 @@ #include "llvm/LLVMContext.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +#include "llvm/Support/ManagedStatic.h" #include "LLVMContextImpl.h" using namespace llvm; +static ManagedStatic GlobalContext; + +LLVMContext* getGlobalContext() { + return &*GlobalContext; +} + LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl()) { } LLVMContext::~LLVMContext() { delete pImpl; } From isanbard at gmail.com Tue Jun 30 18:45:04 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Jun 2009 16:45:04 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74570 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200906302318.n5UNI7ei032326@zion.cs.uiuc.edu> References: <200906302318.n5UNI7ei032326@zion.cs.uiuc.edu> Message-ID: <16e5fdf90906301645v9ec57cpa6c05515077331a8@mail.gmail.com> Hi Dale, The buildbots are getting this error message: /Volumes/Sandbox/Buildbot/llvm/build.llvm-gcc-i386-darwin9/llvm-gcc.src/gcc/llvm-convert.cpp: In function 'void ChooseConstraintTuple(const char**, tree_node*, unsigned int, unsigned int, unsigned int, const char**)': /Volumes/Sandbox/Buildbot/llvm/build.llvm-gcc-i386-darwin9/llvm-gcc.src/gcc/llvm-convert.cpp:4013: error: ISO C++ forbids variable-size array 'Weights' /Volumes/Sandbox/Buildbot/llvm/build.llvm-gcc-i386-darwin9/llvm-gcc.src/gcc/llvm-convert.cpp:4017: error: ISO C++ forbids variable-size array 'RunningConstraints' Could you take a look? -bw On Tue, Jun 30, 2009 at 4:18 PM, Dale Johannesen wrote: > Author: johannes > Date: Tue Jun 30 18:18:07 2009 > New Revision: 74570 > > URL: http://llvm.org/viewvc/llvm-project?rev=74570&view=rev > Log: > Add high-level matching algorithm for multiple > alternative constraints in asm. ?The low-level part, > matching one possible constraint against one operand, > is not done (of course, this is the hard part). ?For > variety, this time alternative 0 is always matched, > with more random variation in tests that use this. > > > Modified: > ? ?llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74570&r1=74569&r2=74570&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 30 18:18:07 2009 > @@ -3981,6 +3981,14 @@ > ? return Result; > ?} > > +/// See if operand "exp" can use the indicated Constraint (which is > +/// terminated by a null or a comma). > +/// Returns: ?-1=no, 0=yes but auxiliary instructions needed, 1=yes and free > +int MatchWeight(const char *Constraint, tree exp, bool isInput) { > + ?/// TEMPORARY. ?This has the effect that alternative 0 is always chosen. > + ?return 0; > +} > + > ?/// ChooseConstraintTuple: we know each of the NumInputs+NumOutputs strings > ?/// in Constraints[] is a comma-separated list of NumChoices different > ?/// constraints. ?Look through the operands and constraint possibilities > @@ -4000,13 +4008,67 @@ > ? ? ? ? ? ? ? ? ? ? ? unsigned NumOutputs, unsigned NumChoices, > ? ? ? ? ? ? ? ? ? ? ? const char **ReplacementStrings) > ?{ > - ?unsigned int CommasToSkip; > - ?// TEMPORARY: assume the second set of constraints is the right one. > - ?// This is totally wrong, of course, but allows the mechanics of string > - ?// handling to be tested. > - ?CommasToSkip = 1; > - > + ?int MaxWeight = 0; > + ?unsigned int CommasToSkip = 0; > + ?int Weights[NumChoices]; > + ?// RunningConstraints is pointers into the Constraints strings which > + ?// are incremented as we go to point to the beginning of each > + ?// comma-separated alternative. > + ?const char* RunningConstraints[NumInputs+NumOutputs]; > + ?memcpy(RunningConstraints, Constraints, > + ? ? ? ? (NumInputs+NumOutputs) * sizeof(const char*)); > + ?// The entire point of this loop is to compute CommasToSkip. > + ?for (unsigned int i=0; i + ? ?Weights[i] = 0; > + ? ?unsigned int j = 0; > + ? ?for (tree Output = ASM_OUTPUTS(exp); j + ? ? ? ? j++, Output = TREE_CHAIN(Output)) { > + ? ? ?if (i==0) > + ? ? ? ?RunningConstraints[j]++; ? ?// skip leading = > + ? ? ?const char* p = RunningConstraints[j]; > + ? ? ?if (Weights[i] != -1) { > + ? ? ? ?int w = MatchWeight(p, TREE_VALUE(Output), false); > + ? ? ? ?// Nonmatch means the entire tuple doesn't match. ?However, we > + ? ? ? ?// keep scanning to set up RunningConstraints correctly for the > + ? ? ? ?// next tuple. > + ? ? ? ?if (w < 0) > + ? ? ? ? ?Weights[i] = -1; > + ? ? ? ?else > + ? ? ? ? ?Weights[i] += w; > + ? ? ?} > + ? ? ?while (*p!=0 && *p!=',') > + ? ? ? ?p++; > + ? ? ?if (*p!=0) > + ? ? ? ?p++; > + ? ? ?RunningConstraints[j] = p; > + ? ?} > + ? ?assert(j==NumOutputs); > + ? ?for (tree Input = ASM_INPUTS(exp); j + ? ? ? ? j++, Input = TREE_CHAIN(Input)) { > + ? ? ?const char* p = RunningConstraints[j]; > + ? ? ?if (Weights[i] != -1) { > + ? ? ? ?int w = MatchWeight(p, TREE_VALUE(Input), false); > + ? ? ? ?if (w < 0) > + ? ? ? ? ?Weights[i] = -1; ? ?// As above. > + ? ? ? ?else > + ? ? ? ? ?Weights[i] += w; > + ? ? ?} > + ? ? ?while (*p!=0 && *p!=',') > + ? ? ? ?p++; > + ? ? ?if (*p!=0) > + ? ? ? ?p++; > + ? ? ?RunningConstraints[j] = p; > + ? ?} > + ? ?if (Weights[i]>MaxWeight) { > + ? ? ?CommasToSkip = i; > + ? ? ?MaxWeight = Weights[i]; > + ? ?} > + ?} > + ?// We have picked an alternative (the CommasToSkip'th one). > + ?// Change Constraints to point to malloc'd copies of the appropriate > + ?// constraints picked out of the original strings. > ? for (unsigned int i=0; i + ? ?assert(*(RunningConstraints[i])==0); ? // sanity check > ? ? const char* start = Constraints[i]; > ? ? if (i ? ? ? start++; ? ? ? ? ?// skip '=' or '+' > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dalej at apple.com Tue Jun 30 18:47:02 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 16:47:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74570 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <16e5fdf90906301645v9ec57cpa6c05515077331a8@mail.gmail.com> References: <200906302318.n5UNI7ei032326@zion.cs.uiuc.edu> <16e5fdf90906301645v9ec57cpa6c05515077331a8@mail.gmail.com> Message-ID: <3AD6E792-C8FC-458A-B21E-AE3328F22EED@apple.com> On Jun 30, 2009, at 4:45 PMPDT, Bill Wendling wrote: > Hi Dale, > > The buildbots are getting this error message: > > /Volumes/Sandbox/Buildbot/llvm/build.llvm-gcc-i386-darwin9/llvm- > gcc.src/gcc/llvm-convert.cpp: > In function 'void ChooseConstraintTuple(const char**, tree_node*, > unsigned int, unsigned int, unsigned int, const char**)': > /Volumes/Sandbox/Buildbot/llvm/build.llvm-gcc-i386-darwin9/llvm- > gcc.src/gcc/llvm-convert.cpp:4013: > error: ISO C++ forbids variable-size array 'Weights' > /Volumes/Sandbox/Buildbot/llvm/build.llvm-gcc-i386-darwin9/llvm- > gcc.src/gcc/llvm-convert.cpp:4017: > error: ISO C++ forbids variable-size array 'RunningConstraints' > > Could you take a look? Sure. Silly restriction. From dalej at apple.com Tue Jun 30 18:53:04 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 23:53:04 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> Author: johannes Date: Tue Jun 30 18:53:04 2009 New Revision: 74575 URL: http://llvm.org/viewvc/llvm-project?rev=74575&view=rev Log: Fix buildbreaking nonstandardism. (And I thought I'd never complain C++ doesn't have enough features...) Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74575&r1=74574&r2=74575&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 30 18:53:04 2009 @@ -4010,11 +4010,12 @@ { int MaxWeight = 0; unsigned int CommasToSkip = 0; - int Weights[NumChoices]; + int *Weights = (int *)alloca(NumChoices * sizeof(int)); // RunningConstraints is pointers into the Constraints strings which // are incremented as we go to point to the beginning of each // comma-separated alternative. - const char* RunningConstraints[NumInputs+NumOutputs]; + const char** RunningConstraints = + (const char**)alloca((NumInputs+NumOutputs)*sizeof(const char*)); memcpy(RunningConstraints, Constraints, (NumInputs+NumOutputs) * sizeof(const char*)); // The entire point of this loop is to compute CommasToSkip. From david_goodwin at apple.com Tue Jun 30 19:01:13 2009 From: david_goodwin at apple.com (David Goodwin) Date: Wed, 01 Jul 2009 00:01:13 -0000 Subject: [llvm-commits] [llvm] r74577 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/load-global.ll test/CodeGen/Thumb2/tls1.ll test/CodeGen/Thumb2/tls2.ll Message-ID: <200907010001.n6101DXu001247@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jun 30 19:01:13 2009 New Revision: 74577 URL: http://llvm.org/viewvc/llvm-project?rev=74577&view=rev Log: Add PIC load and store patterns for Thumb-2. Added: llvm/trunk/test/CodeGen/Thumb2/tls1.ll llvm/trunk/test/CodeGen/Thumb2/tls2.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/test/CodeGen/Thumb2/load-global.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74577&r1=74576&r2=74577&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jun 30 19:01:13 2009 @@ -419,6 +419,18 @@ [(opnode GPR:$src, t2addrmode_so_reg:$addr)]>; } +/// T2I_picld - Defines the PIC load pattern. +class T2I_picld : + T2I<(outs GPR:$dst), (ins addrmodepc:$addr), + !strconcat("${addr:label}:\n\t", opc), " $dst, $addr", + [(set GPR:$dst, (opnode addrmodepc:$addr))]>; + +/// T2I_picst - Defines the PIC store pattern. +class T2I_picst : + T2I<(outs), (ins GPR:$src, addrmodepc:$addr), + !strconcat("${addr:label}:\n\t", opc), " $src, $addr", + [(opnode GPR:$src, addrmodepc:$addr)]>; + //===----------------------------------------------------------------------===// // Instructions //===----------------------------------------------------------------------===// @@ -539,6 +551,22 @@ def t2STRDi8 : T2Ii8s4<(outs), (ins GPR:$src, t2addrmode_imm8s4:$addr), "strd", " $src, $addr", []>; + +// Address computation and loads and stores in PIC mode. +let isNotDuplicable = 1, AddedComplexity = 10 in { +let canFoldAsLoad = 1 in +def t2PICLDR : T2I_picld<"ldr", UnOpFrag<(load node:$Src)>>; + +def t2PICLDRH : T2I_picld<"ldrh", UnOpFrag<(zextloadi16 node:$Src)>>; +def t2PICLDRB : T2I_picld<"ldrb", UnOpFrag<(zextloadi8 node:$Src)>>; +def t2PICLDRSH : T2I_picld<"ldrsh", UnOpFrag<(sextloadi16 node:$Src)>>; +def t2PICLDRSB : T2I_picld<"ldrsb", UnOpFrag<(sextloadi8 node:$Src)>>; + +def t2PICSTR : T2I_picst<"str", BinOpFrag<(store node:$LHS, node:$RHS)>>; +def t2PICSTRH : T2I_picst<"strh", BinOpFrag<(truncstorei16 node:$LHS, node:$RHS)>>; +def t2PICSTRB : T2I_picst<"strb", BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>; +} // isNotDuplicable = 1, AddedComplexity = 10 + //===----------------------------------------------------------------------===// // Move Instructions. // Modified: llvm/trunk/test/CodeGen/Thumb2/load-global.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/load-global.ll?rev=74577&r1=74576&r2=74577&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/load-global.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/load-global.ll Tue Jun 30 19:01:13 2009 @@ -1,5 +1,15 @@ -; RUN: llvm-as < %s | llc -mtriple=thumbv7-apple-darwin -; RUN: llvm-as < %s | llc -mtriple=thumbv7-apple-darwin -relocation-model=pic | grep add | grep pc +; RUN: llvm-as < %s | \ +; RUN: llc -mtriple=thumbv7-apple-darwin -relocation-model=static | \ +; RUN: not grep {L_G\$non_lazy_ptr} +; RUN: llvm-as < %s | \ +; RUN: llc -mtriple=thumbv7-apple-darwin -relocation-model=dynamic-no-pic | \ +; RUN: grep {L_G\$non_lazy_ptr} | count 2 +; RUN: llvm-as < %s | \ +; RUN: llc -mtriple=thumbv7-apple-darwin -relocation-model=pic | \ +; RUN: grep {ldr.*pc} | count 1 +; RUN: llvm-as < %s | \ +; RUN: llc -mtriple=thumbv7-linux-gnueabi -relocation-model=pic | \ +; RUN: grep {GOT} | count 1 @G = external global i32 Added: llvm/trunk/test/CodeGen/Thumb2/tls1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/tls1.ll?rev=74577&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/tls1.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/tls1.ll Tue Jun 30 19:01:13 2009 @@ -0,0 +1,20 @@ +; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi | \ +; RUN: grep {i(tpoff)} +; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi | \ +; RUN: grep {__aeabi_read_tp} +; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi \ +; RUN: -relocation-model=pic | grep {__tls_get_addr} + + + at i = thread_local global i32 15 ; [#uses=2] + +define i32 @f() { +entry: + %tmp1 = load i32* @i ; [#uses=1] + ret i32 %tmp1 +} + +define i32* @g() { +entry: + ret i32* @i +} Added: llvm/trunk/test/CodeGen/Thumb2/tls2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/tls2.ll?rev=74577&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/tls2.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/tls2.ll Tue Jun 30 19:01:13 2009 @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi | \ +; RUN: grep {i(gottpoff)} +; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi | \ +; RUN: grep {ldr r., \[pc, r.\]} +; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi \ +; RUN: -relocation-model=pic | grep {__tls_get_addr} + + at i = external thread_local global i32 ; [#uses=2] + +define i32 @f() { +entry: + %tmp1 = load i32* @i ; [#uses=1] + ret i32 %tmp1 +} + +define i32* @g() { +entry: + ret i32* @i +} From clattner at apple.com Tue Jun 30 19:45:11 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 17:45:11 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> Message-ID: On Jun 30, 2009, at 4:53 PM, Dale Johannesen wrote: > Author: johannes > Date: Tue Jun 30 18:53:04 2009 > New Revision: 74575 > > URL: http://llvm.org/viewvc/llvm-project?rev=74575&view=rev > Log: > Fix buildbreaking nonstandardism. (And I thought I'd > never complain C++ doesn't have enough features...) Hi Dale, It's not that big of a deal, but please use SmallVector or something instead of alloca. SmallVector works when "N" is more than 4 by going to the heap so you won't run out of stack space for large N, and is more portable. -Chris > > > Modified: > llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74575&r1=74574&r2=74575&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 30 18:53:04 2009 > @@ -4010,11 +4010,12 @@ > { > int MaxWeight = 0; > unsigned int CommasToSkip = 0; > - int Weights[NumChoices]; > + int *Weights = (int *)alloca(NumChoices * sizeof(int)); > // RunningConstraints is pointers into the Constraints strings which > // are incremented as we go to point to the beginning of each > // comma-separated alternative. > - const char* RunningConstraints[NumInputs+NumOutputs]; > + const char** RunningConstraints = > + (const char**)alloca((NumInputs+NumOutputs)*sizeof(const char*)); > memcpy(RunningConstraints, Constraints, > (NumInputs+NumOutputs) * sizeof(const char*)); > // The entire point of this loop is to compute CommasToSkip. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Tue Jun 30 19:51:06 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 17:51:06 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> Message-ID: <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> On Jun 30, 2009, at 5:45 PMPDT, Chris Lattner wrote: > > On Jun 30, 2009, at 4:53 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Tue Jun 30 18:53:04 2009 >> New Revision: 74575 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74575&view=rev >> Log: >> Fix buildbreaking nonstandardism. (And I thought I'd >> never complain C++ doesn't have enough features...) > > Hi Dale, > > It's not that big of a deal, but please use SmallVector or > something instead of alloca. SmallVector works when "N" is more than > 4 by going to the heap so you won't run out of stack space for large > N, and is more portable. I am not a big lover of alloca, but it was used several places in this code before I started working on it so I don't think portability can be a problem, and the numbers involved cannot be big enough to run out of stack space. > -Chris > >> >> >> Modified: >> llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp >> >> Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74575&r1=74574&r2=74575&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) >> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 30 18:53:04 2009 >> @@ -4010,11 +4010,12 @@ >> { >> int MaxWeight = 0; >> unsigned int CommasToSkip = 0; >> - int Weights[NumChoices]; >> + int *Weights = (int *)alloca(NumChoices * sizeof(int)); >> // RunningConstraints is pointers into the Constraints strings which >> // are incremented as we go to point to the beginning of each >> // comma-separated alternative. >> - const char* RunningConstraints[NumInputs+NumOutputs]; >> + const char** RunningConstraints = >> + (const char**)alloca((NumInputs+NumOutputs)*sizeof(const >> char*)); >> memcpy(RunningConstraints, Constraints, >> (NumInputs+NumOutputs) * sizeof(const char*)); >> // The entire point of this loop is to compute CommasToSkip. >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Tue Jun 30 19:51:11 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 17:51:11 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> Message-ID: <899A1CC6-2EC6-45A3-B1E4-77E116D96E5F@apple.com> On Jun 30, 2009, at 5:45 PMPDT, Chris Lattner wrote: > > On Jun 30, 2009, at 4:53 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Tue Jun 30 18:53:04 2009 >> New Revision: 74575 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74575&view=rev >> Log: >> Fix buildbreaking nonstandardism. (And I thought I'd >> never complain C++ doesn't have enough features...) > > Hi Dale, > > It's not that big of a deal, but please use SmallVector or > something instead of alloca. SmallVector works when "N" is more than > 4 by going to the heap so you won't run out of stack space for large > N, and is more portable. > > -Chris > >> >> >> Modified: >> llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp >> >> Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74575&r1=74574&r2=74575&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) >> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 30 18:53:04 2009 >> @@ -4010,11 +4010,12 @@ >> { >> int MaxWeight = 0; >> unsigned int CommasToSkip = 0; >> - int Weights[NumChoices]; >> + int *Weights = (int *)alloca(NumChoices * sizeof(int)); >> // RunningConstraints is pointers into the Constraints strings which >> // are incremented as we go to point to the beginning of each >> // comma-separated alternative. >> - const char* RunningConstraints[NumInputs+NumOutputs]; >> + const char** RunningConstraints = >> + (const char**)alloca((NumInputs+NumOutputs)*sizeof(const >> char*)); >> memcpy(RunningConstraints, Constraints, >> (NumInputs+NumOutputs) * sizeof(const char*)); >> // The entire point of this loop is to compute CommasToSkip. >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Jun 30 20:10:39 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 18:10:39 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> Message-ID: On Jun 30, 2009, at 5:51 PM, Dale Johannesen wrote: >> >> It's not that big of a deal, but please use SmallVector or >> something instead of alloca. SmallVector works when "N" is more than >> 4 by going to the heap so you won't run out of stack space for large >> N, and is more portable. > > I am not a big lover of alloca, but it was used several places in this > code before I started working on it so I don't think portability can > be a problem, and the numbers involved cannot be big enough to run out > of stack space. Ok, works for me. Please don't use it in normal llvm code though, llvm-gcc is fine. -Chris From dalej at apple.com Tue Jun 30 20:10:39 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Jun 2009 18:10:39 -0700 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: References: Message-ID: <1CB19DE4-DB7F-43AA-87D9-245656CEA0E8@apple.com> I'll look at this, and do some testing on Darwin. It will take a little time. Thanks for doing this. On Jun 27, 2009, at 8:15 AMPDT, Tilmann Scheller wrote: > Hello, > > attached is a series of patches which implement the SVR4 ABI for > PowerPC. Patches were made against revision 74382 and need to be > applied in order. A patch which adds SVR4 support to llvm-gcc will > follow soon. > > The current state of LLVM on 32-bit PowerPC Linux: > compat.exp passes all tests (those are the ABI tests from the GCC > test suite) You should also try struct-layout-1.exp . Also, make sure to run both sets of tests in the mode where they compare against the installed compiler; see ALT_CC_UNDER_TEST in the gcc documentation. Without that you're checking whether llvm-gcc is consistent with itself, which is a good thing but not sufficient. You may find t006 in the C++ part fails due to PR 2203; I don't get any other failures on Darwin. > C-only nightly tester results: 1638 TEST-PASS / 96 TEST-FAIL > llvm-gcc bootstraps at -O0 with a stage 2/3 comparison failure of > varasm.o > > These patches were not tested on Darwin PPC, so it would be really > great if someone with a Darwin PPC nightly tester (Evan? :) ) could > make a run with the patches applied. Just to make sure that I did not > introduce any major regressions :) > > Feedback welcome! > > Greetings, > > Tilmann -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Small-cleanups-in-the-PowerPC-backend.patch Type: text/x-patch Size: 12107 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/aabad2ec/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Add-NumFixedArgs-attribute-to-CallSDNode-which-indic.patch Type: text/x-patch Size: 19567 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/aabad2ec/attachment-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-Implement-the-SVR4-ABI-for-PowerPC.patch Type: text/x-patch Size: 66356 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/aabad2ec/attachment-0002.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-Refactor-ABI-code-in-the-PowerPC-backend.patch Type: text/x-patch Size: 81794 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/aabad2ec/attachment-0003.bin -------------- next part -------------- > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From daniel at zuster.org Tue Jun 30 20:48:55 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 01:48:55 -0000 Subject: [llvm-commits] [llvm] r74579 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/AsmPrinter/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/IA64/ lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/ Message-ID: <200907010148.n611muFo005142@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jun 30 20:48:54 2009 New Revision: 74579 URL: http://llvm.org/viewvc/llvm-project?rev=74579&view=rev Log: Remove unused AsmPrinter OptLevel argument, and propogate. - This more or less amounts to a revert of r65379. I'm curious to know what happened that caused this variable to become unused. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/Target/ARM/ARM.h llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.h llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/Alpha.h llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/SPU.h llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp llvm/trunk/lib/Target/IA64/IA64.h llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp llvm/trunk/lib/Target/IA64/IA64TargetMachine.h llvm/trunk/lib/Target/MSP430/MSP430.h llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/Mips.h llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp llvm/trunk/lib/Target/Mips/MipsTargetMachine.h llvm/trunk/lib/Target/PIC16/PIC16.h llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPC.h llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/Sparc.h llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h llvm/trunk/lib/Target/X86/X86.h llvm/trunk/lib/Target/X86/X86TargetMachine.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.h llvm/trunk/lib/Target/XCore/XCore.h llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Jun 30 20:48:54 2009 @@ -65,8 +65,6 @@ /// DW - If available, this is a pointer to the current dwarf writer. DwarfWriter *DW; - /// OptLevel - Generating code at a specific optimization level. - CodeGenOpt::Level OptLevel; public: /// Output stream on which we're printing assembly code. /// @@ -120,7 +118,7 @@ protected: explicit AsmPrinter(raw_ostream &o, TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, bool V); + const TargetAsmInfo *T, bool V); public: virtual ~AsmPrinter(); @@ -139,7 +137,8 @@ /// /// This method is used when about to emit executable code. /// - void SwitchToTextSection(const char *NewSection, const GlobalValue *GV = NULL); + void SwitchToTextSection(const char *NewSection, + const GlobalValue *GV = NULL); /// SwitchToDataSection - Switch to the specified section of the executable /// if we are not already in it! If GV is non-null and if the global has an @@ -153,7 +152,8 @@ /// is the same as the SwitchToTextSection method, but not all assemblers /// are the same. /// - void SwitchToDataSection(const char *NewSection, const GlobalValue *GV = NULL); + void SwitchToDataSection(const char *NewSection, + const GlobalValue *GV = NULL); /// SwitchToSection - Switch to the specified section of the executable if /// we are not already in it! Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -42,8 +42,8 @@ char AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(raw_ostream &o, TargetMachine &tm, - const TargetAsmInfo *T, CodeGenOpt::Level OL, bool VDef) - : MachineFunctionPass(&ID), FunctionNumber(0), OptLevel(OL), O(o), + const TargetAsmInfo *T, bool VDef) + : MachineFunctionPass(&ID), FunctionNumber(0), O(o), TM(tm), TAI(T), TRI(tm.getRegisterInfo()), IsInTextSection(false), LastMI(0), LastFn(0), Counter(~0U), PrevDLT(0, ~0U, ~0U) { Modified: llvm/trunk/lib/Target/ARM/ARM.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARM.h (original) +++ llvm/trunk/lib/Target/ARM/ARM.h Tue Jun 30 20:48:54 2009 @@ -93,7 +93,6 @@ FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM); FunctionPass *createARMCodePrinterPass(raw_ostream &O, ARMBaseTargetMachine &TM, - CodeGenOpt::Level OptLevel, bool Verbose); FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM, MachineCodeEmitter &MCE); Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -179,7 +179,7 @@ // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); + PM.add(AsmPrinterCtor(Out, *this, Verbose)); return false; } @@ -198,7 +198,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -217,7 +217,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -232,7 +232,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -247,7 +247,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Tue Jun 30 20:48:54 2009 @@ -43,7 +43,6 @@ // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, ARMBaseTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -82,9 +82,8 @@ bool InCPMode; public: explicit ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V), DW(0), AFI(NULL), MCP(NULL), + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V), DW(0), AFI(NULL), MCP(NULL), InCPMode(false) { Subtarget = &TM.getSubtarget(); } @@ -1198,9 +1197,8 @@ /// FunctionPass *llvm::createARMCodePrinterPass(raw_ostream &o, ARMBaseTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } namespace { Modified: llvm/trunk/lib/Target/Alpha/Alpha.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/Alpha.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/Alpha.h (original) +++ llvm/trunk/lib/Target/Alpha/Alpha.h Tue Jun 30 20:48:54 2009 @@ -27,7 +27,6 @@ FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM); FunctionPass *createAlphaCodePrinterPass(raw_ostream &OS, TargetMachine &TM, - CodeGenOpt::Level OptLevel, bool Verbose); FunctionPass *createAlphaPatternInstructionSelector(TargetMachine &TM); FunctionPass *createAlphaCodeEmitterPass(AlphaTargetMachine &TM, Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -94,7 +94,7 @@ // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); + PM.add(AsmPrinterCtor(Out, *this, Verbose)); return false; } bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, @@ -104,7 +104,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; } @@ -115,7 +115,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; } Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h Tue Jun 30 20:48:54 2009 @@ -41,7 +41,6 @@ // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -38,9 +38,8 @@ /// explicit AlphaAsmPrinter(raw_ostream &o, TargetMachine &tm, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(o, tm, T, OL, V) {} + const TargetAsmInfo *T, bool V) + : AsmPrinter(o, tm, T, V) {} virtual const char *getPassName() const { return "Alpha Assembly Printer"; @@ -70,9 +69,8 @@ /// FunctionPass *llvm::createAlphaCodePrinterPass(raw_ostream &o, TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } #include "AlphaGenAsmWriter.inc" Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -50,9 +50,8 @@ std::set FnStubs, GVStubs; public: explicit SPUAsmPrinter(raw_ostream &O, TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) : - AsmPrinter(O, TM, T, OL, V) {} + const TargetAsmInfo *T, bool V) : + AsmPrinter(O, TM, T, V) {} virtual const char *getPassName() const { return "STI CBEA SPU Assembly Printer"; @@ -290,9 +289,8 @@ DwarfWriter *DW; public: explicit LinuxAsmPrinter(raw_ostream &O, SPUTargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level F, - bool V) - : SPUAsmPrinter(O, TM, T, F, V), DW(0) {} + const TargetAsmInfo *T, bool V) + : SPUAsmPrinter(O, TM, T, V), DW(0) {} virtual const char *getPassName() const { return "STI CBEA SPU Assembly Printer"; @@ -603,9 +601,8 @@ /// FunctionPass *llvm::createSPUAsmPrinterPass(raw_ostream &o, SPUTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } // Force static initialization. Modified: llvm/trunk/lib/Target/CellSPU/SPU.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPU.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPU.h (original) +++ llvm/trunk/lib/Target/CellSPU/SPU.h Tue Jun 30 20:48:54 2009 @@ -26,7 +26,6 @@ FunctionPass *createSPUISelDag(SPUTargetMachine &TM); FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, SPUTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); /*--== Utility functions/predicates/etc used all over the place: --==*/ Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -94,6 +94,6 @@ // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); + PM.add(AsmPrinterCtor(Out, *this, Verbose)); return false; } Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h (original) +++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h Tue Jun 30 20:48:54 2009 @@ -43,7 +43,6 @@ // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, SPUTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; Modified: llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -38,9 +38,8 @@ std::set ExternalFunctionNames, ExternalObjectNames; public: explicit IA64AsmPrinter(raw_ostream &O, TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V) {} + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V) {} virtual const char *getPassName() const { return "IA64 Assembly Printer"; @@ -373,9 +372,8 @@ /// FunctionPass *llvm::createIA64CodePrinterPass(raw_ostream &o, IA64TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } namespace { Modified: llvm/trunk/lib/Target/IA64/IA64.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64.h (original) +++ llvm/trunk/lib/Target/IA64/IA64.h Tue Jun 30 20:48:54 2009 @@ -39,7 +39,6 @@ /// FunctionPass *createIA64CodePrinterPass(raw_ostream &o, IA64TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); } // End llvm namespace Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -73,7 +73,7 @@ //===----------------------------------------------------------------------===// bool IA64TargetMachine::addInstSelector(PassManagerBase &PM, - CodeGenOpt::Level OptLevel){ + CodeGenOpt::Level OptLevel) { PM.add(createIA64DAGToDAGInstructionSelector(*this)); return false; } @@ -91,7 +91,7 @@ // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); + PM.add(AsmPrinterCtor(Out, *this, Verbose)); return false; } Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64TargetMachine.h (original) +++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.h Tue Jun 30 20:48:54 2009 @@ -38,7 +38,6 @@ // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, IA64TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; Modified: llvm/trunk/lib/Target/MSP430/MSP430.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430.h (original) +++ llvm/trunk/lib/Target/MSP430/MSP430.h Tue Jun 30 20:48:54 2009 @@ -26,7 +26,6 @@ CodeGenOpt::Level OptLevel); FunctionPass *createMSP430CodePrinterPass(raw_ostream &o, MSP430TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); } // end namespace llvm; Modified: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -40,9 +40,8 @@ class VISIBILITY_HIDDEN MSP430AsmPrinter : public AsmPrinter { public: MSP430AsmPrinter(raw_ostream &O, MSP430TargetMachine &TM, - const TargetAsmInfo *TAI, - CodeGenOpt::Level OL, bool V) - : AsmPrinter(O, TM, TAI, OL, V) {} + const TargetAsmInfo *TAI, bool V) + : AsmPrinter(O, TM, TAI, V) {} virtual const char *getPassName() const { return "MSP430 Assembly Printer"; @@ -77,9 +76,8 @@ /// FunctionPass *llvm::createMSP430CodePrinterPass(raw_ostream &o, MSP430TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } bool MSP430AsmPrinter::doInitialization(Module &M) { Modified: llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -62,7 +62,7 @@ bool Verbose, raw_ostream &Out) { // Output assembly language. - PM.add(createMSP430CodePrinterPass(Out, *this, OptLevel, Verbose)); + PM.add(createMSP430CodePrinterPass(Out, *this, Verbose)); return false; } Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -51,9 +51,8 @@ const MipsSubtarget *Subtarget; public: explicit MipsAsmPrinter(raw_ostream &O, MipsTargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V) { + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V) { Subtarget = &TM.getSubtarget(); } @@ -93,9 +92,8 @@ /// regardless of whether the function is in SSA form. FunctionPass *llvm::createMipsCodePrinterPass(raw_ostream &o, MipsTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/Mips/Mips.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/Mips.h (original) +++ llvm/trunk/lib/Target/Mips/Mips.h Tue Jun 30 20:48:54 2009 @@ -27,7 +27,6 @@ FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); FunctionPass *createMipsCodePrinterPass(raw_ostream &OS, MipsTargetMachine &TM, - CodeGenOpt::Level OptLevel, bool Verbose); } // end namespace llvm; Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -134,6 +134,6 @@ bool Verbose, raw_ostream &Out) { // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); + PM.add(AsmPrinterCtor(Out, *this, Verbose)); return false; } Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.h (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.h Tue Jun 30 20:48:54 2009 @@ -39,7 +39,6 @@ // linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, MipsTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; Modified: llvm/trunk/lib/Target/PIC16/PIC16.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16.h Tue Jun 30 20:48:54 2009 @@ -331,7 +331,6 @@ FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM); FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS, PIC16TargetMachine &TM, - CodeGenOpt::Level OptLevel, bool Verbose); // Banksel optimzer pass. FunctionPass *createPIC16MemSelOptimizerPass(); Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -113,9 +113,8 @@ /// FunctionPass *llvm::createPIC16CodePrinterPass(raw_ostream &o, PIC16TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h Tue Jun 30 20:48:54 2009 @@ -30,9 +30,8 @@ namespace llvm { struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { explicit PIC16AsmPrinter(raw_ostream &O, PIC16TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V), DbgInfo(O, T) { + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V), DbgInfo(O, T) { PTLI = TM.getTargetLowering(); PTAI = static_cast (T); } Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -65,11 +65,11 @@ return false; } -bool PIC16TargetMachine:: -addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, - bool Verbose, raw_ostream &Out) { +bool PIC16TargetMachine::addAssemblyEmitter(PassManagerBase &PM, + CodeGenOpt::Level OptLevel, + bool Verbose, raw_ostream &Out) { // Output assembly language. - PM.add(createPIC16CodePrinterPass(Out, *this, OptLevel, Verbose)); + PM.add(createPIC16CodePrinterPass(Out, *this, Verbose)); return false; } Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -56,9 +56,8 @@ const PPCSubtarget &Subtarget; public: explicit PPCAsmPrinter(raw_ostream &O, TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V), + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V), Subtarget(TM.getSubtarget()) {} virtual const char *getPassName() const { @@ -296,9 +295,8 @@ class VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter { public: explicit PPCLinuxAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : PPCAsmPrinter(O, TM, T, OL, V){} + const TargetAsmInfo *T, bool V) + : PPCAsmPrinter(O, TM, T, V){} virtual const char *getPassName() const { return "Linux PPC Assembly Printer"; @@ -323,9 +321,8 @@ raw_ostream &OS; public: explicit PPCDarwinAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : PPCAsmPrinter(O, TM, T, OL, V), OS(O) {} + const TargetAsmInfo *T, bool V) + : PPCAsmPrinter(O, TM, T, V), OS(O) {} virtual const char *getPassName() const { return "Darwin PPC Assembly Printer"; @@ -1119,16 +1116,13 @@ /// FunctionPass *llvm::createPPCAsmPrinterPass(raw_ostream &o, PPCTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { const PPCSubtarget *Subtarget = &tm.getSubtarget(); if (Subtarget->isDarwin()) { - return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo(), - OptLevel, verbose); + return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } else { - return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), - OptLevel, verbose); + return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } } Modified: llvm/trunk/lib/Target/PowerPC/PPC.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPC.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPC.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPC.h Tue Jun 30 20:48:54 2009 @@ -28,9 +28,8 @@ FunctionPass *createPPCBranchSelectionPass(); FunctionPass *createPPCISelDag(PPCTargetMachine &TM); -FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, - PPCTargetMachine &TM, - CodeGenOpt::Level OptLevel, bool Verbose); +FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, PPCTargetMachine &TM, + bool Verbose); FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, MachineCodeEmitter &MCE); FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM, Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -152,7 +152,7 @@ raw_ostream &Out) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); + PM.add(AsmPrinterCtor(Out, *this, Verbose)); return false; } @@ -183,7 +183,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -215,7 +215,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -230,7 +230,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -245,7 +245,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h Tue Jun 30 20:48:54 2009 @@ -46,7 +46,6 @@ // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, PPCTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -50,9 +50,8 @@ unsigned BBNumber; public: explicit SparcAsmPrinter(raw_ostream &O, TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V), BBNumber(0) {} + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V), BBNumber(0) {} virtual const char *getPassName() const { return "Sparc Assembly Printer"; @@ -84,9 +83,8 @@ /// FunctionPass *llvm::createSparcCodePrinterPass(raw_ostream &o, TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } Modified: llvm/trunk/lib/Target/Sparc/Sparc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/Sparc.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/Sparc.h (original) +++ llvm/trunk/lib/Target/Sparc/Sparc.h Tue Jun 30 20:48:54 2009 @@ -25,7 +25,6 @@ FunctionPass *createSparcISelDag(SparcTargetMachine &TM); FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, TargetMachine &TM, - CodeGenOpt::Level OptLevel, bool Verbose); FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM); FunctionPass *createSparcFPMoverPass(TargetMachine &TM); Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -90,6 +90,6 @@ // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); + PM.add(AsmPrinterCtor(Out, *this, Verbose)); return false; } Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h Tue Jun 30 20:48:54 2009 @@ -39,7 +39,6 @@ // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Tue Jun 30 20:48:54 2009 @@ -38,9 +38,8 @@ MCStreamer *Streamer; public: explicit X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V) { + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V) { Subtarget = &TM.getSubtarget(); Context = 0; Streamer = 0; Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -25,15 +25,12 @@ /// FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o, X86TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { const X86Subtarget *Subtarget = &tm.getSubtarget(); if (Subtarget->isFlavorIntel()) - return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), - OptLevel, verbose); - return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), - OptLevel, verbose); + return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); + return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } namespace { Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h Tue Jun 30 20:48:54 2009 @@ -26,9 +26,8 @@ struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter { explicit X86IntelAsmPrinter(raw_ostream &O, X86TargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V) {} + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V) {} virtual const char *getPassName() const { return "X86 Intel-Style Assembly Printer"; Modified: llvm/trunk/lib/Target/X86/X86.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.h (original) +++ llvm/trunk/lib/Target/X86/X86.h Tue Jun 30 20:48:54 2009 @@ -46,9 +46,7 @@ /// assembly code for a MachineFunction to the given output stream, /// using the given target machine description. /// -FunctionPass *createX86CodePrinterPass(raw_ostream &o, - X86TargetMachine &tm, - CodeGenOpt::Level OptLevel, +FunctionPass *createX86CodePrinterPass(raw_ostream &o, X86TargetMachine &tm, bool Verbose); /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -226,7 +226,7 @@ assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); + PM.add(AsmPrinterCtor(Out, *this, Verbose)); return false; } @@ -254,7 +254,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -284,7 +284,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -298,7 +298,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; @@ -312,7 +312,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); + PM.add(AsmPrinterCtor(errs(), *this, true)); } return false; Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Tue Jun 30 20:48:54 2009 @@ -45,7 +45,6 @@ // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, X86TargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; Modified: llvm/trunk/lib/Target/XCore/XCore.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCore.h?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCore.h (original) +++ llvm/trunk/lib/Target/XCore/XCore.h Tue Jun 30 20:48:54 2009 @@ -26,7 +26,6 @@ FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM); FunctionPass *createXCoreCodePrinterPass(raw_ostream &OS, XCoreTargetMachine &TM, - CodeGenOpt::Level OptLevel, bool Verbose); } // end namespace llvm; Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Tue Jun 30 20:48:54 2009 @@ -58,9 +58,8 @@ const XCoreSubtarget &Subtarget; public: explicit XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM, - const TargetAsmInfo *T, CodeGenOpt::Level OL, - bool V) - : AsmPrinter(O, TM, T, OL, V), DW(0), + const TargetAsmInfo *T, bool V) + : AsmPrinter(O, TM, T, V), DW(0), Subtarget(*TM.getSubtargetImpl()) {} virtual const char *getPassName() const { @@ -106,9 +105,8 @@ /// FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o, XCoreTargetMachine &tm, - CodeGenOpt::Level OptLevel, bool verbose) { - return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose); + return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } // PrintEscapedString - Print each character of the specified string, escaping Modified: llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp Tue Jun 30 20:48:54 2009 @@ -69,6 +69,6 @@ bool Verbose, raw_ostream &Out) { // Output assembly language. - PM.add(createXCoreCodePrinterPass(Out, *this, OptLevel, Verbose)); + PM.add(createXCoreCodePrinterPass(Out, *this, Verbose)); return false; } From evan.cheng at apple.com Tue Jun 30 20:55:48 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Jun 2009 18:55:48 -0700 Subject: [llvm-commits] [llvm] r74579 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/AsmPrinter/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/IA64/ lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/ In-Reply-To: <200907010148.n611muFo005142@zion.cs.uiuc.edu> References: <200907010148.n611muFo005142@zion.cs.uiuc.edu> Message-ID: On Jun 30, 2009, at 6:48 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Tue Jun 30 20:48:54 2009 > New Revision: 74579 > > URL: http://llvm.org/viewvc/llvm-project?rev=74579&view=rev > Log: > Remove unused AsmPrinter OptLevel argument, and propogate. > - This more or less amounts to a revert of r65379. I'm curious to > know what > happened that caused this variable to become unused. Is it unused? It used to control whether isel emits label nodes that force source ordering at -O0 (yeah it's horrible). Evan > > Modified: > llvm/trunk/include/llvm/CodeGen/AsmPrinter.h > llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp > llvm/trunk/lib/Target/ARM/ARM.h > llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp > llvm/trunk/lib/Target/ARM/ARMTargetMachine.h > llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp > llvm/trunk/lib/Target/Alpha/Alpha.h > llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp > llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h > llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp > llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp > llvm/trunk/lib/Target/CellSPU/SPU.h > llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp > llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h > llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp > llvm/trunk/lib/Target/IA64/IA64.h > llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp > llvm/trunk/lib/Target/IA64/IA64TargetMachine.h > llvm/trunk/lib/Target/MSP430/MSP430.h > llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp > llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp > llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp > llvm/trunk/lib/Target/Mips/Mips.h > llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp > llvm/trunk/lib/Target/Mips/MipsTargetMachine.h > llvm/trunk/lib/Target/PIC16/PIC16.h > llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp > llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h > llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp > llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp > llvm/trunk/lib/Target/PowerPC/PPC.h > llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp > llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h > llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp > llvm/trunk/lib/Target/Sparc/Sparc.h > llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp > llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h > llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h > llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp > llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h > llvm/trunk/lib/Target/X86/X86.h > llvm/trunk/lib/Target/X86/X86TargetMachine.cpp > llvm/trunk/lib/Target/X86/X86TargetMachine.h > llvm/trunk/lib/Target/XCore/XCore.h > llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp > llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) > +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Jun 30 20:48:54 > 2009 > @@ -65,8 +65,6 @@ > /// DW - If available, this is a pointer to the current dwarf > writer. > DwarfWriter *DW; > > - /// OptLevel - Generating code at a specific optimization level. > - CodeGenOpt::Level OptLevel; > public: > /// Output stream on which we're printing assembly code. > /// > @@ -120,7 +118,7 @@ > > protected: > explicit AsmPrinter(raw_ostream &o, TargetMachine &TM, > - const TargetAsmInfo *T, CodeGenOpt::Level > OL, bool V); > + const TargetAsmInfo *T, bool V); > > public: > virtual ~AsmPrinter(); > @@ -139,7 +137,8 @@ > /// > /// This method is used when about to emit executable code. > /// > - void SwitchToTextSection(const char *NewSection, const > GlobalValue *GV = NULL); > + void SwitchToTextSection(const char *NewSection, > + const GlobalValue *GV = NULL); > > /// SwitchToDataSection - Switch to the specified section of the > executable > /// if we are not already in it! If GV is non-null and if the > global has an > @@ -153,7 +152,8 @@ > /// is the same as the SwitchToTextSection method, but not all > assemblers > /// are the same. > /// > - void SwitchToDataSection(const char *NewSection, const > GlobalValue *GV = NULL); > + void SwitchToDataSection(const char *NewSection, > + const GlobalValue *GV = NULL); > > /// SwitchToSection - Switch to the specified section of the > executable if > /// we are not already in it! > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jun 30 > 20:48:54 2009 > @@ -42,8 +42,8 @@ > > char AsmPrinter::ID = 0; > AsmPrinter::AsmPrinter(raw_ostream &o, TargetMachine &tm, > - const TargetAsmInfo *T, CodeGenOpt::Level > OL, bool VDef) > - : MachineFunctionPass(&ID), FunctionNumber(0), OptLevel(OL), O(o), > + const TargetAsmInfo *T, bool VDef) > + : MachineFunctionPass(&ID), FunctionNumber(0), O(o), > TM(tm), TAI(T), TRI(tm.getRegisterInfo()), > IsInTextSection(false), LastMI(0), LastFn(0), Counter(~0U), > PrevDLT(0, ~0U, ~0U) { > > Modified: llvm/trunk/lib/Target/ARM/ARM.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARM.h (original) > +++ llvm/trunk/lib/Target/ARM/ARM.h Tue Jun 30 20:48:54 2009 > @@ -93,7 +93,6 @@ > FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM); > FunctionPass *createARMCodePrinterPass(raw_ostream &O, > ARMBaseTargetMachine &TM, > - CodeGenOpt::Level OptLevel, > bool Verbose); > FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM, > MachineCodeEmitter &MCE); > > Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -179,7 +179,7 @@ > // Output assembly language. > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); > + PM.add(AsmPrinterCtor(Out, *this, Verbose)); > > return false; > } > @@ -198,7 +198,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -217,7 +217,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -232,7 +232,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -247,7 +247,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > > Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Tue Jun 30 20:48:54 > 2009 > @@ -43,7 +43,6 @@ > // set this functions to ctor pointer at startup time if they are > linked in. > typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, > ARMBaseTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > static AsmPrinterCtorFn AsmPrinterCtor; > > > Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jun > 30 20:48:54 2009 > @@ -82,9 +82,8 @@ > bool InCPMode; > public: > explicit ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V), DW(0), AFI(NULL), MCP(NULL), > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V), DW(0), AFI(NULL), MCP(NULL), > InCPMode(false) { > Subtarget = &TM.getSubtarget(); > } > @@ -1198,9 +1197,8 @@ > /// > FunctionPass *llvm::createARMCodePrinterPass(raw_ostream &o, > ARMBaseTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, > verbose); > + return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > namespace { > > Modified: llvm/trunk/lib/Target/Alpha/Alpha.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/Alpha.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Alpha/Alpha.h (original) > +++ llvm/trunk/lib/Target/Alpha/Alpha.h Tue Jun 30 20:48:54 2009 > @@ -27,7 +27,6 @@ > FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM); > FunctionPass *createAlphaCodePrinterPass(raw_ostream &OS, > TargetMachine &TM, > - CodeGenOpt::Level > OptLevel, > bool Verbose); > FunctionPass *createAlphaPatternInstructionSelector(TargetMachine > &TM); > FunctionPass *createAlphaCodeEmitterPass(AlphaTargetMachine &TM, > > Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -94,7 +94,7 @@ > // Output assembly language. > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); > + PM.add(AsmPrinterCtor(Out, *this, Verbose)); > return false; > } > bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, > @@ -104,7 +104,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > return false; > } > @@ -115,7 +115,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > return false; > } > > Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h (original) > +++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h Tue Jun 30 > 20:48:54 2009 > @@ -41,7 +41,6 @@ > // set this functions to ctor pointer at startup time if they are > linked in. > typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, > TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > static AsmPrinterCtorFn AsmPrinterCtor; > > > Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp > (original) > +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Tue > Jun 30 20:48:54 2009 > @@ -38,9 +38,8 @@ > /// > > explicit AlphaAsmPrinter(raw_ostream &o, TargetMachine &tm, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(o, tm, T, OL, V) {} > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(o, tm, T, V) {} > > virtual const char *getPassName() const { > return "Alpha Assembly Printer"; > @@ -70,9 +69,8 @@ > /// > FunctionPass *llvm::createAlphaCodePrinterPass(raw_ostream &o, > TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), > OptLevel, verbose); > + return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > #include "AlphaGenAsmWriter.inc" > > Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp > (original) > +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Tue > Jun 30 20:48:54 2009 > @@ -50,9 +50,8 @@ > std::set FnStubs, GVStubs; > public: > explicit SPUAsmPrinter(raw_ostream &O, TargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) : > - AsmPrinter(O, TM, T, OL, V) {} > + const TargetAsmInfo *T, bool V) : > + AsmPrinter(O, TM, T, V) {} > > virtual const char *getPassName() const { > return "STI CBEA SPU Assembly Printer"; > @@ -290,9 +289,8 @@ > DwarfWriter *DW; > public: > explicit LinuxAsmPrinter(raw_ostream &O, SPUTargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level F, > - bool V) > - : SPUAsmPrinter(O, TM, T, F, V), DW(0) {} > + const TargetAsmInfo *T, bool V) > + : SPUAsmPrinter(O, TM, T, V), DW(0) {} > > virtual const char *getPassName() const { > return "STI CBEA SPU Assembly Printer"; > @@ -603,9 +601,8 @@ > /// > FunctionPass *llvm::createSPUAsmPrinterPass(raw_ostream &o, > SPUTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), > OptLevel, verbose); > + return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > // Force static initialization. > > Modified: llvm/trunk/lib/Target/CellSPU/SPU.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPU.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/CellSPU/SPU.h (original) > +++ llvm/trunk/lib/Target/CellSPU/SPU.h Tue Jun 30 20:48:54 2009 > @@ -26,7 +26,6 @@ > FunctionPass *createSPUISelDag(SPUTargetMachine &TM); > FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, > SPUTargetMachine &tm, > - CodeGenOpt::Level OptLevel, > bool verbose); > > /*--== Utility functions/predicates/etc used all over the place: -- > ==*/ > > Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -94,6 +94,6 @@ > // Output assembly language. > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); > + PM.add(AsmPrinterCtor(Out, *this, Verbose)); > return false; > } > > Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h (original) > +++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h Tue Jun 30 > 20:48:54 2009 > @@ -43,7 +43,6 @@ > // set this functions to ctor pointer at startup time if they are > linked in. > typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, > SPUTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > static AsmPrinterCtorFn AsmPrinterCtor; > > > Modified: llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp > (original) > +++ llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp Tue Jun > 30 20:48:54 2009 > @@ -38,9 +38,8 @@ > std::set ExternalFunctionNames, ExternalObjectNames; > public: > explicit IA64AsmPrinter(raw_ostream &O, TargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V) {} > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V) {} > > virtual const char *getPassName() const { > return "IA64 Assembly Printer"; > @@ -373,9 +372,8 @@ > /// > FunctionPass *llvm::createIA64CodePrinterPass(raw_ostream &o, > IA64TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, > verbose); > + return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > namespace { > > Modified: llvm/trunk/lib/Target/IA64/IA64.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/IA64/IA64.h (original) > +++ llvm/trunk/lib/Target/IA64/IA64.h Tue Jun 30 20:48:54 2009 > @@ -39,7 +39,6 @@ > /// > FunctionPass *createIA64CodePrinterPass(raw_ostream &o, > IA64TargetMachine &tm, > - CodeGenOpt::Level OptLevel, > bool verbose); > > } // End llvm namespace > > Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -73,7 +73,7 @@ > // > = > = > = > ----------------------------------------------------------------------= > ==// > > bool IA64TargetMachine::addInstSelector(PassManagerBase &PM, > - CodeGenOpt::Level OptLevel){ > + CodeGenOpt::Level OptLevel) { > PM.add(createIA64DAGToDAGInstructionSelector(*this)); > return false; > } > @@ -91,7 +91,7 @@ > // Output assembly language. > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); > + PM.add(AsmPrinterCtor(Out, *this, Verbose)); > return false; > } > > > Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/IA64/IA64TargetMachine.h (original) > +++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.h Tue Jun 30 > 20:48:54 2009 > @@ -38,7 +38,6 @@ > // set this functions to ctor pointer at startup time if they are > linked in. > typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, > IA64TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > static AsmPrinterCtorFn AsmPrinterCtor; > > > Modified: llvm/trunk/lib/Target/MSP430/MSP430.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/MSP430/MSP430.h (original) > +++ llvm/trunk/lib/Target/MSP430/MSP430.h Tue Jun 30 20:48:54 2009 > @@ -26,7 +26,6 @@ > CodeGenOpt::Level OptLevel); > FunctionPass *createMSP430CodePrinterPass(raw_ostream &o, > MSP430TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > } // end namespace llvm; > > > Modified: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp Tue Jun 30 > 20:48:54 2009 > @@ -40,9 +40,8 @@ > class VISIBILITY_HIDDEN MSP430AsmPrinter : public AsmPrinter { > public: > MSP430AsmPrinter(raw_ostream &O, MSP430TargetMachine &TM, > - const TargetAsmInfo *TAI, > - CodeGenOpt::Level OL, bool V) > - : AsmPrinter(O, TM, TAI, OL, V) {} > + const TargetAsmInfo *TAI, bool V) > + : AsmPrinter(O, TM, TAI, V) {} > > virtual const char *getPassName() const { > return "MSP430 Assembly Printer"; > @@ -77,9 +76,8 @@ > /// > FunctionPass *llvm::createMSP430CodePrinterPass(raw_ostream &o, > MSP430TargetMachine > &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), > OptLevel, verbose); > + return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > bool MSP430AsmPrinter::doInitialization(Module &M) { > > Modified: llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -62,7 +62,7 @@ > bool Verbose, > raw_ostream &Out) { > // Output assembly language. > - PM.add(createMSP430CodePrinterPass(Out, *this, OptLevel, Verbose)); > + PM.add(createMSP430CodePrinterPass(Out, *this, Verbose)); > return false; > } > > > Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp > (original) > +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Tue Jun > 30 20:48:54 2009 > @@ -51,9 +51,8 @@ > const MipsSubtarget *Subtarget; > public: > explicit MipsAsmPrinter(raw_ostream &O, MipsTargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V) { > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V) { > Subtarget = &TM.getSubtarget(); > } > > @@ -93,9 +92,8 @@ > /// regardless of whether the function is in SSA form. > FunctionPass *llvm::createMipsCodePrinterPass(raw_ostream &o, > MipsTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, > verbose); > + return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > // > = > = > = > ----------------------------------------------------------------------= > ==// > > Modified: llvm/trunk/lib/Target/Mips/Mips.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Mips/Mips.h (original) > +++ llvm/trunk/lib/Target/Mips/Mips.h Tue Jun 30 20:48:54 2009 > @@ -27,7 +27,6 @@ > FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); > FunctionPass *createMipsCodePrinterPass(raw_ostream &OS, > MipsTargetMachine &TM, > - CodeGenOpt::Level OptLevel, > bool Verbose); > } // end namespace llvm; > > > Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -134,6 +134,6 @@ > bool Verbose, raw_ostream &Out) { > // Output assembly language. > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); > + PM.add(AsmPrinterCtor(Out, *this, Verbose)); > return false; > } > > Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.h (original) > +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.h Tue Jun 30 > 20:48:54 2009 > @@ -39,7 +39,6 @@ > // linked in. > typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, > MipsTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > static AsmPrinterCtorFn AsmPrinterCtor; > > > Modified: llvm/trunk/lib/Target/PIC16/PIC16.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PIC16/PIC16.h (original) > +++ llvm/trunk/lib/Target/PIC16/PIC16.h Tue Jun 30 20:48:54 2009 > @@ -331,7 +331,6 @@ > FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM); > FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS, > PIC16TargetMachine &TM, > - CodeGenOpt::Level > OptLevel, > bool Verbose); > // Banksel optimzer pass. > FunctionPass *createPIC16MemSelOptimizerPass(); > > Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Tue Jun 30 > 20:48:54 2009 > @@ -113,9 +113,8 @@ > /// > FunctionPass *llvm::createPIC16CodePrinterPass(raw_ostream &o, > PIC16TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), > OptLevel, verbose); > + return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > > > Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h (original) > +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h Tue Jun 30 > 20:48:54 2009 > @@ -30,9 +30,8 @@ > namespace llvm { > struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { > explicit PIC16AsmPrinter(raw_ostream &O, PIC16TargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V), DbgInfo(O, T) { > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V), DbgInfo(O, T) { > PTLI = TM.getTargetLowering(); > PTAI = static_cast (T); > } > > Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -65,11 +65,11 @@ > return false; > } > > -bool PIC16TargetMachine:: > -addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, > - bool Verbose, raw_ostream &Out) { > +bool PIC16TargetMachine::addAssemblyEmitter(PassManagerBase &PM, > + CodeGenOpt::Level > OptLevel, > + bool Verbose, > raw_ostream &Out) { > // Output assembly language. > - PM.add(createPIC16CodePrinterPass(Out, *this, OptLevel, Verbose)); > + PM.add(createPIC16CodePrinterPass(Out, *this, Verbose)); > return false; > } > > > Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp > (original) > +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue > Jun 30 20:48:54 2009 > @@ -56,9 +56,8 @@ > const PPCSubtarget &Subtarget; > public: > explicit PPCAsmPrinter(raw_ostream &O, TargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V), > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V), > Subtarget(TM.getSubtarget()) {} > > virtual const char *getPassName() const { > @@ -296,9 +295,8 @@ > class VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter { > public: > explicit PPCLinuxAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : PPCAsmPrinter(O, TM, T, OL, V){} > + const TargetAsmInfo *T, bool V) > + : PPCAsmPrinter(O, TM, T, V){} > > virtual const char *getPassName() const { > return "Linux PPC Assembly Printer"; > @@ -323,9 +321,8 @@ > raw_ostream &OS; > public: > explicit PPCDarwinAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : PPCAsmPrinter(O, TM, T, OL, V), OS(O) {} > + const TargetAsmInfo *T, bool V) > + : PPCAsmPrinter(O, TM, T, V), OS(O) {} > > virtual const char *getPassName() const { > return "Darwin PPC Assembly Printer"; > @@ -1119,16 +1116,13 @@ > /// > FunctionPass *llvm::createPPCAsmPrinterPass(raw_ostream &o, > PPCTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > const PPCSubtarget *Subtarget = &tm.getSubtarget(); > > if (Subtarget->isDarwin()) { > - return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo(), > - OptLevel, verbose); > + return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo(), > verbose); > } else { > - return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), > - OptLevel, verbose); > + return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), > verbose); > } > } > > > Modified: llvm/trunk/lib/Target/PowerPC/PPC.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPC.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPC.h (original) > +++ llvm/trunk/lib/Target/PowerPC/PPC.h Tue Jun 30 20:48:54 2009 > @@ -28,9 +28,8 @@ > > FunctionPass *createPPCBranchSelectionPass(); > FunctionPass *createPPCISelDag(PPCTargetMachine &TM); > -FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, > - PPCTargetMachine &TM, > - CodeGenOpt::Level OptLevel, > bool Verbose); > +FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, > PPCTargetMachine &TM, > + bool Verbose); > FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, > MachineCodeEmitter &MCE); > FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM, > > Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -152,7 +152,7 @@ > raw_ostream &Out) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); > + PM.add(AsmPrinterCtor(Out, *this, Verbose)); > > return false; > } > @@ -183,7 +183,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -215,7 +215,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -230,7 +230,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -245,7 +245,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > > Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h (original) > +++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h Tue Jun 30 > 20:48:54 2009 > @@ -46,7 +46,6 @@ > // set this functions to ctor pointer at startup time if they are > linked in. > typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, > PPCTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > static AsmPrinterCtorFn AsmPrinterCtor; > > > Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp > (original) > +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue > Jun 30 20:48:54 2009 > @@ -50,9 +50,8 @@ > unsigned BBNumber; > public: > explicit SparcAsmPrinter(raw_ostream &O, TargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V), BBNumber(0) {} > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V), BBNumber(0) {} > > virtual const char *getPassName() const { > return "Sparc Assembly Printer"; > @@ -84,9 +83,8 @@ > /// > FunctionPass *llvm::createSparcCodePrinterPass(raw_ostream &o, > TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), > OptLevel, verbose); > + return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > > > Modified: llvm/trunk/lib/Target/Sparc/Sparc.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/Sparc.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Sparc/Sparc.h (original) > +++ llvm/trunk/lib/Target/Sparc/Sparc.h Tue Jun 30 20:48:54 2009 > @@ -25,7 +25,6 @@ > > FunctionPass *createSparcISelDag(SparcTargetMachine &TM); > FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, > TargetMachine &TM, > - CodeGenOpt::Level > OptLevel, > bool Verbose); > FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM); > FunctionPass *createSparcFPMoverPass(TargetMachine &TM); > > Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -90,6 +90,6 @@ > // Output assembly language. > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); > + PM.add(AsmPrinterCtor(Out, *this, Verbose)); > return false; > } > > Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h (original) > +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h Tue Jun 30 > 20:48:54 2009 > @@ -39,7 +39,6 @@ > // set this functions to ctor pointer at startup time if they are > linked in. > typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, > TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > static AsmPrinterCtorFn AsmPrinterCtor; > > > Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) > +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Tue Jun > 30 20:48:54 2009 > @@ -38,9 +38,8 @@ > MCStreamer *Streamer; > public: > explicit X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V) { > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V) { > Subtarget = &TM.getSubtarget(); > Context = 0; > Streamer = 0; > > Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Tue Jun > 30 20:48:54 2009 > @@ -25,15 +25,12 @@ > /// > FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o, > X86TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > const X86Subtarget *Subtarget = &tm.getSubtarget(); > > if (Subtarget->isFlavorIntel()) > - return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), > - OptLevel, verbose); > - return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), > - OptLevel, verbose); > + return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), > verbose); > + return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > namespace { > > Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h > (original) > +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h Tue > Jun 30 20:48:54 2009 > @@ -26,9 +26,8 @@ > > struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter { > explicit X86IntelAsmPrinter(raw_ostream &O, X86TargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V) {} > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V) {} > > virtual const char *getPassName() const { > return "X86 Intel-Style Assembly Printer"; > > Modified: llvm/trunk/lib/Target/X86/X86.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86.h (original) > +++ llvm/trunk/lib/Target/X86/X86.h Tue Jun 30 20:48:54 2009 > @@ -46,9 +46,7 @@ > /// assembly code for a MachineFunction to the given output stream, > /// using the given target machine description. > /// > -FunctionPass *createX86CodePrinterPass(raw_ostream &o, > - X86TargetMachine &tm, > - CodeGenOpt::Level OptLevel, > +FunctionPass *createX86CodePrinterPass(raw_ostream &o, > X86TargetMachine &tm, > bool Verbose); > > /// createX86CodeEmitterPass - Return a pass that emits the > collected X86 code > > Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -226,7 +226,7 @@ > > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); > + PM.add(AsmPrinterCtor(Out, *this, Verbose)); > return false; > } > > @@ -254,7 +254,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -284,7 +284,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -298,7 +298,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > @@ -312,7 +312,7 @@ > if (DumpAsm) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > - PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); > + PM.add(AsmPrinterCtor(errs(), *this, true)); > } > > return false; > > Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original) > +++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Tue Jun 30 20:48:54 > 2009 > @@ -45,7 +45,6 @@ > // set this functions to ctor pointer at startup time if they are > linked in. > typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, > X86TargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose); > static AsmPrinterCtorFn AsmPrinterCtor; > > > Modified: llvm/trunk/lib/Target/XCore/XCore.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCore.h?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/XCore/XCore.h (original) > +++ llvm/trunk/lib/Target/XCore/XCore.h Tue Jun 30 20:48:54 2009 > @@ -26,7 +26,6 @@ > FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM); > FunctionPass *createXCoreCodePrinterPass(raw_ostream &OS, > XCoreTargetMachine &TM, > - CodeGenOpt::Level > OptLevel, > bool Verbose); > } // end namespace llvm; > > > Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Tue Jun 30 > 20:48:54 2009 > @@ -58,9 +58,8 @@ > const XCoreSubtarget &Subtarget; > public: > explicit XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM, > - const TargetAsmInfo *T, > CodeGenOpt::Level OL, > - bool V) > - : AsmPrinter(O, TM, T, OL, V), DW(0), > + const TargetAsmInfo *T, bool V) > + : AsmPrinter(O, TM, T, V), DW(0), > Subtarget(*TM.getSubtargetImpl()) {} > > virtual const char *getPassName() const { > @@ -106,9 +105,8 @@ > /// > FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o, > XCoreTargetMachine &tm, > - CodeGenOpt::Level > OptLevel, > bool verbose) { > - return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), > OptLevel, verbose); > + return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); > } > > // PrintEscapedString - Print each character of the specified > string, escaping > > Modified: llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp Tue Jun 30 > 20:48:54 2009 > @@ -69,6 +69,6 @@ > bool Verbose, > raw_ostream &Out) { > // Output assembly language. > - PM.add(createXCoreCodePrinterPass(Out, *this, OptLevel, Verbose)); > + PM.add(createXCoreCodePrinterPass(Out, *this, Verbose)); > return false; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Tue Jun 30 20:59:32 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 01 Jul 2009 01:59:32 -0000 Subject: [llvm-commits] [llvm] r74580 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ test/CodeGen/ARM/ Message-ID: <200907010159.n611xWJT005501@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jun 30 20:59:31 2009 New Revision: 74580 URL: http://llvm.org/viewvc/llvm-project?rev=74580&view=rev Log: Handle IMPLICIT_DEF with isUndef operand marker, part 2. This patch moves the code to annotate machineoperands to LiveIntervalAnalysis. It also add markers for implicit_def that define physical registers. The rest, is just a lot of details. Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert3.ll llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert4.ll Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp llvm/trunk/lib/CodeGen/RegisterScavenging.cpp llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Tue Jun 30 20:59:31 2009 @@ -390,6 +390,10 @@ unsigned getNumConflictsWithPhysReg(const LiveInterval &li, unsigned PhysReg) const; + /// processImplicitDefs - Process IMPLICIT_DEF instructions. Add isUndef + /// marker to implicit_def defs and their uses. + void processImplicitDefs(); + /// computeNumbering - Compute the index numbering. void computeNumbering(); Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Jun 30 20:59:31 2009 @@ -23,6 +23,7 @@ #include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" @@ -33,6 +34,8 @@ #include "llvm/Target/TargetOptions.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/ADT/DepthFirstIterator.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include @@ -98,6 +101,93 @@ } } +/// processImplicitDefs - Process IMPLICIT_DEF instructions and make sure +/// there is one implicit_def for each use. Add isUndef marker to +/// implicit_def defs and their uses. +void LiveIntervals::processImplicitDefs() { + SmallSet ImpDefRegs; + SmallVector ImpDefMIs; + MachineBasicBlock *Entry = mf_->begin(); + SmallPtrSet Visited; + for (df_ext_iterator > + DFI = df_ext_begin(Entry, Visited), E = df_ext_end(Entry, Visited); + DFI != E; ++DFI) { + MachineBasicBlock *MBB = *DFI; + for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); + I != E; ) { + MachineInstr *MI = &*I; + ++I; + if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) { + unsigned Reg = MI->getOperand(0).getReg(); + MI->getOperand(0).setIsUndef(); + ImpDefRegs.insert(Reg); + ImpDefMIs.push_back(MI); + continue; + } + for (unsigned i = 0; i != MI->getNumOperands(); ++i) { + MachineOperand& MO = MI->getOperand(i); + if (!MO.isReg() || !MO.isUse()) + continue; + unsigned Reg = MO.getReg(); + if (!Reg) + continue; + if (!ImpDefRegs.count(Reg)) + continue; + MO.setIsUndef(); + if (MO.isKill() || MI->isRegTiedToDefOperand(i)) + ImpDefRegs.erase(Reg); + } + + for (unsigned i = 0; i != MI->getNumOperands(); ++i) { + MachineOperand& MO = MI->getOperand(i); + if (!MO.isReg() || !MO.isDef()) + continue; + ImpDefRegs.erase(MO.getReg()); + } + } + + // Any outstanding liveout implicit_def's? + for (unsigned i = 0, e = ImpDefMIs.size(); i != e; ++i) { + MachineInstr *MI = ImpDefMIs[i]; + unsigned Reg = MI->getOperand(0).getReg(); + if (TargetRegisterInfo::isPhysicalRegister(Reg)) + // Physical registers are not liveout (yet). + continue; + if (!ImpDefRegs.count(Reg)) + continue; + bool HasLocalUse = false; + for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(Reg), + RE = mri_->reg_end(); RI != RE; ) { + MachineOperand &RMO = RI.getOperand(); + MachineInstr *RMI = &*RI; + ++RI; + if (RMO.isDef()) { + // Don't expect another def of the same register. + assert(RMI == MI && + "Register with multiple defs including an implicit_def?"); + continue; + } + MachineBasicBlock *RMBB = RMI->getParent(); + if (RMBB == MBB) { + HasLocalUse = true; + continue; + } + const TargetRegisterClass* RC = mri_->getRegClass(Reg); + unsigned NewVReg = mri_->createVirtualRegister(RC); + BuildMI(*RMBB, RMI, RMI->getDebugLoc(), + tii_->get(TargetInstrInfo::IMPLICIT_DEF), NewVReg); + RMO.setReg(NewVReg); + RMO.setIsUndef(); + RMO.setIsKill(); + } + if (!HasLocalUse) + MI->eraseFromParent(); + } + ImpDefRegs.clear(); + ImpDefMIs.clear(); + } +} + void LiveIntervals::computeNumbering() { Index2MiMap OldI2MI = i2miMap_; std::vector OldI2MBB = Idx2MBBMap; @@ -299,6 +389,7 @@ lv_ = &getAnalysis(); allocatableRegs_ = tri_->getAllocatableSet(fn); + processImplicitDefs(); computeNumbering(); computeIntervals(); @@ -1785,8 +1876,6 @@ if (MO.isReg() && MO.getReg() == li.reg) { MO.setReg(NewVReg); MO.setIsUndef(); - if (MO.isKill()) - MO.setIsKill(false); } } } Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Tue Jun 30 20:59:31 2009 @@ -545,26 +545,6 @@ if (!isPhys && vrm_->getPreSplitReg(cur.reg)) continue; - // A register defined by an implicit_def can be liveout the def BB and livein - // to a use BB. Add it to the livein set of the use BB's. - if (!isPhys && cur.empty()) { - if (MachineInstr *DefMI = mri_->getVRegDef(cur.reg)) { - assert(DefMI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF); - MachineBasicBlock *DefMBB = DefMI->getParent(); - SmallPtrSet Seen; - Seen.insert(DefMBB); - for (MachineRegisterInfo::reg_iterator ri = mri_->reg_begin(cur.reg), - re = mri_->reg_end(); ri != re; ++ri) { - MachineInstr *UseMI = &*ri; - MachineBasicBlock *UseMBB = UseMI->getParent(); - if (Seen.insert(UseMBB)) { - assert(TargetRegisterInfo::isPhysicalRegister(Reg) && - "Adding a virtual register to livein set?"); - UseMBB->addLiveIn(Reg); - } - } - } - } for (LiveInterval::Ranges::const_iterator I = cur.begin(), E = cur.end(); I != E; ++I) { const LiveRange &LR = *I; @@ -905,17 +885,6 @@ DOUT << tri_->getName(physReg) << '\n'; // Note the register is not really in use. vrm_->assignVirt2Phys(cur->reg, physReg); - // Since the register allocator is allowed to assign this virtual register - // physical register that overlaps other live intervals. Mark these - // operands as "Undef" which means later passes, e.g. register scavenger - // can ignore them. - for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(cur->reg), - RE = mri_->reg_end(); RI != RE; ++RI) { - MachineOperand &MO = RI.getOperand(); - MO.setIsUndef(); - if (MO.isKill()) - MO.setIsKill(false); - } return; } Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Tue Jun 30 20:59:31 2009 @@ -254,6 +254,8 @@ unsigned Idx = (i < NumECs) ? EarlyClobberMOs[i].second : DefMOs[i-NumECs].second; unsigned Reg = MO.getReg(); + if (MO.isUndef()) + continue; // If it's dead upon def, then it is now free. if (MO.isDead()) { @@ -262,7 +264,9 @@ } // Skip two-address destination operand. - if (MI->isRegTiedToUseOperand(Idx)) { + unsigned UseIdx; + if (MI->isRegTiedToUseOperand(Idx, &UseIdx) && + !MI->getOperand(UseIdx).isUndef()) { assert(isUsed(Reg) && "Using an undefined register!"); continue; } @@ -316,6 +320,8 @@ ? *DefMOs[i].first : *EarlyClobberMOs[i-NumDefs].first; unsigned Idx = (i < NumECs) ? DefMOs[i].second : EarlyClobberMOs[i-NumDefs].second; + if (MO.isUndef()) + continue; // Skip two-address destination operand. if (MI->isRegTiedToUseOperand(Idx)) Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Jun 30 20:59:31 2009 @@ -2029,8 +2029,12 @@ if (!TargetRegisterInfo::isVirtualRegister(VirtReg)) { // Check to see if this is a noop copy. If so, eliminate the // instruction before considering the dest reg to be changed. + // Also check if it's copying from an "undef", if so, we can't + // eliminate this or else the undef marker is lost and it will + // confuses the scavenger. This is extremely rare. unsigned Src, Dst, SrcSR, DstSR; - if (TII->isMoveInstr(MI, Src, Dst, SrcSR, DstSR) && Src == Dst) { + if (TII->isMoveInstr(MI, Src, Dst, SrcSR, DstSR) && Src == Dst && + !MI.findRegisterUseOperand(Src)->isUndef()) { ++NumDCE; DOUT << "Removing now-noop copy: " << MI; SmallVector KillRegs; @@ -2049,7 +2053,7 @@ Spills.disallowClobberPhysReg(VirtReg); goto ProcessNextInst; } - + // If it's not a no-op copy, it clobbers the value in the destreg. Spills.ClobberPhysReg(VirtReg); ReusedOperands.markClobbered(VirtReg); Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Tue Jun 30 20:59:31 2009 @@ -619,14 +619,19 @@ if (OpNum == 0) { // move -> store unsigned SrcReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::STR)) - .addReg(SrcReg, getKillRegState(isKill)) + .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef)) .addFrameIndex(FI).addReg(0).addImm(0).addImm(Pred).addReg(PredReg); } else { // move -> load unsigned DstReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::LDR)) - .addReg(DstReg, RegState::Define | getDeadRegState(isDead)) + .addReg(DstReg, + RegState::Define | + getDeadRegState(isDead) | + getUndefRegState(isUndef)) .addFrameIndex(FI).addReg(0).addImm(0).addImm(Pred).addReg(PredReg); } break; @@ -636,14 +641,22 @@ unsigned PredReg = MI->getOperand(3).getReg(); if (OpNum == 0) { // move -> store unsigned SrcReg = MI->getOperand(1).getReg(); + bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::FSTS)) - .addReg(SrcReg).addFrameIndex(FI) + .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef)) + .addFrameIndex(FI) .addImm(0).addImm(Pred).addReg(PredReg); } else { // move -> load unsigned DstReg = MI->getOperand(0).getReg(); - NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::FLDS), DstReg) - .addFrameIndex(FI) - .addImm(0).addImm(Pred).addReg(PredReg); + bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); + NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::FLDS)) + .addReg(DstReg, + RegState::Define | + getDeadRegState(isDead) | + getUndefRegState(isUndef)) + .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg); } break; } @@ -653,14 +666,19 @@ if (OpNum == 0) { // move -> store unsigned SrcReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::FSTD)) - .addReg(SrcReg, getKillRegState(isKill)) + .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef)) .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg); } else { // move -> load unsigned DstReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::FLDD)) - .addReg(DstReg, RegState::Define | getDeadRegState(isDead)) + .addReg(DstReg, + RegState::Define | + getDeadRegState(isDead) | + getUndefRegState(isUndef)) .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg); } break; Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp Tue Jun 30 20:59:31 2009 @@ -289,19 +289,22 @@ if (Ops[0] == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); Opc = (Opc == Alpha::BISr) ? Alpha::STQ : ((Opc == Alpha::CPYSS) ? Alpha::STS : Alpha::STT); NewMI = BuildMI(MF, MI->getDebugLoc(), get(Opc)) - .addReg(InReg, getKillRegState(isKill)) + .addReg(InReg, getKillRegState(isKill) | getUndefRegState(isUndef)) .addFrameIndex(FrameIndex) .addReg(Alpha::F31); } else { // load -> move unsigned OutReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); Opc = (Opc == Alpha::BISr) ? Alpha::LDQ : ((Opc == Alpha::CPYSS) ? Alpha::LDS : Alpha::LDT); NewMI = BuildMI(MF, MI->getDebugLoc(), get(Opc)) - .addReg(OutReg, RegState::Define | getDeadRegState(isDead)) + .addReg(OutReg, RegState::Define | getDeadRegState(isDead) | + getUndefRegState(isUndef)) .addFrameIndex(FrameIndex) .addReg(Alpha::F31); } Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp Tue Jun 30 20:59:31 2009 @@ -491,19 +491,22 @@ if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); if (FrameIndex < SPUFrameInfo::maxFrameOffset()) { MachineInstrBuilder MIB = BuildMI(MF, MI->getDebugLoc(), get(SPU::STQDr32)); - MIB.addReg(InReg, getKillRegState(isKill)); + MIB.addReg(InReg, getKillRegState(isKill) | getUndefRegState(isUndef)); NewMI = addFrameReference(MIB, FrameIndex); } } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); MachineInstrBuilder MIB = BuildMI(MF, MI->getDebugLoc(), get(Opc)); - MIB.addReg(OutReg, RegState::Define | getDeadRegState(isDead)); + MIB.addReg(OutReg, RegState::Define | getDeadRegState(isDead) | + getUndefRegState(isUndef)); Opc = (FrameIndex < SPUFrameInfo::maxFrameOffset()) ? SPU::STQDr32 : SPU::STQXr32; NewMI = addFrameReference(MIB, FrameIndex); Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp Tue Jun 30 20:59:31 2009 @@ -291,14 +291,17 @@ if (Ops[0] == 0) { // COPY -> STORE unsigned SrcReg = MI->getOperand(2).getReg(); bool isKill = MI->getOperand(2).isKill(); + bool isUndef = MI->getOperand(2).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(Mips::SW)) - .addReg(SrcReg, getKillRegState(isKill)) + .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef)) .addImm(0).addFrameIndex(FI); } else { // COPY -> LOAD unsigned DstReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(Mips::LW)) - .addReg(DstReg, RegState::Define | getDeadRegState(isDead)) + .addReg(DstReg, RegState::Define | getDeadRegState(isDead) | + getUndefRegState(isUndef)) .addImm(0).addFrameIndex(FI); } } @@ -321,14 +324,17 @@ if (Ops[0] == 0) { // COPY -> STORE unsigned SrcReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(2).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(StoreOpc)) - .addReg(SrcReg, getKillRegState(isKill)) + .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef)) .addImm(0).addFrameIndex(FI) ; } else { // COPY -> LOAD unsigned DstReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(LoadOpc)) - .addReg(DstReg, RegState::Define | getDeadRegState(isDead)) + .addReg(DstReg, RegState::Define | getDeadRegState(isDead) | + getUndefRegState(isUndef)) .addImm(0).addFrameIndex(FI); } } Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Tue Jun 30 20:59:31 2009 @@ -691,16 +691,21 @@ if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::STW)) - .addReg(InReg, getKillRegState(isKill)), + .addReg(InReg, + getKillRegState(isKill) | + getUndefRegState(isUndef)), FrameIndex); } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::LWZ)) .addReg(OutReg, RegState::Define | - getDeadRegState(isDead)), + getDeadRegState(isDead) | + getUndefRegState(isUndef)), FrameIndex); } } else if ((Opc == PPC::OR8 && @@ -708,48 +713,63 @@ if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::STD)) - .addReg(InReg, getKillRegState(isKill)), + .addReg(InReg, + getKillRegState(isKill) | + getUndefRegState(isUndef)), FrameIndex); } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::LD)) .addReg(OutReg, RegState::Define | - getDeadRegState(isDead)), + getDeadRegState(isDead) | + getUndefRegState(isUndef)), FrameIndex); } } else if (Opc == PPC::FMRD) { if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::STFD)) - .addReg(InReg, getKillRegState(isKill)), + .addReg(InReg, + getKillRegState(isKill) | + getUndefRegState(isUndef)), FrameIndex); } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::LFD)) .addReg(OutReg, RegState::Define | - getDeadRegState(isDead)), + getDeadRegState(isDead) | + getUndefRegState(isUndef)), FrameIndex); } } else if (Opc == PPC::FMRS) { if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::STFS)) - .addReg(InReg, getKillRegState(isKill)), + .addReg(InReg, + getKillRegState(isKill) | + getUndefRegState(isUndef)), FrameIndex); } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::LFS)) .addReg(OutReg, RegState::Define | - getDeadRegState(isDead)), + getDeadRegState(isDead) | + getUndefRegState(isUndef)), FrameIndex); } } Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp?rev=74580&r1=74579&r2=74580&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp Tue Jun 30 20:59:31 2009 @@ -256,17 +256,20 @@ if (OpNum == 0) { // COPY -> STORE unsigned SrcReg = MI->getOperand(1).getReg(); bool isKill = MI->getOperand(1).isKill(); + bool isUndef = MI->getOperand(1).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(isFloat ? SP::STFri : SP::STDFri)) .addFrameIndex(FI) .addImm(0) - .addReg(SrcReg, getKillRegState(isKill)); + .addReg(SrcReg, getKillRegState(isKill) | getUndefRegState(isUndef)); } else { // COPY -> LOAD unsigned DstReg = MI->getOperand(0).getReg(); bool isDead = MI->getOperand(0).isDead(); + bool isUndef = MI->getOperand(0).isUndef(); NewMI = BuildMI(MF, MI->getDebugLoc(), get(isFloat ? SP::LDFri : SP::LDDFri)) - .addReg(DstReg, RegState::Define | getDeadRegState(isDead)) + .addReg(DstReg, RegState::Define | + getDeadRegState(isDead) | getUndefRegState(isUndef)) .addFrameIndex(FI) .addImm(0); } Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert3.ll?rev=74580&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert3.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert3.ll Tue Jun 30 20:59:31 2009 @@ -0,0 +1,128 @@ +; RUN: llvm-as < %s | llc -march=arm -mtriple=armv6-apple-darwin9 + + at JJ = external global i32* ; [#uses=1] + +define arm_apcscc void @SIM(i8* %A, i8* %B, i32 %M, i32 %N, i32 %K, [256 x i32]* %V, i32 %Q, i32 %R, i32 %nseq) nounwind { +entry: + br i1 undef, label %bb5, label %bb + +bb: ; preds = %bb, %entry + br label %bb + +bb5: ; preds = %entry + br i1 undef, label %bb6, label %bb8 + +bb6: ; preds = %bb6, %bb5 + br i1 undef, label %bb8, label %bb6 + +bb8: ; preds = %bb6, %bb5 + br label %bb15 + +bb9: ; preds = %bb15 + br i1 undef, label %bb10, label %bb11 + +bb10: ; preds = %bb9 + unreachable + +bb11: ; preds = %bb9 + br i1 undef, label %bb15, label %bb12 + +bb12: ; preds = %bb11 + %0 = load i32** @JJ, align 4 ; [#uses=1] + br label %bb228.i + +bb74.i: ; preds = %bb228.i + br i1 undef, label %bb138.i, label %bb145.i + +bb138.i: ; preds = %bb74.i + br label %bb145.i + +bb145.i: ; preds = %bb228.i, %bb138.i, %bb74.i + %cflag.0.i = phi i16 [ 0, %bb228.i ], [ 0, %bb74.i ], [ 1, %bb138.i ] ; [#uses=1] + br i1 undef, label %bb146.i, label %bb151.i + +bb146.i: ; preds = %bb145.i + br i1 undef, label %bb228.i, label %bb151.i + +bb151.i: ; preds = %bb146.i, %bb145.i + %.not297 = icmp ne i16 %cflag.0.i, 0 ; [#uses=1] + %or.cond298 = and i1 undef, %.not297 ; [#uses=1] + br i1 %or.cond298, label %bb153.i, label %bb228.i + +bb153.i: ; preds = %bb151.i + br i1 undef, label %bb220.i, label %bb.nph.i98 + +bb.nph.i98: ; preds = %bb153.i + br label %bb158.i + +bb158.i: ; preds = %bb218.i, %bb.nph.i98 + %c.1020.i = phi i32 [ 0, %bb.nph.i98 ], [ %c.14.i, %bb218.i ] ; [#uses=1] + %cflag.418.i = phi i16 [ 0, %bb.nph.i98 ], [ %cflag.3.i, %bb218.i ] ; [#uses=1] + %pj.317.i = phi i32 [ undef, %bb.nph.i98 ], [ %8, %bb218.i ] ; [#uses=1] + %pi.316.i = phi i32 [ undef, %bb.nph.i98 ], [ %7, %bb218.i ] ; [#uses=1] + %fj.515.i = phi i32 [ undef, %bb.nph.i98 ], [ %fj.4.i, %bb218.i ] ; [#uses=3] + %ci.910.i = phi i32 [ undef, %bb.nph.i98 ], [ %ci.12.i, %bb218.i ] ; [#uses=2] + %i.121.i = sub i32 undef, undef ; [#uses=3] + %tmp105.i = sub i32 undef, undef ; [#uses=1] + %1 = sub i32 %c.1020.i, undef ; [#uses=0] + br i1 undef, label %bb168.i, label %bb160.i + +bb160.i: ; preds = %bb158.i + br i1 undef, label %bb161.i, label %bb168.i + +bb161.i: ; preds = %bb160.i + br i1 undef, label %bb168.i, label %bb163.i + +bb163.i: ; preds = %bb161.i + %2 = icmp slt i32 %fj.515.i, undef ; [#uses=1] + %3 = and i1 %2, undef ; [#uses=1] + br i1 %3, label %bb167.i, label %bb168.i + +bb167.i: ; preds = %bb163.i + br label %bb168.i + +bb168.i: ; preds = %bb167.i, %bb163.i, %bb161.i, %bb160.i, %bb158.i + %fi.5.i = phi i32 [ undef, %bb167.i ], [ %ci.910.i, %bb158.i ], [ undef, %bb160.i ], [ %ci.910.i, %bb161.i ], [ undef, %bb163.i ] ; [#uses=1] + %fj.4.i = phi i32 [ undef, %bb167.i ], [ undef, %bb158.i ], [ %fj.515.i, %bb160.i ], [ undef, %bb161.i ], [ %fj.515.i, %bb163.i ] ; [#uses=2] + %scevgep88.i = getelementptr i32* null, i32 %i.121.i ; [#uses=3] + %4 = load i32* %scevgep88.i, align 4 ; [#uses=2] + %scevgep89.i = getelementptr i32* %0, i32 %i.121.i ; [#uses=3] + %5 = load i32* %scevgep89.i, align 4 ; [#uses=1] + %ci.10.i = select i1 undef, i32 %pi.316.i, i32 %i.121.i ; [#uses=0] + %cj.9.i = select i1 undef, i32 %pj.317.i, i32 undef ; [#uses=0] + %6 = icmp slt i32 undef, 0 ; [#uses=3] + %ci.12.i = select i1 %6, i32 %fi.5.i, i32 %4 ; [#uses=2] + %cj.11.i100 = select i1 %6, i32 %fj.4.i, i32 %5 ; [#uses=1] + %c.14.i = select i1 %6, i32 0, i32 undef ; [#uses=2] + store i32 %c.14.i, i32* undef, align 4 + %7 = load i32* %scevgep88.i, align 4 ; [#uses=1] + %8 = load i32* %scevgep89.i, align 4 ; [#uses=1] + store i32 %ci.12.i, i32* %scevgep88.i, align 4 + store i32 %cj.11.i100, i32* %scevgep89.i, align 4 + store i32 %4, i32* undef, align 4 + br i1 undef, label %bb211.i, label %bb218.i + +bb211.i: ; preds = %bb168.i + br label %bb218.i + +bb218.i: ; preds = %bb211.i, %bb168.i + %cflag.3.i = phi i16 [ %cflag.418.i, %bb168.i ], [ 1, %bb211.i ] ; [#uses=2] + %9 = icmp slt i32 %tmp105.i, undef ; [#uses=1] + br i1 %9, label %bb220.i, label %bb158.i + +bb220.i: ; preds = %bb218.i, %bb153.i + %cflag.4.lcssa.i = phi i16 [ 0, %bb153.i ], [ %cflag.3.i, %bb218.i ] ; [#uses=0] + br i1 undef, label %bb221.i, label %bb228.i + +bb221.i: ; preds = %bb220.i + br label %bb228.i + +bb228.i: ; preds = %bb221.i, %bb220.i, %bb151.i, %bb146.i, %bb12 + br i1 undef, label %bb74.i, label %bb145.i + +bb15: ; preds = %bb11, %bb8 + br i1 undef, label %return, label %bb9 + +return: ; preds = %bb15 + ret void +} Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert4.ll?rev=74580&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert4.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert4.ll Tue Jun 30 20:59:31 2009 @@ -0,0 +1,128 @@ +; RUN: llvm-as < %s | llc -march=arm -mtriple=armv6-apple-darwin9 + + at r = external global i32 ; [#uses=1] + at qr = external global i32 ; [#uses=1] + at II = external global i32* ; [#uses=1] + at no_mis = external global i32 ; [#uses=1] + at name1 = external global i8* ; [#uses=1] + +declare arm_apcscc void @diff(i8*, i8*, i32, i32, i32, i32) nounwind + +define arm_apcscc void @SIM(i8* %A, i8* %B, i32 %M, i32 %N, i32 %K, [256 x i32]* %V, i32 %Q, i32 %R, i32 %nseq) nounwind { +entry: + br i1 undef, label %bb5, label %bb + +bb: ; preds = %bb, %entry + br label %bb + +bb5: ; preds = %entry + br i1 undef, label %bb6, label %bb8 + +bb6: ; preds = %bb6, %bb5 + br i1 undef, label %bb8, label %bb6 + +bb8: ; preds = %bb6, %bb5 + %0 = load i8** @name1, align 4 ; [#uses=0] + br label %bb15 + +bb9: ; preds = %bb15 + br i1 undef, label %bb10, label %bb11 + +bb10: ; preds = %bb9 + unreachable + +bb11: ; preds = %bb9 + store i32 0, i32* @no_mis, align 4 + %1 = getelementptr i8* %A, i32 0 ; [#uses=1] + %2 = getelementptr i8* %B, i32 0 ; [#uses=1] + tail call arm_apcscc void @diff(i8* %1, i8* %2, i32 undef, i32 undef, i32 undef, i32 undef) nounwind + br i1 undef, label %bb15, label %bb12 + +bb12: ; preds = %bb11 + %3 = load i32** @II, align 4 ; [#uses=1] + %4 = load i32* @r, align 4 ; [#uses=1] + %5 = load i32* @qr, align 4 ; [#uses=1] + br label %bb228.i + +bb74.i: ; preds = %bb228.i + br i1 undef, label %bb138.i, label %bb145.i + +bb138.i: ; preds = %bb74.i + br label %bb145.i + +bb145.i: ; preds = %bb228.i, %bb138.i, %bb74.i + br i1 undef, label %bb146.i, label %bb151.i + +bb146.i: ; preds = %bb145.i + br i1 undef, label %bb228.i, label %bb151.i + +bb151.i: ; preds = %bb146.i, %bb145.i + br i1 undef, label %bb153.i, label %bb228.i + +bb153.i: ; preds = %bb151.i + %6 = add i32 undef, -1 ; [#uses=3] + br i1 undef, label %bb220.i, label %bb.nph.i98 + +bb.nph.i98: ; preds = %bb153.i + br label %bb158.i + +bb158.i: ; preds = %bb218.i, %bb.nph.i98 + %c.1020.i = phi i32 [ 0, %bb.nph.i98 ], [ %c.14.i, %bb218.i ] ; [#uses=1] + %f.419.i = phi i32 [ undef, %bb.nph.i98 ], [ %f.5.i, %bb218.i ] ; [#uses=1] + %pi.316.i = phi i32 [ undef, %bb.nph.i98 ], [ %10, %bb218.i ] ; [#uses=1] + %fj.515.i = phi i32 [ %6, %bb.nph.i98 ], [ %fj.4.i, %bb218.i ] ; [#uses=2] + %fi.614.i = phi i32 [ undef, %bb.nph.i98 ], [ %fi.5.i, %bb218.i ] ; [#uses=3] + %cj.811.i = phi i32 [ %6, %bb.nph.i98 ], [ %cj.11.i100, %bb218.i ] ; [#uses=3] + %ci.910.i = phi i32 [ undef, %bb.nph.i98 ], [ %ci.12.i, %bb218.i ] ; [#uses=2] + %7 = sub i32 %f.419.i, %4 ; [#uses=5] + %8 = sub i32 %c.1020.i, %5 ; [#uses=2] + %9 = icmp slt i32 %7, %8 ; [#uses=1] + br i1 %9, label %bb168.i, label %bb160.i + +bb160.i: ; preds = %bb158.i + br i1 undef, label %bb161.i, label %bb168.i + +bb161.i: ; preds = %bb160.i + br i1 undef, label %bb168.i, label %bb163.i + +bb163.i: ; preds = %bb161.i + br i1 undef, label %bb167.i, label %bb168.i + +bb167.i: ; preds = %bb163.i + br label %bb168.i + +bb168.i: ; preds = %bb167.i, %bb163.i, %bb161.i, %bb160.i, %bb158.i + %fi.5.i = phi i32 [ %fi.614.i, %bb167.i ], [ %ci.910.i, %bb158.i ], [ %fi.614.i, %bb160.i ], [ %ci.910.i, %bb161.i ], [ %fi.614.i, %bb163.i ] ; [#uses=2] + %fj.4.i = phi i32 [ %cj.811.i, %bb167.i ], [ %cj.811.i, %bb158.i ], [ %fj.515.i, %bb160.i ], [ %cj.811.i, %bb161.i ], [ %fj.515.i, %bb163.i ] ; [#uses=2] + %f.5.i = phi i32 [ %7, %bb167.i ], [ %8, %bb158.i ], [ %7, %bb160.i ], [ %7, %bb161.i ], [ %7, %bb163.i ] ; [#uses=2] + %scevgep88.i = getelementptr i32* %3, i32 undef ; [#uses=1] + %ci.10.i = select i1 undef, i32 %pi.316.i, i32 undef ; [#uses=0] + %ci.12.i = select i1 undef, i32 %fi.5.i, i32 undef ; [#uses=1] + %cj.11.i100 = select i1 undef, i32 %fj.4.i, i32 undef ; [#uses=1] + %c.14.i = select i1 undef, i32 %f.5.i, i32 undef ; [#uses=1] + %10 = load i32* %scevgep88.i, align 4 ; [#uses=1] + br i1 undef, label %bb211.i, label %bb218.i + +bb211.i: ; preds = %bb168.i + br label %bb218.i + +bb218.i: ; preds = %bb211.i, %bb168.i + br i1 undef, label %bb220.i, label %bb158.i + +bb220.i: ; preds = %bb218.i, %bb153.i + %11 = getelementptr i32* null, i32 %6 ; [#uses=1] + store i32 undef, i32* %11, align 4 + br i1 undef, label %bb221.i, label %bb228.i + +bb221.i: ; preds = %bb220.i + br label %bb228.i + +bb228.i: ; preds = %bb221.i, %bb220.i, %bb151.i, %bb146.i, %bb12 + br i1 undef, label %bb74.i, label %bb145.i + +bb15: ; preds = %bb11, %bb8 + br i1 undef, label %return, label %bb9 + +return: ; preds = %bb15 + ret void +} From sabre at nondot.org Tue Jun 30 22:27:20 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 03:27:20 -0000 Subject: [llvm-commits] [llvm] r74582 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp lib/Target/X86/X86InstrBuilder.h test/CodeGen/X86/fast-isel-gv.ll Message-ID: <200907010327.n613RK7Q008043@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 22:27:19 2009 New Revision: 74582 URL: http://llvm.org/viewvc/llvm-project?rev=74582&view=rev Log: Fix some fast-isel problems selecting global variable addressing in pic mode. Added: llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86InstrBuilder.h Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=74582&r1=74581&r2=74582&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Tue Jun 30 22:27:19 2009 @@ -457,20 +457,30 @@ AM.GV = 0; return true; } - // Issue load from stub if necessary. + + // Issue load from stub. unsigned Opc = 0; const TargetRegisterClass *RC = NULL; + X86AddressMode StubAM; + StubAM.Base.Reg = AM.Base.Reg; + StubAM.GV = AM.GV; + if (TLI.getPointerTy() == MVT::i32) { Opc = X86::MOV32rm; RC = X86::GR32RegisterClass; + + if (Subtarget->isPICStyleGOT() && + TM.getRelocationModel() == Reloc::PIC_) + StubAM.GVOpFlags = X86II::MO_GOT; + } else { Opc = X86::MOV64rm; RC = X86::GR64RegisterClass; + + if (TM.getRelocationModel() != Reloc::Static) + StubAM.GVOpFlags = X86II::MO_GOTPCREL; } - X86AddressMode StubAM; - StubAM.Base.Reg = AM.Base.Reg; - StubAM.GV = AM.GV; unsigned ResultReg = createResultReg(RC); addFullAddress(BuildMI(MBB, DL, TII.get(Opc), ResultReg), StubAM); Modified: llvm/trunk/lib/Target/X86/X86InstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrBuilder.h?rev=74582&r1=74581&r2=74582&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrBuilder.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrBuilder.h Tue Jun 30 22:27:19 2009 @@ -49,8 +49,10 @@ unsigned IndexReg; unsigned Disp; GlobalValue *GV; + unsigned GVOpFlags; - X86AddressMode() : BaseType(RegBase), Scale(1), IndexReg(0), Disp(0), GV(0) { + X86AddressMode() + : BaseType(RegBase), Scale(1), IndexReg(0), Disp(0), GV(0), GVOpFlags(0) { Base.Reg = 0; } }; @@ -113,7 +115,7 @@ assert (0); MIB.addImm(AM.Scale).addReg(AM.IndexReg); if (AM.GV) - return MIB.addGlobalAddress(AM.GV, AM.Disp); + return MIB.addGlobalAddress(AM.GV, AM.Disp, AM.GVOpFlags); else return MIB.addImm(AM.Disp); } Added: llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll?rev=74582&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll (added) +++ llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll Tue Jun 30 22:27:19 2009 @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | llc -fast-isel | grep {_kill at GOTPCREL} +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-apple-darwin10.0" + at f = global i8 (...)* @kill ; [#uses=1] + +declare signext i8 @kill(...) + +define i32 @main() nounwind ssp { +entry: + %retval = alloca i32 ; [#uses=2] + %0 = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + %1 = load i8 (...)** @f, align 8 ; [#uses=1] + %2 = icmp ne i8 (...)* %1, @kill ; [#uses=1] + %3 = zext i1 %2 to i32 ; [#uses=1] + store i32 %3, i32* %0, align 4 + %4 = load i32* %0, align 4 ; [#uses=1] + store i32 %4, i32* %retval, align 4 + br label %return + +return: ; preds = %entry + %retval1 = load i32* %retval ; [#uses=1] + ret i32 %retval1 +} From devang.patel at gmail.com Tue Jun 30 22:44:19 2009 From: devang.patel at gmail.com (Devang Patel) Date: Tue, 30 Jun 2009 20:44:19 -0700 Subject: [llvm-commits] [llvm] r74579 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/AsmPrinter/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/I Message-ID: <352a1fb20906302044w19703459kc2f7a93b4cc3c3ff@mail.gmail.com> On Tue, Jun 30, 2009 at 6:55 PM, Evan Cheng wrote: > > On Jun 30, 2009, at 6:48 PM, Daniel Dunbar wrote: > >> Author: ddunbar >> Date: Tue Jun 30 20:48:54 2009 >> New Revision: 74579 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74579&view=rev >> Log: >> Remove unused AsmPrinter OptLevel argument, and propogate. >> - This more or less amounts to a revert of r65379. That patch series introduced one AsmPrinter use of opt level in AsmWriterEmitter.cpp >> I'm curious to >> know what >> ? happened that caused this variable to become unused. see r70871 > Is it unused? It used to control whether isel emits label nodes that > force source ordering at -O0 (yeah it's horrible). Isel still uses it but now AsmPrinter is not using opt level. - Devang From sabre at nondot.org Tue Jun 30 23:13:33 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 04:13:33 -0000 Subject: [llvm-commits] [llvm] r74584 - in /llvm/trunk: examples/ModuleMaker/ModuleMaker.cpp include/llvm/DerivedTypes.h include/llvm/Support/TypeBuilder.h lib/Analysis/DebugInfo.cpp lib/AsmParser/LLParser.cpp lib/Debugger/ProgramInfo.cpp lib/ExecutionEngine/JIT/JIT.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/Transforms/IPO/RaiseAllocations.cpp lib/Transforms/Utils/LowerAllocations.cpp utils/TableGen/IntrinsicEmitter.cpp Message-ID: <200907010413.n614DYxV009475@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 30 23:13:31 2009 New Revision: 74584 URL: http://llvm.org/viewvc/llvm-project?rev=74584&view=rev Log: improve the APIs for creating struct and function types with no arguments/elements to not have to create a temporary vector (in the API at least). Patch by Jay Foad! Modified: llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp llvm/trunk/include/llvm/DerivedTypes.h llvm/trunk/include/llvm/Support/TypeBuilder.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Debugger/ProgramInfo.cpp llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Modified: llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp (original) +++ llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp Tue Jun 30 23:13:31 2009 @@ -27,8 +27,7 @@ Module *M = new Module("test"); // Create the main function: first create the type 'int ()' - FunctionType *FT = FunctionType::get(Type::Int32Ty, std::vector(), - /*not vararg*/false); + FunctionType *FT = FunctionType::get(Type::Int32Ty, /*not vararg*/false); // By passing a module as the last parameter to the Function constructor, // it automatically gets appended to the Module. Modified: llvm/trunk/include/llvm/DerivedTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/include/llvm/DerivedTypes.h (original) +++ llvm/trunk/include/llvm/DerivedTypes.h Tue Jun 30 23:13:31 2009 @@ -159,6 +159,15 @@ bool isVarArg ///< Whether this is a variable argument length function ); + /// FunctionType::get - Create a FunctionType taking no parameters. + /// + static FunctionType *get( + const Type *Result, ///< The result type + bool isVarArg ///< Whether this is a variable argument length function + ) { + return get(Result, std::vector(), isVarArg); + } + /// isValidReturnType - Return true if the specified type is valid as a return /// type. static bool isValidReturnType(const Type *RetTy); @@ -234,6 +243,12 @@ static StructType *get(const std::vector &Params, bool isPacked=false); + /// StructType::get - Create an empty structure type. + /// + static StructType *get(bool isPacked=false) { + return get(std::vector(), isPacked); + } + /// StructType::get - This static method is a convenience method for /// creating structure types by specifying the elements as arguments. /// Note that this method always returns a non-packed struct. To get Modified: llvm/trunk/include/llvm/Support/TypeBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TypeBuilder.h?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/TypeBuilder.h (original) +++ llvm/trunk/include/llvm/Support/TypeBuilder.h Tue Jun 30 23:13:31 2009 @@ -253,8 +253,7 @@ private: static const FunctionType *create() { - std::vector params; - return FunctionType::get(TypeBuilder::get(), params, false); + return FunctionType::get(TypeBuilder::get(), false); } }; template class TypeBuilder { @@ -360,8 +359,7 @@ private: static const FunctionType *create() { - std::vector params; - return FunctionType::get(TypeBuilder::get(), params, true); + return FunctionType::get(TypeBuilder::get(), true); } }; template Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Tue Jun 30 23:13:31 2009 @@ -327,7 +327,7 @@ DIFactory::DIFactory(Module &m) : M(m), StopPointFn(0), FuncStartFn(0), RegionStartFn(0), RegionEndFn(0), DeclareFn(0) { - EmptyStructPtr = PointerType::getUnqual(StructType::get(NULL, NULL)); + EmptyStructPtr = PointerType::getUnqual(StructType::get()); } /// getCastToEmpty - Return this descriptor as a Constant* with type '{}*'. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jun 30 23:13:31 2009 @@ -1244,7 +1244,7 @@ Lex.Lex(); // Consume the '{' if (EatIfPresent(lltok::rbrace)) { - Result = StructType::get(std::vector(), Packed); + Result = StructType::get(Packed); return false; } Modified: llvm/trunk/lib/Debugger/ProgramInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Debugger/ProgramInfo.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/lib/Debugger/ProgramInfo.cpp (original) +++ llvm/trunk/lib/Debugger/ProgramInfo.cpp Tue Jun 30 23:13:31 2009 @@ -271,8 +271,7 @@ // should be on the use list of the llvm.dbg.translation_units global. // GlobalVariable *Units = - M->getGlobalVariable("llvm.dbg.translation_units", - StructType::get(std::vector())); + M->getGlobalVariable("llvm.dbg.translation_units", StructType::get()); if (Units == 0) throw "Program contains no debugging information!"; @@ -354,8 +353,7 @@ // should be on the use list of the llvm.dbg.translation_units global. // GlobalVariable *Units = - M->getGlobalVariable("llvm.dbg.globals", - StructType::get(std::vector())); + M->getGlobalVariable("llvm.dbg.globals", StructType::get()); if (Units == 0) throw "Program contains no debugging information!"; Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Tue Jun 30 23:13:31 2009 @@ -453,7 +453,7 @@ // arguments. Make this function and return. // First, create the function. - FunctionType *STy=FunctionType::get(RetTy, std::vector(), false); + FunctionType *STy=FunctionType::get(RetTy, false); Function *Stub = Function::Create(STy, Function::InternalLinkage, "", F->getParent()); Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Jun 30 23:13:31 2009 @@ -1928,8 +1928,7 @@ if (Ctors[i]) { CSVals[1] = Ctors[i]; } else { - const Type *FTy = FunctionType::get(Type::VoidTy, - std::vector(), false); + const Type *FTy = FunctionType::get(Type::VoidTy, false); const PointerType *PFTy = PointerType::getUnqual(FTy); CSVals[1] = Constant::getNullValue(PFTy); CSVals[0] = ConstantInt::get(Type::Int32Ty, 2147483647); Modified: llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp Tue Jun 30 23:13:31 2009 @@ -92,8 +92,7 @@ // i8*(...) * malloc // This handles the common declaration of: 'void *malloc();' const FunctionType *Malloc3Type = - FunctionType::get(PointerType::getUnqual(Type::Int8Ty), - std::vector(), true); + FunctionType::get(PointerType::getUnqual(Type::Int8Ty), true); if (TyWeHave != Malloc3Type) // Give up MallocFunc = 0; @@ -113,14 +112,12 @@ // Check to see if the prototype was forgotten, giving us // void (...) * free // This handles the common forward declaration of: 'void free();' - const FunctionType* Free2Type = FunctionType::get(Type::VoidTy, - std::vector(),true); + const FunctionType* Free2Type = FunctionType::get(Type::VoidTy, true); if (TyWeHave != Free2Type) { // One last try, check to see if we can find free as // int (...)* free. This handles the case where NOTHING was declared. - const FunctionType* Free3Type = FunctionType::get(Type::Int32Ty, - std::vector(),true); + const FunctionType* Free3Type = FunctionType::get(Type::Int32Ty, true); if (TyWeHave != Free3Type) { // Give up. Modified: llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Tue Jun 30 23:13:31 2009 @@ -89,7 +89,7 @@ const Type *BPTy = PointerType::getUnqual(Type::Int8Ty); // Prototype malloc as "char* malloc(...)", because we don't know in // doInitialization whether size_t is int or long. - FunctionType *FT = FunctionType::get(BPTy, std::vector(), true); + FunctionType *FT = FunctionType::get(BPTy, true); MallocFunc = M.getOrInsertFunction("malloc", FT); FreeFunc = M.getOrInsertFunction("free" , Type::VoidTy, BPTy, (Type *)0); return true; Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=74584&r1=74583&r2=74584&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Tue Jun 30 23:13:31 2009 @@ -146,7 +146,7 @@ OS << "IntegerType::get(" << BitWidth << ")"; } else if (VT == MVT::Other) { // MVT::OtherVT is used to mean the empty struct type here. - OS << "StructType::get(std::vector())"; + OS << "StructType::get()"; } else if (VT == MVT::f32) { OS << "Type::FloatTy"; } else if (VT == MVT::f64) { From clattner at apple.com Tue Jun 30 23:14:36 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 21:14:36 -0700 Subject: [llvm-commits] [LLVMdev] Removing std::vector from APIs In-Reply-To: References: Message-ID: <76ACE886-C1B4-4035-8EC6-544E57E97004@apple.com> On May 26, 2009, at 6:54 AM, Jay Foad wrote: > 2009/5/14 Chris Lattner : >> One minor thing is that StructType::get(NULL, 0) looks somewhat >> strange to >> me. How about adding a zero-argument version of "get" that returns >> the >> empty struct? That would allow code to use StructType::get(). > > How about this? It adds: > > FunctionType *FunctionType::get(const Type *Result, bool isVarArg); > StructType *StructType::get(bool isPacked = false); > > .. although the latter isn't used much because I've preferred to use > Type::EmptyStructTy instead. > > It passes "make check", cfe's "make test", and llvm-gcc still > bootstraps. Looks great, applied here, sorry for the delay! http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090629/079858.html http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090629/018690.html -Chris From clattner at apple.com Tue Jun 30 23:28:02 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 21:28:02 -0700 Subject: [llvm-commits] [PATCH] Improve error handling, supersede cerr+abort In-Reply-To: <4A47D8D4.6060001@gmail.com> References: <4A47D8D4.6060001@gmail.com> Message-ID: On Jun 28, 2009, at 1:55 PM, T?r?k Edwin wrote: > As discussed here is a first implementation of an error handling API > for > LLVM. > > The attached patch introduces the API, and as an example converts 2 > cerr+abort, and a assert(0)+abort to the new API. Cool, this is something we've needed for a long time. > The default is to call abort()/exit(1) as till now, but now a client > can > install a custom error handler. If the custom handler returns > abort()/exit(1) is still called. > The intention is to also change LLVM to return failure codes instead > of > aborting, but as a first incremental improvement I just introduced the > API, and tried > to preserve current behaviour. Sounds good. Here are a few specific thoughts on the patch: +++ b/include/llvm/Support/ErrorHandling.h @@ -0,0 +1,84 @@ +//===- llvm/Support/ErrorHandling.h - Callbacks for errors ------*- C+ + -*-===// .. +// +// This file defines an API for error handling, it supersedes cerr +abort(), and +// cerr+exit() style error handling. +// Callbacks can be registered for these errors through this API. +// = = =---------------------------------------------------------------------- ===// Please put a line before the last one. Also, the file should explain what it does, it should not refer to historical designs. Just say "this is used to indicate error conditions ... ". +#ifndef LLVM_SUPPORT_ERRORHANDLING_H +#define LLVM_SUPPORT_ERRORHANDLING_H +#include "llvm/Support/raw_ostream.h" +#include Please put a blank line before the #includes. Also, I think the raw_ostream header at least can be replaced with a forward declaration of the needed classes. + enum ErrorSeverity { + WarningSeverity=0, + ErrorSeverity, + FatalSeverity + }; I think that this is over-designed. The depths of the code generator should not be producing warnings, ever. Things that *can* produce warnings (e.g. llvm-mc, tblgen, etc) should do so with their own reporting mechanisms, not through this API. Likewise, I don't think there is a need for error vs fatal. There should be no fatal errors in LLVM: in cases where there is an error, it should be detected, reported, and recovered from. + // Restores default error handling behaviour. + // This must not be called between llvm_start_multithreaded() and + // llvm_stop_multithreaded(). + void llvm_remove_error_handler(llvm_error_handler_t handler); The only use of the argument is an assertion, I think you can just remove it. + // Call registered error handlers, or the default that prints message to + // stderr. + void llvm_handle_error(const std::string &reason, + enum ErrorSeverity severity); How about naming this "llvm_report_error", and remove the other llvm_report_* functions. + // Call this after every assert(0 && "something");. + // This makes sure that even if assertions are turned off, error handlers + // are invoked, and program is aborted. + static inline void llvm_unreachable(void) { + llvm_report_fatal_error("An impossible code path was reached!"); + } We don't need this. Assertions "can't happen", so assert(0) really is unreachable. +++ b/lib/ExecutionEngine/ExecutionEngine.cpp - default: assert(0 && "Invalid long double opcode"); abort(); + default: assert(0 && "Invalid long double opcode");llvm_unreachable(); This can go away. + std::string Error; + raw_string_ostream ss(Error); + ss << "Could not resolve external global address: " + << I->getName(); + llvm_report_fatal_error(ss.str()); This (and the one in JIT/JIT.cpp) can be simplified to: llvm_report_error("Could not resolve external global address: " + I- >getName()); Otherwise, this is looking like a great first step! Thank you for working on this, please send in a new adjusted patch. -Chris From daniel at zuster.org Tue Jun 30 23:28:57 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 21:28:57 -0700 Subject: [llvm-commits] [llvm] r74579 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/AsmPrinter/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/I Message-ID: <6a8523d60906302128n140f7a87y7e581d982aeb1e81@mail.gmail.com> On Tue, Jun 30, 2009 at 6:55 PM, Evan Cheng wrote: > > On Jun 30, 2009, at 6:48 PM, Daniel Dunbar wrote: > >> Author: ddunbar >> Date: Tue Jun 30 20:48:54 2009 >> New Revision: 74579 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74579&view=rev >> Log: >> Remove unused AsmPrinter OptLevel argument, and propogate. >> - This more or less amounts to a revert of r65379. I'm curious to >> know what >> ? happened that caused this variable to become unused. > > Is it unused? It used to control whether isel emits label nodes that > force source ordering at -O0 (yeah it's horrible). It was unused, yes. I didn't remove any uses, and things still build... - Daniel > Evan > >> >> Modified: >> ? ?llvm/trunk/include/llvm/CodeGen/AsmPrinter.h >> ? ?llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/ARM/ARM.h >> ? ?llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp >> ? ?llvm/trunk/lib/Target/ARM/ARMTargetMachine.h >> ? ?llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/Alpha/Alpha.h >> ? ?llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp >> ? ?llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h >> ? ?llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/CellSPU/SPU.h >> ? ?llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp >> ? ?llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h >> ? ?llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/IA64/IA64.h >> ? ?llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp >> ? ?llvm/trunk/lib/Target/IA64/IA64TargetMachine.h >> ? ?llvm/trunk/lib/Target/MSP430/MSP430.h >> ? ?llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp >> ? ?llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/Mips/Mips.h >> ? ?llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp >> ? ?llvm/trunk/lib/Target/Mips/MipsTargetMachine.h >> ? ?llvm/trunk/lib/Target/PIC16/PIC16.h >> ? ?llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h >> ? ?llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp >> ? ?llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/PowerPC/PPC.h >> ? ?llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp >> ? ?llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h >> ? ?llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/Sparc/Sparc.h >> ? ?llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp >> ? ?llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h >> ? ?llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h >> ? ?llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h >> ? ?llvm/trunk/lib/Target/X86/X86.h >> ? ?llvm/trunk/lib/Target/X86/X86TargetMachine.cpp >> ? ?llvm/trunk/lib/Target/X86/X86TargetMachine.h >> ? ?llvm/trunk/lib/Target/XCore/XCore.h >> ? ?llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp >> ? ?llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp >> >> Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Jun 30 20:48:54 >> 2009 >> @@ -65,8 +65,6 @@ >> ? ? /// DW - If available, this is a pointer to the current dwarf >> writer. >> ? ? DwarfWriter *DW; >> >> - ? ?/// OptLevel - Generating code at a specific optimization level. >> - ? ?CodeGenOpt::Level OptLevel; >> ? public: >> ? ? /// Output stream on which we're printing assembly code. >> ? ? /// >> @@ -120,7 +118,7 @@ >> >> ? protected: >> ? ? explicit AsmPrinter(raw_ostream &o, TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, CodeGenOpt::Level >> OL, bool V); >> + ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, bool V); >> >> ? public: >> ? ? virtual ~AsmPrinter(); >> @@ -139,7 +137,8 @@ >> ? ? /// >> ? ? /// This method is used when about to emit executable code. >> ? ? /// >> - ? ?void SwitchToTextSection(const char *NewSection, const >> GlobalValue *GV = NULL); >> + ? ?void SwitchToTextSection(const char *NewSection, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? const GlobalValue *GV = NULL); >> >> ? ? /// SwitchToDataSection - Switch to the specified section of the >> executable >> ? ? /// if we are not already in it! ?If GV is non-null and if the >> global has an >> @@ -153,7 +152,8 @@ >> ? ? /// is the same as the SwitchToTextSection method, but not all >> assemblers >> ? ? /// are the same. >> ? ? /// >> - ? ?void SwitchToDataSection(const char *NewSection, const >> GlobalValue *GV = NULL); >> + ? ?void SwitchToDataSection(const char *NewSection, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? const GlobalValue *GV = NULL); >> >> ? ? /// SwitchToSection - Switch to the specified section of the >> executable if >> ? ? /// we are not already in it! >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -42,8 +42,8 @@ >> >> char AsmPrinter::ID = 0; >> AsmPrinter::AsmPrinter(raw_ostream &o, TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, CodeGenOpt::Level >> OL, bool VDef) >> - ?: MachineFunctionPass(&ID), FunctionNumber(0), OptLevel(OL), O(o), >> + ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool VDef) >> + ?: MachineFunctionPass(&ID), FunctionNumber(0), O(o), >> ? ? TM(tm), TAI(T), TRI(tm.getRegisterInfo()), >> ? ? IsInTextSection(false), LastMI(0), LastFn(0), Counter(~0U), >> ? ? PrevDLT(0, ~0U, ~0U) { >> >> Modified: llvm/trunk/lib/Target/ARM/ARM.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/ARM.h (original) >> +++ llvm/trunk/lib/Target/ARM/ARM.h Tue Jun 30 20:48:54 2009 >> @@ -93,7 +93,6 @@ >> FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM); >> FunctionPass *createARMCodePrinterPass(raw_ostream &O, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ARMBaseTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose); >> FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MachineCodeEmitter &MCE); >> >> Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -179,7 +179,7 @@ >> ? // Output assembly language. >> ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? if (AsmPrinterCtor) >> - ? ?PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); >> + ? ?PM.add(AsmPrinterCtor(Out, *this, Verbose)); >> >> ? return false; >> } >> @@ -198,7 +198,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -217,7 +217,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -232,7 +232,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -247,7 +247,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> >> Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) >> +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Tue Jun 30 20:48:54 >> 2009 >> @@ -43,7 +43,6 @@ >> ? // set this functions to ctor pointer at startup time if they are >> linked in. >> ? typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARMBaseTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> ? static AsmPrinterCtorFn AsmPrinterCtor; >> >> >> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jun >> 30 20:48:54 2009 >> @@ -82,9 +82,8 @@ >> ? ? bool InCPMode; >> ? public: >> ? ? explicit ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) >> - ? ? ?: AsmPrinter(O, TM, T, OL, V), DW(0), AFI(NULL), MCP(NULL), >> + ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) >> + ? ? ?: AsmPrinter(O, TM, T, V), DW(0), AFI(NULL), MCP(NULL), >> ? ? ? ? InCPMode(false) { >> ? ? ? Subtarget = &TM.getSubtarget(); >> ? ? } >> @@ -1198,9 +1197,8 @@ >> /// >> FunctionPass *llvm::createARMCodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ARMBaseTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool verbose) { >> - ?return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, >> verbose); >> + ?return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> namespace { >> >> Modified: llvm/trunk/lib/Target/Alpha/Alpha.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/Alpha.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Alpha/Alpha.h (original) >> +++ llvm/trunk/lib/Target/Alpha/Alpha.h Tue Jun 30 20:48:54 2009 >> @@ -27,7 +27,6 @@ >> ? FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM); >> ? FunctionPass *createAlphaCodePrinterPass(raw_ostream &OS, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose); >> ? FunctionPass *createAlphaPatternInstructionSelector(TargetMachine >> &TM); >> ? FunctionPass *createAlphaCodeEmitterPass(AlphaTargetMachine &TM, >> >> Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -94,7 +94,7 @@ >> ? // Output assembly language. >> ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? if (AsmPrinterCtor) >> - ? ?PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); >> + ? ?PM.add(AsmPrinterCtor(Out, *this, Verbose)); >> ? return false; >> } >> bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, >> @@ -104,7 +104,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> ? return false; >> } >> @@ -115,7 +115,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> ? return false; >> } >> >> Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h (original) >> +++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h Tue Jun 30 >> 20:48:54 2009 >> @@ -41,7 +41,6 @@ >> ? // set this functions to ctor pointer at startup time if they are >> linked in. >> ? typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> ? static AsmPrinterCtorFn AsmPrinterCtor; >> >> >> Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp >> (original) >> +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Tue >> Jun 30 20:48:54 2009 >> @@ -38,9 +38,8 @@ >> ? ? /// >> >> ? ? explicit AlphaAsmPrinter(raw_ostream &o, TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) >> - ? ? ?: AsmPrinter(o, tm, T, OL, V) {} >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) >> + ? ? ?: AsmPrinter(o, tm, T, V) {} >> >> ? ? virtual const char *getPassName() const { >> ? ? ? return "Alpha Assembly Printer"; >> @@ -70,9 +69,8 @@ >> /// >> FunctionPass *llvm::createAlphaCodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool verbose) { >> - ?return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> OptLevel, verbose); >> + ?return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> #include "AlphaGenAsmWriter.inc" >> >> Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp >> (original) >> +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Tue >> Jun 30 20:48:54 2009 >> @@ -50,9 +50,8 @@ >> ? ? std::set FnStubs, GVStubs; >> ? public: >> ? ? explicit SPUAsmPrinter(raw_ostream &O, TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) : >> - ? ? ?AsmPrinter(O, TM, T, OL, V) {} >> + ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) : >> + ? ? ?AsmPrinter(O, TM, T, V) {} >> >> ? ? virtual const char *getPassName() const { >> ? ? ? return "STI CBEA SPU Assembly Printer"; >> @@ -290,9 +289,8 @@ >> ? ? DwarfWriter *DW; >> ? public: >> ? ? explicit LinuxAsmPrinter(raw_ostream &O, SPUTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level F, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) >> - ? ? ?: SPUAsmPrinter(O, TM, T, F, V), DW(0) {} >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) >> + ? ? ?: SPUAsmPrinter(O, TM, T, V), DW(0) {} >> >> ? ? virtual const char *getPassName() const { >> ? ? ? return "STI CBEA SPU Assembly Printer"; >> @@ -603,9 +601,8 @@ >> /// >> FunctionPass *llvm::createSPUAsmPrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SPUTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose) { >> - ?return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> OptLevel, verbose); >> + ?return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> // Force static initialization. >> >> Modified: llvm/trunk/lib/Target/CellSPU/SPU.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPU.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/CellSPU/SPU.h (original) >> +++ llvm/trunk/lib/Target/CellSPU/SPU.h Tue Jun 30 20:48:54 2009 >> @@ -26,7 +26,6 @@ >> ? FunctionPass *createSPUISelDag(SPUTargetMachine &TM); >> ? FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SPUTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> >> ? /*--== Utility functions/predicates/etc used all over the place: -- >> ==*/ >> >> Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -94,6 +94,6 @@ >> ? // Output assembly language. >> ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? if (AsmPrinterCtor) >> - ? ?PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); >> + ? ?PM.add(AsmPrinterCtor(Out, *this, Verbose)); >> ? return false; >> } >> >> Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h (original) >> +++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h Tue Jun 30 >> 20:48:54 2009 >> @@ -43,7 +43,6 @@ >> ? // set this functions to ctor pointer at startup time if they are >> linked in. >> ? typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SPUTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> ? static AsmPrinterCtorFn AsmPrinterCtor; >> >> >> Modified: llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp >> (original) >> +++ llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp Tue Jun >> 30 20:48:54 2009 >> @@ -38,9 +38,8 @@ >> ? ? std::set ExternalFunctionNames, ExternalObjectNames; >> ? public: >> ? ? explicit IA64AsmPrinter(raw_ostream &O, TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool V) >> - ? ? ?: AsmPrinter(O, TM, T, OL, V) {} >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, bool V) >> + ? ? ?: AsmPrinter(O, TM, T, V) {} >> >> ? ? virtual const char *getPassName() const { >> ? ? ? return "IA64 Assembly Printer"; >> @@ -373,9 +372,8 @@ >> /// >> FunctionPass *llvm::createIA64CodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IA64TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose) { >> - ?return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, >> verbose); >> + ?return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> namespace { >> >> Modified: llvm/trunk/lib/Target/IA64/IA64.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/IA64/IA64.h (original) >> +++ llvm/trunk/lib/Target/IA64/IA64.h Tue Jun 30 20:48:54 2009 >> @@ -39,7 +39,6 @@ >> /// >> FunctionPass *createIA64CodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IA64TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> >> } // End llvm namespace >> >> Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -73,7 +73,7 @@ >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> >> bool IA64TargetMachine::addInstSelector(PassManagerBase &PM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level OptLevel){ >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level OptLevel) { >> ? PM.add(createIA64DAGToDAGInstructionSelector(*this)); >> ? return false; >> } >> @@ -91,7 +91,7 @@ >> ? // Output assembly language. >> ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? if (AsmPrinterCtor) >> - ? ?PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); >> + ? ?PM.add(AsmPrinterCtor(Out, *this, Verbose)); >> ? return false; >> } >> >> >> Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/IA64/IA64TargetMachine.h (original) >> +++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.h Tue Jun 30 >> 20:48:54 2009 >> @@ -38,7 +38,6 @@ >> ? // set this functions to ctor pointer at startup time if they are >> linked in. >> ? typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IA64TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> ? static AsmPrinterCtorFn AsmPrinterCtor; >> >> >> Modified: llvm/trunk/lib/Target/MSP430/MSP430.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/MSP430/MSP430.h (original) >> +++ llvm/trunk/lib/Target/MSP430/MSP430.h Tue Jun 30 20:48:54 2009 >> @@ -26,7 +26,6 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level OptLevel); >> ? FunctionPass *createMSP430CodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MSP430TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> } // end namespace llvm; >> >> >> Modified: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp (original) >> +++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -40,9 +40,8 @@ >> ? class VISIBILITY_HIDDEN MSP430AsmPrinter : public AsmPrinter { >> ? public: >> ? ? MSP430AsmPrinter(raw_ostream &O, MSP430TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *TAI, >> - ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level OL, bool V) >> - ? ? ?: AsmPrinter(O, TM, TAI, OL, V) {} >> + ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *TAI, bool V) >> + ? ? ?: AsmPrinter(O, TM, TAI, V) {} >> >> ? ? virtual const char *getPassName() const { >> ? ? ? return "MSP430 Assembly Printer"; >> @@ -77,9 +76,8 @@ >> /// >> FunctionPass *llvm::createMSP430CodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MSP430TargetMachine >> &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose) { >> - ?return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), >> OptLevel, verbose); >> + ?return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> bool MSP430AsmPrinter::doInitialization(Module &M) { >> >> Modified: llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -62,7 +62,7 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?raw_ostream &Out) { >> ? // Output assembly language. >> - ?PM.add(createMSP430CodePrinterPass(Out, *this, OptLevel, Verbose)); >> + ?PM.add(createMSP430CodePrinterPass(Out, *this, Verbose)); >> ? return false; >> } >> >> >> Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp >> (original) >> +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Tue Jun >> 30 20:48:54 2009 >> @@ -51,9 +51,8 @@ >> ? ? const MipsSubtarget *Subtarget; >> ? public: >> ? ? explicit MipsAsmPrinter(raw_ostream &O, MipsTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool V) >> - ? ? ?: AsmPrinter(O, TM, T, OL, V) { >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, bool V) >> + ? ? ?: AsmPrinter(O, TM, T, V) { >> ? ? ? Subtarget = &TM.getSubtarget(); >> ? ? } >> >> @@ -93,9 +92,8 @@ >> /// regardless of whether the function is in SSA form. >> FunctionPass *llvm::createMipsCodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MipsTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose) { >> - ?return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, >> verbose); >> + ?return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> >> Modified: llvm/trunk/lib/Target/Mips/Mips.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Mips/Mips.h (original) >> +++ llvm/trunk/lib/Target/Mips/Mips.h Tue Jun 30 20:48:54 2009 >> @@ -27,7 +27,6 @@ >> ? FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); >> ? FunctionPass *createMipsCodePrinterPass(raw_ostream &OS, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MipsTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool Verbose); >> } // end namespace llvm; >> >> >> Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -134,6 +134,6 @@ >> ? ? ? ? ? ? ? ? ? ?bool Verbose, raw_ostream &Out) ?{ >> ? // Output assembly language. >> ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> - ?PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); >> + ?PM.add(AsmPrinterCtor(Out, *this, Verbose)); >> ? return false; >> } >> >> Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.h (original) >> +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.h Tue Jun 30 >> 20:48:54 2009 >> @@ -39,7 +39,6 @@ >> ? ? // linked in. >> ? ? typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MipsTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> ? ? static AsmPrinterCtorFn AsmPrinterCtor; >> >> >> Modified: llvm/trunk/lib/Target/PIC16/PIC16.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/PIC16/PIC16.h (original) >> +++ llvm/trunk/lib/Target/PIC16/PIC16.h Tue Jun 30 20:48:54 2009 >> @@ -331,7 +331,6 @@ >> ? FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM); >> ? FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PIC16TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose); >> ? // Banksel optimzer pass. >> ? FunctionPass *createPIC16MemSelOptimizerPass(); >> >> Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) >> +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -113,9 +113,8 @@ >> /// >> FunctionPass *llvm::createPIC16CodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PIC16TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool verbose) { >> - ?return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), >> OptLevel, verbose); >> + ?return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> >> >> Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h (original) >> +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h Tue Jun 30 >> 20:48:54 2009 >> @@ -30,9 +30,8 @@ >> namespace llvm { >> ? struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { >> ? ? explicit PIC16AsmPrinter(raw_ostream &O, PIC16TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) >> - ? ? ?: AsmPrinter(O, TM, T, OL, V), DbgInfo(O, T) { >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) >> + ? ? ?: AsmPrinter(O, TM, T, V), DbgInfo(O, T) { >> ? ? ? PTLI = TM.getTargetLowering(); >> ? ? ? PTAI = static_cast (T); >> ? ? } >> >> Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -65,11 +65,11 @@ >> ? return false; >> } >> >> -bool PIC16TargetMachine:: >> -addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, >> - ? ? ? ? ? ? ? ? ? bool Verbose, raw_ostream &Out) { >> +bool PIC16TargetMachine::addAssemblyEmitter(PassManagerBase &PM, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose, >> raw_ostream &Out) { >> ? // Output assembly language. >> - ?PM.add(createPIC16CodePrinterPass(Out, *this, OptLevel, Verbose)); >> + ?PM.add(createPIC16CodePrinterPass(Out, *this, Verbose)); >> ? return false; >> } >> >> >> Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp >> (original) >> +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue >> Jun 30 20:48:54 2009 >> @@ -56,9 +56,8 @@ >> ? ? const PPCSubtarget &Subtarget; >> ? public: >> ? ? explicit PPCAsmPrinter(raw_ostream &O, TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) >> - ? ? ?: AsmPrinter(O, TM, T, OL, V), >> + ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) >> + ? ? ?: AsmPrinter(O, TM, T, V), >> ? ? ? ? Subtarget(TM.getSubtarget()) {} >> >> ? ? virtual const char *getPassName() const { >> @@ -296,9 +295,8 @@ >> ? class VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter { >> ? public: >> ? ? explicit PPCLinuxAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool V) >> - ? ? ?: PPCAsmPrinter(O, TM, T, OL, V){} >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, bool V) >> + ? ? ?: PPCAsmPrinter(O, TM, T, V){} >> >> ? ? virtual const char *getPassName() const { >> ? ? ? return "Linux PPC Assembly Printer"; >> @@ -323,9 +321,8 @@ >> ? ? raw_ostream &OS; >> ? public: >> ? ? explicit PPCDarwinAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) >> - ? ? ?: PPCAsmPrinter(O, TM, T, OL, V), OS(O) {} >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) >> + ? ? ?: PPCAsmPrinter(O, TM, T, V), OS(O) {} >> >> ? ? virtual const char *getPassName() const { >> ? ? ? return "Darwin PPC Assembly Printer"; >> @@ -1119,16 +1116,13 @@ >> /// >> FunctionPass *llvm::createPPCAsmPrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PPCTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose) { >> ? const PPCSubtarget *Subtarget = &tm.getSubtarget(); >> >> ? if (Subtarget->isDarwin()) { >> - ? ?return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OptLevel, verbose); >> + ? ?return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> verbose); >> ? } else { >> - ? ?return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?OptLevel, verbose); >> + ? ?return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> verbose); >> ? } >> } >> >> >> Modified: llvm/trunk/lib/Target/PowerPC/PPC.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPC.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/PowerPC/PPC.h (original) >> +++ llvm/trunk/lib/Target/PowerPC/PPC.h Tue Jun 30 20:48:54 2009 >> @@ -28,9 +28,8 @@ >> >> FunctionPass *createPPCBranchSelectionPass(); >> FunctionPass *createPPCISelDag(PPCTargetMachine &TM); >> -FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PPCTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level OptLevel, >> bool Verbose); >> +FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, >> PPCTargetMachine &TM, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose); >> FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MachineCodeEmitter &MCE); >> FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM, >> >> Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -152,7 +152,7 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? raw_ostream &Out) { >> ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? if (AsmPrinterCtor) >> - ? ?PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); >> + ? ?PM.add(AsmPrinterCtor(Out, *this, Verbose)); >> >> ? return false; >> } >> @@ -183,7 +183,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -215,7 +215,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -230,7 +230,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -245,7 +245,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> >> Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h (original) >> +++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h Tue Jun 30 >> 20:48:54 2009 >> @@ -46,7 +46,6 @@ >> ? // set this functions to ctor pointer at startup time if they are >> linked in. >> ? typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PPCTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> ? static AsmPrinterCtorFn AsmPrinterCtor; >> >> >> Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp >> (original) >> +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue >> Jun 30 20:48:54 2009 >> @@ -50,9 +50,8 @@ >> ? ? unsigned BBNumber; >> ? public: >> ? ? explicit SparcAsmPrinter(raw_ostream &O, TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) >> - ? ? ?: AsmPrinter(O, TM, T, OL, V), BBNumber(0) {} >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) >> + ? ? ?: AsmPrinter(O, TM, T, V), BBNumber(0) {} >> >> ? ? virtual const char *getPassName() const { >> ? ? ? return "Sparc Assembly Printer"; >> @@ -84,9 +83,8 @@ >> /// >> FunctionPass *llvm::createSparcCodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool verbose) { >> - ?return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> OptLevel, verbose); >> + ?return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> >> >> Modified: llvm/trunk/lib/Target/Sparc/Sparc.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/Sparc.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Sparc/Sparc.h (original) >> +++ llvm/trunk/lib/Target/Sparc/Sparc.h Tue Jun 30 20:48:54 2009 >> @@ -25,7 +25,6 @@ >> >> ? FunctionPass *createSparcISelDag(SparcTargetMachine &TM); >> ? FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, >> TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose); >> ? FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM); >> ? FunctionPass *createSparcFPMoverPass(TargetMachine &TM); >> >> Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -90,6 +90,6 @@ >> ? // Output assembly language. >> ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? if (AsmPrinterCtor) >> - ? ?PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); >> + ? ?PM.add(AsmPrinterCtor(Out, *this, Verbose)); >> ? return false; >> } >> >> Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h (original) >> +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h Tue Jun 30 >> 20:48:54 2009 >> @@ -39,7 +39,6 @@ >> ? // set this functions to ctor pointer at startup time if they are >> linked in. >> ? typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> ? static AsmPrinterCtorFn AsmPrinterCtor; >> >> >> Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) >> +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Tue Jun >> 30 20:48:54 2009 >> @@ -38,9 +38,8 @@ >> ? MCStreamer *Streamer; >> ?public: >> ? explicit X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool V) >> - ? ?: AsmPrinter(O, TM, T, OL, V) { >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, bool V) >> + ? ?: AsmPrinter(O, TM, T, V) { >> ? ? Subtarget = &TM.getSubtarget(); >> ? ? Context = 0; >> ? ? Streamer = 0; >> >> Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original) >> +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Tue Jun >> 30 20:48:54 2009 >> @@ -25,15 +25,12 @@ >> /// >> FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?X86TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool verbose) { >> ? const X86Subtarget *Subtarget = &tm.getSubtarget(); >> >> ? if (Subtarget->isFlavorIntel()) >> - ? ?return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?OptLevel, verbose); >> - ?return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?OptLevel, verbose); >> + ? ?return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> verbose); >> + ?return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> namespace { >> >> Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h >> (original) >> +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h Tue >> Jun 30 20:48:54 2009 >> @@ -26,9 +26,8 @@ >> >> struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter { >> ? explicit X86IntelAsmPrinter(raw_ostream &O, X86TargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool V) >> - ? ?: AsmPrinter(O, TM, T, OL, V) {} >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const TargetAsmInfo *T, bool V) >> + ? ?: AsmPrinter(O, TM, T, V) {} >> >> ? virtual const char *getPassName() const { >> ? ? return "X86 Intel-Style Assembly Printer"; >> >> Modified: llvm/trunk/lib/Target/X86/X86.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/X86.h (original) >> +++ llvm/trunk/lib/Target/X86/X86.h Tue Jun 30 20:48:54 2009 >> @@ -46,9 +46,7 @@ >> /// assembly code for a MachineFunction to the given output stream, >> /// using the given target machine description. >> /// >> -FunctionPass *createX86CodePrinterPass(raw_ostream &o, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? X86TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level OptLevel, >> +FunctionPass *createX86CodePrinterPass(raw_ostream &o, >> X86TargetMachine &tm, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose); >> >> /// createX86CodeEmitterPass - Return a pass that emits the >> collected X86 code >> >> Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -226,7 +226,7 @@ >> >> ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? if (AsmPrinterCtor) >> - ? ?PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose)); >> + ? ?PM.add(AsmPrinterCtor(Out, *this, Verbose)); >> ? return false; >> } >> >> @@ -254,7 +254,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -284,7 +284,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -298,7 +298,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> @@ -312,7 +312,7 @@ >> ? if (DumpAsm) { >> ? ? assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> ? ? if (AsmPrinterCtor) >> - ? ? ?PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true)); >> + ? ? ?PM.add(AsmPrinterCtor(errs(), *this, true)); >> ? } >> >> ? return false; >> >> Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original) >> +++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Tue Jun 30 20:48:54 >> 2009 >> @@ -45,7 +45,6 @@ >> ? // set this functions to ctor pointer at startup time if they are >> linked in. >> ? typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? X86TargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool verbose); >> ? static AsmPrinterCtorFn AsmPrinterCtor; >> >> >> Modified: llvm/trunk/lib/Target/XCore/XCore.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCore.h?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/XCore/XCore.h (original) >> +++ llvm/trunk/lib/Target/XCore/XCore.h Tue Jun 30 20:48:54 2009 >> @@ -26,7 +26,6 @@ >> ? FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM); >> ? FunctionPass *createXCoreCodePrinterPass(raw_ostream &OS, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?XCoreTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool Verbose); >> } // end namespace llvm; >> >> >> Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original) >> +++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -58,9 +58,8 @@ >> ? ? const XCoreSubtarget &Subtarget; >> ? public: >> ? ? explicit XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, >> CodeGenOpt::Level OL, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool V) >> - ? ? ?: AsmPrinter(O, TM, T, OL, V), DW(0), >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? const TargetAsmInfo *T, bool V) >> + ? ? ?: AsmPrinter(O, TM, T, V), DW(0), >> ? ? ? ? Subtarget(*TM.getSubtargetImpl()) {} >> >> ? ? virtual const char *getPassName() const { >> @@ -106,9 +105,8 @@ >> /// >> FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?XCoreTargetMachine &tm, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CodeGenOpt::Level >> OptLevel, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool verbose) { >> - ?return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), >> OptLevel, verbose); >> + ?return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); >> } >> >> // PrintEscapedString - Print each character of the specified >> string, escaping >> >> Modified: llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp?rev=74579&r1=74578&r2=74579&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp Tue Jun 30 >> 20:48:54 2009 >> @@ -69,6 +69,6 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool Verbose, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? raw_ostream &Out) { >> ? // Output assembly language. >> - ?PM.add(createXCoreCodePrinterPass(Out, *this, OptLevel, Verbose)); >> + ?PM.add(createXCoreCodePrinterPass(Out, *this, Verbose)); >> ? return false; >> } >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From clattner at apple.com Tue Jun 30 23:30:12 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 21:30:12 -0700 Subject: [llvm-commits] Adding a portable strerror*() wrapper, llvm::sys::StrError() In-Reply-To: References: Message-ID: <7BBC8FF7-0F70-449A-BECD-BC10F92065F9@apple.com> On Jun 29, 2009, at 10:52 AM, Jeffrey Yasskin wrote: > My oprofile patch calls some functions that report errors through > errno, and since strerror_r changes its behavior depending on > GNU_SOURCE and other #defines, I figured it would be nice to have a > portable wrapper in llvm/System/Errno.h. I included the windows > version, strerror_s, even though I can't test it. > > This won't do quite the right thing on cmake builds--although it will > run successfully--since cmake doesn't define HAVE_STRERROR*. > > I wasn't sure quite what to do with MakeErrStr. I'd be perfectly happy > with that as the interface in Errno.h, but it does different things on > Windows and Unix, and I didn't want a public function to be ambiguous > like that. Seems pretty reasonable for me. If you think it's ok, please commit. Please commit any autoconf regenerations as a separate (second) patch though. -Chris From clattner at apple.com Tue Jun 30 23:36:56 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 21:36:56 -0700 Subject: [llvm-commits] Initial OProfile symbolization support In-Reply-To: References: Message-ID: <65165FB7-0FFC-4315-B015-608AFF27A56B@apple.com> On Jun 29, 2009, at 3:32 PM, Jeffrey Yasskin wrote: > OProfile provides a library to tell it about JIT output, described at > http://oprofile.sourceforge.net/doc/devel/jit-interface.html. This > patch tells OProfile about function ranges, but not line numbers. It > adds a --with-oprofile= flag to configure, but I don't know > how to do the equivalent to cmake. > > Problems: > 1. Because oprofile installs its libraries to /lib/oprofile, > we need an -rpath option to let the loader find them. We could > probably link the oprofile library statically to avoid this (but > how?). > 2. llvm-config doesn't include the required -L and -rpath flags in its > --ldflags output, even though it includes -lopagent. > 3. cmake support is missing, as mentioned above. > > I've tested this by running the attached fib.c under lli. Let me know > if you can think of an automated way to test it. The patch looks fine to me. I don't think you need to worry about adding a testcase, but figuring out #1/#2 above seem important :) -Chirs > > > > The output from opreport follows: > > Before: > > $ opreport -l ~/opensource/llvm/trunk/dbg/Debug/bin/lli > > CPU: Core 2, speed 1998 MHz (estimated) > > Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with > a unit mask > of 0x00 (Unhalted core cycles) count 100000 > > samples % image name symbol name > > 48182 98.9729 anon (tgid:19412 range: > 0x7f12ccaab000-0x7f12cdaab000) anon > (tgid:19412 range:0x7f12ccaab000-0x7f12cdaab000) > > 11 0.0226 libstdc++.so.6.0.9 /usr/lib/libstdc++.so.6.0.9 > > 10 0.0205 lli > llvm::MachineOperand::isReg() const > > ... > > > After: > > $ opreport -l ~/opensource/llvm/oprof/dbg/Debug/bin/lli > CPU: Core 2, speed 1998 MHz (estimated) > > Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with > a unit mask > of 0x00 (Unhalted core cycles) count 100000 > > samples % image name symbol name > > 24565 60.7308 19814.jo fib_left > > 15365 37.9861 19814.jo fib_right > > 22 0.0544 ld-2.7.so do_lookup_x > > 10 0.0247 lli > llvm::MachineOperand::isReg() const > > 8 0.0198 ld-2.7.so _dl_relocate_object > > 8 0.0198 lli > std::vector std::allocator >::size() const > ... > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From eli.friedman at gmail.com Tue Jun 30 23:59:57 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 30 Jun 2009 21:59:57 -0700 Subject: [llvm-commits] [PATCH] Improve error handling, supersede cerr+abort In-Reply-To: References: <4A47D8D4.6060001@gmail.com> Message-ID: On Tue, Jun 30, 2009 at 9:28 PM, Chris Lattner wrote: > I think that this is over-designed. ?The depths of the code generator > should not be producing warnings, ever. Instcombine currently can produce warnings; are you suggesting we should get rid of that? > We don't need this. ?Assertions "can't happen", so assert(0) really is > unreachable. Mmm... yeah; that said, I think there are places where we should turn assertions into errors (particularly in legalization). -Eli From clattner at apple.com Wed Jul 1 00:12:16 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 22:12:16 -0700 Subject: [llvm-commits] [PATCH] Improve error handling, supersede cerr+abort In-Reply-To: References: <4A47D8D4.6060001@gmail.com> Message-ID: <60D5E8C7-05E7-4D68-9D61-E07D83090882@apple.com> On Jun 30, 2009, at 9:59 PM, Eli Friedman wrote: > On Tue, Jun 30, 2009 at 9:28 PM, Chris Lattner > wrote: >> I think that this is over-designed. The depths of the code generator >> should not be producing warnings, ever. > > Instcombine currently can produce warnings; are you suggesting we > should get rid of that? Yes, without loc info, it is pretty useless. Working with end users using llvm-gcc, every time they get that warning, they assume it is a bug in the compiler, not a bug in their code. >> We don't need this. Assertions "can't happen", so assert(0) really >> is >> unreachable. > > Mmm... yeah; that said, I think there are places where we should turn > assertions into errors (particularly in legalization). Yes, I agree. Also the "cannot select" error should also be handled as an error not assert. -Chris From clattner at apple.com Wed Jul 1 00:27:55 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 22:27:55 -0700 Subject: [llvm-commits] [PATCH] Add an LLVMContext member to Module In-Reply-To: <4060B161-5D56-4BD3-BE4E-55129CC6C901@mac.com> References: <4060B161-5D56-4BD3-BE4E-55129CC6C901@mac.com> Message-ID: <4821C903-EBEC-4799-B15E-27C0EA3280E0@apple.com> On Jun 30, 2009, at 3:40 PM, Owen Anderson wrote: > Here's the first of many patches related to pushing LLVMContext > through the existing APIs. This adds an LLVMContext member to each > Module, which involves threading LLVMContext through large parts of > the bitcode reader, the ASM parser, and all of the tools. Looks good to me. Some minor nits: + /// Get the global data context. + /// @returns LLVMContext - a container for LLVM's global information + LLVMContext* getContext() const { return Context; } Should this return a non-const context given a const module? @@ -30,7 +31,8 @@ /// @brief Parse LLVM Assembly from a file Module *ParseAssemblyFile( const std::string &Filename, ///< The name of the file to parse - ParseError &Error ///< If not null, an object to return errors in. + ParseError &Error, ///< If not null, an object to return errors in. + LLVMContext* Context ///< Context in which to allocate globals info. ); Is Context allowed to be null? If not, these APIs (and the module ctor etc) should take the context by-reference, instead of by-pointer. Module *ParseAssemblyString( const char *AsmString, ///< The string containing assembly Module *M, ///< A module to add the assembly too. - ParseError &Error ///< If not null, an object to return errors in. + ParseError &Error, ///< If not null, an object to return errors in. + LLVMContext* Context ); The module should already have a context, no need for it here. +++ include/llvm-c/BitReader.h (working copy) @@ -29,13 +29,14 @@ /* Builds a module from the bitcode in the specified memory buffer, returning a reference to the module via the OutModule parameter. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ -int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, +int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMContextRef ContextRef, LLVMModuleRef *OutModule, char **OutMessage); /* Reads a module from the specified path, returning via the OutMP parameter a module provider which performs lazy deserialization. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, + LLVMContextRef ContextRef, LLVMModuleProviderRef *OutMP, char **OutMessage); We really don't want to change the C APIs. This will break bindings and cause other problems. Please retain these entry-points (calling through here will default to using the "global" context). If someone wants to enhance the C apis to support multiple contexts, they can add new C api entrypoints in the future. Otherwise, looks great, please commit with these changes. Thanks Owen, -Chris From clattner at apple.com Wed Jul 1 00:31:29 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 22:31:29 -0700 Subject: [llvm-commits] [llvm] r74564 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/IA64/ lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/X... In-Reply-To: <200906302238.n5UMcY5I031037@zion.cs.uiuc.edu> References: <200906302238.n5UMcY5I031037@zion.cs.uiuc.edu> Message-ID: <67A5DA74-7D6E-44EA-8541-DC57E9A99955@apple.com> On Jun 30, 2009, at 3:38 PM, Bill Wendling wrote: > Author: void > Date: Tue Jun 30 17:38:32 2009 > New Revision: 74564 > > URL: http://llvm.org/viewvc/llvm-project?rev=74564&view=rev > Log: > Add an "alignment" field to the MachineFunction object. It makes > more sense to > have the alignment be calculated up front, and have the back-ends > obey whatever > alignment is decided upon. Nice, thank you for doing this Bill. Please document very clearly in the APIs that the alignment is the log2 of the alignment, not the alignment in bytes. -Chris From clattner at apple.com Wed Jul 1 00:34:16 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 22:34:16 -0700 Subject: [llvm-commits] [patch] cmake target lib dependencies chain update in order to build examples In-Reply-To: <4A4A0990.9020203@zafena.se> References: <4A4A0990.9020203@zafena.se> Message-ID: <8B685618-B3A3-45A6-8B7A-D64D138010F6@apple.com> On Jun 30, 2009, at 5:48 AM, Xerxes R?nby wrote: > Problem using cmake with -DLLVM_EXAMPLES:BOOL=ON : > [ 99%] Built target HowToUseJIT > Linking CXX executable ../../bin/Kaleidoscope > ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function > `llvm::X86TargetMachine::addInstSelector(llvm::PassManagerBase&, > llvm::CodeGenOpt::Level)': > X86TargetMachine.cpp:(.text+0x720): undefined reference to > `llvm::EnableFastISel' > X86TargetMachine.cpp:(.text+0x733): undefined reference to > `llvm::createDeadMachineInstructionElimPass()' > ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function > `llvm::X86TargetLowering::~X86TargetLowering()': > X86TargetMachine.cpp: > (.text > ._ZN4llvm17X86TargetLoweringD1Ev > [llvm::X86TargetLowering::~X86TargetLowering()]+0x17): undefined > reference to `llvm::TargetLowering::~TargetLowering()' > ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function > `llvm::TargetInstrInfoImpl::~TargetInstrInfoImpl()': > X86TargetMachine.cpp: > (.text > ._ZN4llvm19TargetInstrInfoImplD2Ev > [llvm::TargetInstrInfoImpl::~TargetInstrInfoImpl()]+0x7): undefined > reference to `vtable for llvm::TargetInstrInfoImpl' > ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function > `llvm::LLVMTargetMachine::~LLVMTargetMachine()': > X86TargetMachine.cpp: > (.text > ._ZN4llvm17LLVMTargetMachineD2Ev > [llvm::LLVMTargetMachine::~LLVMTargetMachine()]+0x7): undefined > reference to `vtable for llvm::LLVMTargetMachine' > > The patch updates all targets with codegen and asmprinter to deal > with this issue. This looks good to me, if it's ok with Doug. However, please attach the patch as an attachment so that we can apply it easily. Thanks! -Chris From clattner at apple.com Wed Jul 1 00:42:16 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 22:42:16 -0700 Subject: [llvm-commits] [llvm] r73201 - in /llvm/trunk: include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELF.h lib/CodeGen/ELFCodeEmitter.cpp lib/CodeGen/ELFWriter.cpp lib/CodeGen/ELFWriter.h lib/Target/X86/X86ELFWriterInfo.cpp lib/Target/X86/X86ELFWriterInfo.h lib/Target/X86/X86TargetMachine.cpp In-Reply-To: <200906111916.n5BJG4DN001215@zion.cs.uiuc.edu> References: <200906111916.n5BJG4DN001215@zion.cs.uiuc.edu> Message-ID: On Jun 11, 2009, at 12:16 PM, Bruno Cardoso Lopes wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=73201&view=rev > Log: > Support for ELF Visibility > Emission for globals, using the correct data sections > Function alignment can be computed for each target using > TargetELFWriterInfo > Some small fixes Nice. > +++ llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h Thu Jun 11 > 14:16:03 2009 > @@ -14,6 +14,10 @@ > #ifndef LLVM_TARGET_TARGETELFWRITERINFO_H > #define LLVM_TARGET_TARGETELFWRITERINFO_H > > +#include "llvm/Target/TargetData.h" > +#include "llvm/Target/TargetMachine.h" > +#include "llvm/Function.h" Is it possible to forward declare this stuff instead of including it? If you move the getFunctionAlignment method out of line it will help. > + /// getFunctionAlignment - Returns the alignment for function > 'F', targets > + /// with different alignment constraints should overload this > method > + virtual unsigned getFunctionAlignment(const Function *F) const { > + const TargetData *TD = TM.getTargetData(); > + unsigned FnAlign = F->getAlignment(); > + unsigned TDAlign = TD->getPointerABIAlignment(); > + unsigned Align = std::max(FnAlign, TDAlign); > + assert(!(Align & (Align-1)) && "Alignment is not a power of > two!"); > + return Align; Bill just committed a patch to move Function Alignment information into MachineFunction. Can you change this to just read that information instead of inferring an alignment in the writer-specific code? > +++ llvm/trunk/lib/CodeGen/ELF.h Thu Jun 11 14:16:03 2009 > @@ -21,12 +21,12 @@ > #ifndef CODEGEN_ELF_H > #define CODEGEN_ELF_H > > +#include "llvm/GlobalVariable.h" > #include "llvm/CodeGen/MachineRelocation.h" > #include "llvm/Support/DataTypes.h" > #include Likewise, please try to shrink down #includes where possible. This should not need to include GlobalVariable.h. Thanks Bruno! -Chris From daniel at zuster.org Wed Jul 1 01:02:54 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 06:02:54 -0000 Subject: [llvm-commits] [compiler-rt] r74586 - /compiler-rt/trunk/lib/enable_execute_stack.c Message-ID: <200907010602.n6162scK012785@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 01:02:53 2009 New Revision: 74586 URL: http://llvm.org/viewvc/llvm-project?rev=74586&view=rev Log: Use getpagesize() on non-Darwin platforms. - Presumably we will eventually need configure magic for this stuff. Modified: compiler-rt/trunk/lib/enable_execute_stack.c Modified: compiler-rt/trunk/lib/enable_execute_stack.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/enable_execute_stack.c?rev=74586&r1=74585&r2=74586&view=diff ============================================================================== --- compiler-rt/trunk/lib/enable_execute_stack.c (original) +++ compiler-rt/trunk/lib/enable_execute_stack.c Wed Jul 1 01:02:53 2009 @@ -24,7 +24,8 @@ // On Darwin, pagesize is always 4096 bytes const uintptr_t pageSize = 4096; #else - abort(); + // FIXME: We should have a configure check for this. + const uintptr_t pagesize = getpagesize(); #endif const uintptr_t pageAlignMask = ~(pageSize-1); uintptr_t p = (uintptr_t)addr; From daniel at zuster.org Wed Jul 1 01:04:04 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 06:04:04 -0000 Subject: [llvm-commits] [compiler-rt] r74587 - in /compiler-rt/trunk/lib: i386/ ppc/ x86_64/ Message-ID: <200907010604.n61644to012840@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 01:04:03 2009 New Revision: 74587 URL: http://llvm.org/viewvc/llvm-project?rev=74587&view=rev Log: Fix a Darwinism, .s files meant to be preprocessed should be named .S. Added: compiler-rt/trunk/lib/i386/ashldi3.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/ashldi3.s compiler-rt/trunk/lib/i386/ashrdi3.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/ashrdi3.s compiler-rt/trunk/lib/i386/divdi3.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/divdi3.s compiler-rt/trunk/lib/i386/floatdidf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/floatdidf.s compiler-rt/trunk/lib/i386/floatdisf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/floatdisf.s compiler-rt/trunk/lib/i386/floatdixf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/floatdixf.s compiler-rt/trunk/lib/i386/floatundidf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/floatundidf.s compiler-rt/trunk/lib/i386/floatundisf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/floatundisf.s compiler-rt/trunk/lib/i386/floatundixf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/floatundixf.s compiler-rt/trunk/lib/i386/lshrdi3.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/lshrdi3.s compiler-rt/trunk/lib/i386/moddi3.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/moddi3.s compiler-rt/trunk/lib/i386/muldi3.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/muldi3.s compiler-rt/trunk/lib/i386/udivdi3.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/udivdi3.s compiler-rt/trunk/lib/i386/umoddi3.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/i386/umoddi3.s compiler-rt/trunk/lib/ppc/restFP.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/ppc/restFP.s compiler-rt/trunk/lib/ppc/saveFP.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/ppc/saveFP.s compiler-rt/trunk/lib/x86_64/floatundidf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/x86_64/floatundidf.s compiler-rt/trunk/lib/x86_64/floatundisf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/x86_64/floatundisf.s compiler-rt/trunk/lib/x86_64/floatundixf.S (props changed) - copied unchanged from r74585, compiler-rt/trunk/lib/x86_64/floatundixf.s Removed: compiler-rt/trunk/lib/i386/ashldi3.s compiler-rt/trunk/lib/i386/ashrdi3.s compiler-rt/trunk/lib/i386/divdi3.s compiler-rt/trunk/lib/i386/floatdidf.s compiler-rt/trunk/lib/i386/floatdisf.s compiler-rt/trunk/lib/i386/floatdixf.s compiler-rt/trunk/lib/i386/floatundidf.s compiler-rt/trunk/lib/i386/floatundisf.s compiler-rt/trunk/lib/i386/floatundixf.s compiler-rt/trunk/lib/i386/lshrdi3.s compiler-rt/trunk/lib/i386/moddi3.s compiler-rt/trunk/lib/i386/muldi3.s compiler-rt/trunk/lib/i386/udivdi3.s compiler-rt/trunk/lib/i386/umoddi3.s compiler-rt/trunk/lib/ppc/restFP.s compiler-rt/trunk/lib/ppc/saveFP.s compiler-rt/trunk/lib/x86_64/floatundidf.s compiler-rt/trunk/lib/x86_64/floatundisf.s compiler-rt/trunk/lib/x86_64/floatundixf.s Propchange: compiler-rt/trunk/lib/i386/ashldi3.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/ashldi3.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/ashldi3.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/ashldi3.s (original) +++ compiler-rt/trunk/lib/i386/ashldi3.s (removed) @@ -1,65 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// di_int __ashldi3(di_int input, int count); - -// This routine has some extra memory traffic, loading the 64-bit input via two -// 32-bit loads, then immediately storing it back to the stack via a single 64-bit -// store. This is to avoid a write-small, read-large stall. -// However, if callers of this routine can be safely assumed to store the argument -// via a 64-bt store, this is unnecessary memory traffic, and should be avoided. -// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro. - -#ifdef __i386__ -#ifdef __SSE2__ - -.text -.align 4 -.globl ___ashldi3 -___ashldi3: - movd 12(%esp), %xmm2 // Load count -#ifndef TRUST_CALLERS_USE_64_BIT_STORES - movd 4(%esp), %xmm0 - movd 8(%esp), %xmm1 - punpckldq %xmm1, %xmm0 // Load input -#else - movq 4(%esp), %xmm0 // Load input -#endif - psllq %xmm2, %xmm0 // shift input by count - movd %xmm0, %eax - psrlq $32, %xmm0 - movd %xmm0, %edx - ret - -#else // Use GPRs instead of SSE2 instructions, if they aren't available. - -.text -.align 4 -.globl ___ashldi3 -___ashldi3: - movl 12(%esp), %ecx // Load count - movl 8(%esp), %edx // Load high - movl 4(%esp), %eax // Load low - - testl $0x20, %ecx // If count >= 32 - jnz 2f // goto 2 - testl $0x1f, %ecx // If count == 0 - jz 1f // goto 1 - - pushl %ebx - movl %eax, %ebx // copy low - shll %cl, %eax // left shift low by count - shll %cl, %edx // left shift high by count - neg %cl - shrl %cl, %ebx // right shift low by 32 - count - orl %ebx, %edx // or the result into the high word - popl %ebx -1: ret - -2: movl %eax, %edx // Move low to high - xorl %eax, %eax // clear low - shll %cl, %edx // shift high by count - 32 - ret - -#endif // __SSE2__ -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/ashrdi3.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/ashrdi3.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/ashrdi3.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/ashrdi3.s (original) +++ compiler-rt/trunk/lib/i386/ashrdi3.s (removed) @@ -1,75 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// di_int __ashrdi3(di_int input, int count); - -#ifdef __i386__ -#ifdef __SSE2__ - -.text -.align 4 -.globl ___ashrdi3 -___ashrdi3: - movd 12(%esp), %xmm2 // Load count - movl 8(%esp), %eax -#ifndef TRUST_CALLERS_USE_64_BIT_STORES - movd 4(%esp), %xmm0 - movd 8(%esp), %xmm1 - punpckldq %xmm1, %xmm0 // Load input -#else - movq 4(%esp), %xmm0 // Load input -#endif - - psrlq %xmm2, %xmm0 // unsigned shift input by count - - testl %eax, %eax // check the sign-bit of the input - jns 1f // early out for positive inputs - - // If the input is negative, we need to construct the shifted sign bit - // to or into the result, as xmm does not have a signed right shift. - pcmpeqb %xmm1, %xmm1 // -1ULL - psrlq $58, %xmm1 // 0x3f - pandn %xmm1, %xmm2 // 63 - count - pcmpeqb %xmm1, %xmm1 // -1ULL - psubq %xmm1, %xmm2 // 64 - count - psllq %xmm2, %xmm1 // -1 << (64 - count) = leading sign bits - por %xmm1, %xmm0 - - // Move the result back to the general purpose registers and return -1: movd %xmm0, %eax - psrlq $32, %xmm0 - movd %xmm0, %edx - ret - -#else // Use GPRs instead of SSE2 instructions, if they aren't available. - -.text -.align 4 -.globl ___ashrdi3 -___ashrdi3: - movl 12(%esp), %ecx // Load count - movl 8(%esp), %edx // Load high - movl 4(%esp), %eax // Load low - - testl $0x20, %ecx // If count >= 32 - jnz 2f // goto 2 - testl $0x1f, %ecx // If count == 0 - jz 1f // goto 1 - - pushl %ebx - movl %edx, %ebx // copy high - shrl %cl, %eax // right shift low by count - sarl %cl, %edx // right shift high by count - neg %cl - shll %cl, %ebx // left shift high by 32 - count - orl %ebx, %eax // or the result into the low word - popl %ebx -1: ret - -2: movl %edx, %eax // Move high to low - sarl $31, %edx // clear high - sarl %cl, %eax // shift low by count - 32 - ret - -#endif // __SSE2__ -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/divdi3.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/divdi3.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/divdi3.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/divdi3.s (original) +++ compiler-rt/trunk/lib/i386/divdi3.s (removed) @@ -1,160 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// di_int __divdi3(di_int a, di_int b); - -// result = a / b. -// both inputs and the output are 64-bit signed integers. -// This will do whatever the underlying hardware is set to do on division by zero. -// No other exceptions are generated, as the divide cannot overflow. -// -// This is targeted at 32-bit x86 *only*, as this can be done directly in hardware -// on x86_64. The performance goal is ~40 cycles per divide, which is faster than -// currently possible via simulation of integer divides on the x87 unit. -// -// Stephen Canon, December 2008 - -#ifdef __i386__ - -.text -.align 4 -.globl ___divdi3 -___divdi3: - -/* This is currently implemented by wrapping the unsigned divide up in an absolute - value, then restoring the correct sign at the end of the computation. This could - certainly be improved upon. */ - - pushl %esi - movl 20(%esp), %edx // high word of b - movl 16(%esp), %eax // low word of b - movl %edx, %ecx - sarl $31, %ecx // (b < 0) ? -1 : 0 - xorl %ecx, %eax - xorl %ecx, %edx // EDX:EAX = (b < 0) ? not(b) : b - subl %ecx, %eax - sbbl %ecx, %edx // EDX:EAX = abs(b) - movl %edx, 20(%esp) - movl %eax, 16(%esp) // store abs(b) back to stack - movl %ecx, %esi // set aside sign of b - - movl 12(%esp), %edx // high word of b - movl 8(%esp), %eax // low word of b - movl %edx, %ecx - sarl $31, %ecx // (a < 0) ? -1 : 0 - xorl %ecx, %eax - xorl %ecx, %edx // EDX:EAX = (a < 0) ? not(a) : a - subl %ecx, %eax - sbbl %ecx, %edx // EDX:EAX = abs(a) - movl %edx, 12(%esp) - movl %eax, 8(%esp) // store abs(a) back to stack - xorl %ecx, %esi // sign of result = (sign of a) ^ (sign of b) - - pushl %ebx - movl 24(%esp), %ebx // Find the index i of the leading bit in b. - bsrl %ebx, %ecx // If the high word of b is zero, jump to - jz 9f // the code to handle that special case [9]. - - /* High word of b is known to be non-zero on this branch */ - - movl 20(%esp), %eax // Construct bhi, containing bits [1+i:32+i] of b - - shrl %cl, %eax // Practically, this means that bhi is given by: - shrl %eax // - notl %ecx // bhi = (high word of b) << (31 - i) | - shll %cl, %ebx // (low word of b) >> (1 + i) - orl %eax, %ebx // - movl 16(%esp), %edx // Load the high and low words of a, and jump - movl 12(%esp), %eax // to [1] if the high word is larger than bhi - cmpl %ebx, %edx // to avoid overflowing the upcoming divide. - jae 1f - - /* High word of a is greater than or equal to (b >> (1 + i)) on this branch */ - - divl %ebx // eax <-- qs, edx <-- r such that ahi:alo = bs*qs + r - - pushl %edi - notl %ecx - shrl %eax - shrl %cl, %eax // q = qs >> (1 + i) - movl %eax, %edi - mull 24(%esp) // q*blo - movl 16(%esp), %ebx - movl 20(%esp), %ecx // ECX:EBX = a - subl %eax, %ebx - sbbl %edx, %ecx // ECX:EBX = a - q*blo - movl 28(%esp), %eax - imull %edi, %eax // q*bhi - subl %eax, %ecx // ECX:EBX = a - q*b - sbbl $0, %edi // decrement q if remainder is negative - xorl %edx, %edx - movl %edi, %eax - - addl %esi, %eax // Restore correct sign to result - adcl %esi, %edx - xorl %esi, %eax - xorl %esi, %edx - popl %edi // Restore callee-save registers - popl %ebx - popl %esi - retl // Return - - -1: /* High word of a is greater than or equal to (b >> (1 + i)) on this branch */ - - subl %ebx, %edx // subtract bhi from ahi so that divide will not - divl %ebx // overflow, and find q and r such that - // - // ahi:alo = (1:q)*bhi + r - // - // Note that q is a number in (31-i).(1+i) - // fix point. - - pushl %edi - notl %ecx - shrl %eax - orl $0x80000000, %eax - shrl %cl, %eax // q = (1:qs) >> (1 + i) - movl %eax, %edi - mull 24(%esp) // q*blo - movl 16(%esp), %ebx - movl 20(%esp), %ecx // ECX:EBX = a - subl %eax, %ebx - sbbl %edx, %ecx // ECX:EBX = a - q*blo - movl 28(%esp), %eax - imull %edi, %eax // q*bhi - subl %eax, %ecx // ECX:EBX = a - q*b - sbbl $0, %edi // decrement q if remainder is negative - xorl %edx, %edx - movl %edi, %eax - - addl %esi, %eax // Restore correct sign to result - adcl %esi, %edx - xorl %esi, %eax - xorl %esi, %edx - popl %edi // Restore callee-save registers - popl %ebx - popl %esi - retl // Return - - -9: /* High word of b is zero on this branch */ - - movl 16(%esp), %eax // Find qhi and rhi such that - movl 20(%esp), %ecx // - xorl %edx, %edx // ahi = qhi*b + rhi with 0 ??? rhi < b - divl %ecx // - movl %eax, %ebx // - movl 12(%esp), %eax // Find qlo such that - divl %ecx // - movl %ebx, %edx // rhi:alo = qlo*b + rlo with 0 ??? rlo < b - - addl %esi, %eax // Restore correct sign to result - adcl %esi, %edx - xorl %esi, %eax - xorl %esi, %edx - popl %ebx // Restore callee-save registers - popl %esi - retl // Return - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/floatdidf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/floatdidf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/floatdidf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/floatdidf.s (original) +++ compiler-rt/trunk/lib/i386/floatdidf.s (removed) @@ -1,32 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// double __floatundidf(du_int a); - -#ifdef __i386__ - -.const -.align 4 -twop52: .quad 0x4330000000000000 -twop32: .quad 0x41f0000000000000 - -#define REL_ADDR(_a) (_a)-0b(%eax) - -.text -.align 4 -.globl ___floatdidf -___floatdidf: - cvtsi2sd 8(%esp), %xmm1 - movss 4(%esp), %xmm0 // low 32 bits of a - calll 0f -0: popl %eax - mulsd REL_ADDR(twop32), %xmm1 // a_hi as a double (without rounding) - movsd REL_ADDR(twop52), %xmm2 // 0x1.0p52 - subsd %xmm2, %xmm1 // a_hi - 0x1p52 (no rounding occurs) - orpd %xmm2, %xmm0 // 0x1p52 + a_lo (no rounding occurs) - addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here) - movsd %xmm0, 4(%esp) - fldl 4(%esp) - ret - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/floatdisf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/floatdisf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/floatdisf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/floatdisf.s (original) +++ compiler-rt/trunk/lib/i386/floatdisf.s (removed) @@ -1,30 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// float __floatdisf(di_int a); - -// This routine has some extra memory traffic, loading the 64-bit input via two -// 32-bit loads, then immediately storing it back to the stack via a single 64-bit -// store. This is to avoid a write-small, read-large stall. -// However, if callers of this routine can be safely assumed to store the argument -// via a 64-bt store, this is unnecessary memory traffic, and should be avoided. -// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro. - -#ifdef __i386__ - -.text -.align 4 -.globl ___floatdisf -___floatdisf: -#ifndef TRUST_CALLERS_USE_64_BIT_STORES - movd 4(%esp), %xmm0 - movd 8(%esp), %xmm1 - punpckldq %xmm1, %xmm0 - movq %xmm0, 4(%esp) -#endif - fildll 4(%esp) - fstps 4(%esp) - flds 4(%esp) - ret - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/floatdixf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/floatdixf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/floatdixf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/floatdixf.s (original) +++ compiler-rt/trunk/lib/i386/floatdixf.s (removed) @@ -1,28 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// float __floatdixf(di_int a); - -#ifdef __i386__ - -// This routine has some extra memory traffic, loading the 64-bit input via two -// 32-bit loads, then immediately storing it back to the stack via a single 64-bit -// store. This is to avoid a write-small, read-large stall. -// However, if callers of this routine can be safely assumed to store the argument -// via a 64-bt store, this is unnecessary memory traffic, and should be avoided. -// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro. - -.text -.align 4 -.globl ___floatdixf -___floatdixf: -#ifndef TRUST_CALLERS_USE_64_BIT_STORES - movd 4(%esp), %xmm0 - movd 8(%esp), %xmm1 - punpckldq %xmm1, %xmm0 - movq %xmm0, 4(%esp) -#endif - fildll 4(%esp) - ret - -#endif // __i386__ \ No newline at end of file Propchange: compiler-rt/trunk/lib/i386/floatundidf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/floatundidf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/floatundidf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/floatundidf.s (original) +++ compiler-rt/trunk/lib/i386/floatundidf.s (removed) @@ -1,43 +0,0 @@ -//===-- floatundidf.s - Implement __floatundidf for i386 ------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __floatundidf for the compiler_rt library. -// -//===----------------------------------------------------------------------===// - -// double __floatundidf(du_int a); - -#ifdef __i386__ - -.const -.align 4 -twop52: .quad 0x4330000000000000 -twop84_plus_twop52: - .quad 0x4530000000100000 -twop84: .quad 0x4530000000000000 - -#define REL_ADDR(_a) (_a)-0b(%eax) - -.text -.align 4 -.globl ___floatundidf -___floatundidf: - movss 8(%esp), %xmm1 // high 32 bits of a - movss 4(%esp), %xmm0 // low 32 bits of a - calll 0f -0: popl %eax - orpd REL_ADDR(twop84), %xmm1 // 0x1p84 + a_hi (no rounding occurs) - subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs) - orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs) - addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here) - movsd %xmm0, 4(%esp) - fldl 4(%esp) - ret - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/floatundisf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/floatundisf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/floatundisf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/floatundisf.s (original) +++ compiler-rt/trunk/lib/i386/floatundisf.s (removed) @@ -1,95 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// float __floatundisf(du_int a); - -// Note that there is a hardware instruction, fildll, that does most of what -// this function needs to do. However, because of our ia32 ABI, it will take -// a write-small read-large stall, so the software implementation here is -// actually several cycles faster. - -// This is a branch-free implementation. A branchy implementation might be -// faster for the common case if you know something a priori about the input -// distribution. - -/* branch-free x87 implementation - one cycle slower than without x87. - -#ifdef __i386__ - -.const -.align 3 - - .quad 0x43f0000000000000 -twop64: .quad 0x0000000000000000 - -#define TWOp64 twop64-0b(%ecx,%eax,8) - -.text -.align 4 -.globl ___floatundisf -___floatundisf: - movl 8(%esp), %eax - movd 8(%esp), %xmm1 - movd 4(%esp), %xmm0 - punpckldq %xmm1, %xmm0 - calll 0f -0: popl %ecx - sarl $31, %eax - movq %xmm0, 4(%esp) - fildll 4(%esp) - faddl TWOp64 - fstps 4(%esp) - flds 4(%esp) - ret - -#endif // __i386__ - -*/ - -/* branch-free, x87-free implementation - faster at the expense of code size */ - -#ifdef __i386__ - -.const -.align 3 -twop52: .quad 0x4330000000000000 - .quad 0x0000000000000fff -sticky: .quad 0x0000000000000000 - .long 0x00000012 -twelve: .long 0x00000000 - -#define TWOp52 twop52-0b(%ecx) -#define STICKY sticky-0b(%ecx,%eax,8) - -.text -.align 4 -.globl ___floatundisf -___floatundisf: - movl 8(%esp), %eax - movd 8(%esp), %xmm1 - movd 4(%esp), %xmm0 - punpckldq %xmm1, %xmm0 - - calll 0f -0: popl %ecx - shrl %eax // high 31 bits of input as sint32 - addl $0x7ff80000, %eax - sarl $31, %eax // (big input) ? -1 : 0 - movsd STICKY, %xmm1 // (big input) ? 0xfff : 0 - movl $12, %edx - andl %eax, %edx // (big input) ? 12 : 0 - movd %edx, %xmm3 - andpd %xmm0, %xmm1 // (big input) ? input & 0xfff : 0 - movsd TWOp52, %xmm2 // 0x1.0p52 - psrlq %xmm3, %xmm0 // (big input) ? input >> 12 : input - orpd %xmm2, %xmm1 // 0x1.0p52 + ((big input) ? input & 0xfff : input) - orpd %xmm1, %xmm0 // 0x1.0p52 + ((big input) ? (input >> 12 | input & 0xfff) : input) - subsd %xmm2, %xmm0 // (double)((big input) ? (input >> 12 | input & 0xfff) : input) - cvtsd2ss %xmm0, %xmm0 // (float)((big input) ? (input >> 12 | input & 0xfff) : input) - pslld $23, %xmm3 - paddd %xmm3, %xmm0 // (float)input - movd %xmm0, 4(%esp) - flds 4(%esp) - ret - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/floatundixf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/floatundixf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/floatundixf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/floatundixf.s (original) +++ compiler-rt/trunk/lib/i386/floatundixf.s (removed) @@ -1,34 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// long double __floatundixf(du_int a);16 - -#ifdef __i386__ - -.const -.align 4 -twop52: .quad 0x4330000000000000 -twop84_plus_twop52_neg: - .quad 0xc530000000100000 -twop84: .quad 0x4530000000000000 - -#define REL_ADDR(_a) (_a)-0b(%eax) - -.text -.align 4 -.globl ___floatundixf -___floatundixf: - calll 0f -0: popl %eax - movss 8(%esp), %xmm0 // hi 32 bits of input - movss 4(%esp), %xmm1 // lo 32 bits of input - orpd REL_ADDR(twop84), %xmm0 // 2^84 + hi (as a double) - orpd REL_ADDR(twop52), %xmm1 // 2^52 + lo (as a double) - addsd REL_ADDR(twop84_plus_twop52_neg), %xmm0 // hi - 2^52 (no rounding occurs) - movsd %xmm1, 4(%esp) - fldl 4(%esp) - movsd %xmm0, 4(%esp) - faddl 4(%esp) - ret - -#endif // __i386__ \ No newline at end of file Propchange: compiler-rt/trunk/lib/i386/lshrdi3.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/lshrdi3.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/lshrdi3.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/lshrdi3.s (original) +++ compiler-rt/trunk/lib/i386/lshrdi3.s (removed) @@ -1,65 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// di_int __lshrdi3(di_int input, int count); - -// This routine has some extra memory traffic, loading the 64-bit input via two -// 32-bit loads, then immediately storing it back to the stack via a single 64-bit -// store. This is to avoid a write-small, read-large stall. -// However, if callers of this routine can be safely assumed to store the argument -// via a 64-bt store, this is unnecessary memory traffic, and should be avoided. -// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro. - -#ifdef __i386__ -#ifdef __SSE2__ - -.text -.align 4 -.globl ___lshrdi3 -___lshrdi3: - movd 12(%esp), %xmm2 // Load count -#ifndef TRUST_CALLERS_USE_64_BIT_STORES - movd 4(%esp), %xmm0 - movd 8(%esp), %xmm1 - punpckldq %xmm1, %xmm0 // Load input -#else - movq 4(%esp), %xmm0 // Load input -#endif - psrlq %xmm2, %xmm0 // shift input by count - movd %xmm0, %eax - psrlq $32, %xmm0 - movd %xmm0, %edx - ret - -#else // Use GPRs instead of SSE2 instructions, if they aren't available. - -.text -.align 4 -.globl ___lshrdi3 -___lshrdi3: - movl 12(%esp), %ecx // Load count - movl 8(%esp), %edx // Load high - movl 4(%esp), %eax // Load low - - testl $0x20, %ecx // If count >= 32 - jnz 2f // goto 2 - testl $0x1f, %ecx // If count == 0 - jz 1f // goto 1 - - pushl %ebx - movl %edx, %ebx // copy high - shrl %cl, %eax // right shift low by count - shrl %cl, %edx // right shift high by count - neg %cl - shll %cl, %ebx // left shift high by 32 - count - orl %ebx, %eax // or the result into the low word - popl %ebx -1: ret - -2: movl %edx, %eax // Move high to low - xorl %edx, %edx // clear high - shrl %cl, %eax // shift low by count - 32 - ret - -#endif // __SSE2__ -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/moddi3.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/moddi3.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/moddi3.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/moddi3.s (original) +++ compiler-rt/trunk/lib/i386/moddi3.s (removed) @@ -1,165 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// di_int __moddi3(di_int a, di_int b); - -// result = remainder of a / b. -// both inputs and the output are 64-bit signed integers. -// This will do whatever the underlying hardware is set to do on division by zero. -// No other exceptions are generated, as the divide cannot overflow. -// -// This is targeted at 32-bit x86 *only*, as this can be done directly in hardware -// on x86_64. The performance goal is ~40 cycles per divide, which is faster than -// currently possible via simulation of integer divides on the x87 unit. -// - -// Stephen Canon, December 2008 - -#ifdef __i386__ - -.text -.align 4 -.globl ___moddi3 -___moddi3: - -/* This is currently implemented by wrapping the unsigned modulus up in an absolute - value. This could certainly be improved upon. */ - - pushl %esi - movl 20(%esp), %edx // high word of b - movl 16(%esp), %eax // low word of b - movl %edx, %ecx - sarl $31, %ecx // (b < 0) ? -1 : 0 - xorl %ecx, %eax - xorl %ecx, %edx // EDX:EAX = (b < 0) ? not(b) : b - subl %ecx, %eax - sbbl %ecx, %edx // EDX:EAX = abs(b) - movl %edx, 20(%esp) - movl %eax, 16(%esp) // store abs(b) back to stack - - movl 12(%esp), %edx // high word of b - movl 8(%esp), %eax // low word of b - movl %edx, %ecx - sarl $31, %ecx // (a < 0) ? -1 : 0 - xorl %ecx, %eax - xorl %ecx, %edx // EDX:EAX = (a < 0) ? not(a) : a - subl %ecx, %eax - sbbl %ecx, %edx // EDX:EAX = abs(a) - movl %edx, 12(%esp) - movl %eax, 8(%esp) // store abs(a) back to stack - movl %ecx, %esi // set aside sign of a - - pushl %ebx - movl 24(%esp), %ebx // Find the index i of the leading bit in b. - bsrl %ebx, %ecx // If the high word of b is zero, jump to - jz 9f // the code to handle that special case [9]. - - /* High word of b is known to be non-zero on this branch */ - - movl 20(%esp), %eax // Construct bhi, containing bits [1+i:32+i] of b - - shrl %cl, %eax // Practically, this means that bhi is given by: - shrl %eax // - notl %ecx // bhi = (high word of b) << (31 - i) | - shll %cl, %ebx // (low word of b) >> (1 + i) - orl %eax, %ebx // - movl 16(%esp), %edx // Load the high and low words of a, and jump - movl 12(%esp), %eax // to [2] if the high word is larger than bhi - cmpl %ebx, %edx // to avoid overflowing the upcoming divide. - jae 2f - - /* High word of a is greater than or equal to (b >> (1 + i)) on this branch */ - - divl %ebx // eax <-- qs, edx <-- r such that ahi:alo = bs*qs + r - - pushl %edi - notl %ecx - shrl %eax - shrl %cl, %eax // q = qs >> (1 + i) - movl %eax, %edi - mull 24(%esp) // q*blo - movl 16(%esp), %ebx - movl 20(%esp), %ecx // ECX:EBX = a - subl %eax, %ebx - sbbl %edx, %ecx // ECX:EBX = a - q*blo - movl 28(%esp), %eax - imull %edi, %eax // q*bhi - subl %eax, %ecx // ECX:EBX = a - q*b - - jnc 1f // if positive, this is the result. - addl 24(%esp), %ebx // otherwise - adcl 28(%esp), %ecx // ECX:EBX = a - (q-1)*b = result -1: movl %ebx, %eax - movl %ecx, %edx - - addl %esi, %eax // Restore correct sign to result - adcl %esi, %edx - xorl %esi, %eax - xorl %esi, %edx - popl %edi // Restore callee-save registers - popl %ebx - popl %esi - retl // Return - -2: /* High word of a is greater than or equal to (b >> (1 + i)) on this branch */ - - subl %ebx, %edx // subtract bhi from ahi so that divide will not - divl %ebx // overflow, and find q and r such that - // - // ahi:alo = (1:q)*bhi + r - // - // Note that q is a number in (31-i).(1+i) - // fix point. - - pushl %edi - notl %ecx - shrl %eax - orl $0x80000000, %eax - shrl %cl, %eax // q = (1:qs) >> (1 + i) - movl %eax, %edi - mull 24(%esp) // q*blo - movl 16(%esp), %ebx - movl 20(%esp), %ecx // ECX:EBX = a - subl %eax, %ebx - sbbl %edx, %ecx // ECX:EBX = a - q*blo - movl 28(%esp), %eax - imull %edi, %eax // q*bhi - subl %eax, %ecx // ECX:EBX = a - q*b - - jnc 3f // if positive, this is the result. - addl 24(%esp), %ebx // otherwise - adcl 28(%esp), %ecx // ECX:EBX = a - (q-1)*b = result -3: movl %ebx, %eax - movl %ecx, %edx - - addl %esi, %eax // Restore correct sign to result - adcl %esi, %edx - xorl %esi, %eax - xorl %esi, %edx - popl %edi // Restore callee-save registers - popl %ebx - popl %esi - retl // Return - -9: /* High word of b is zero on this branch */ - - movl 16(%esp), %eax // Find qhi and rhi such that - movl 20(%esp), %ecx // - xorl %edx, %edx // ahi = qhi*b + rhi with 0 ??? rhi < b - divl %ecx // - movl %eax, %ebx // - movl 12(%esp), %eax // Find rlo such that - divl %ecx // - movl %edx, %eax // rhi:alo = qlo*b + rlo with 0 ??? rlo < b - popl %ebx // - xorl %edx, %edx // and return 0:rlo - - addl %esi, %eax // Restore correct sign to result - adcl %esi, %edx - xorl %esi, %eax - xorl %esi, %edx - popl %esi - retl // Return - - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/muldi3.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/muldi3.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/muldi3.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/muldi3.s (original) +++ compiler-rt/trunk/lib/i386/muldi3.s (removed) @@ -1,28 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// di_int __muldi3(di_int a, di_int b); - -#ifdef __i386__ - -.text -.align 4 -.globl ___muldi3 -___muldi3: - pushl %ebx - movl 16(%esp), %eax // b.lo - movl 12(%esp), %ecx // a.hi - imull %eax, %ecx // b.lo * a.hi - - movl 8(%esp), %edx // a.lo - movl 20(%esp), %ebx // b.hi - imull %edx, %ebx // a.lo * b.hi - - mull %edx // EDX:EAX = a.lo * b.lo - addl %ecx, %ebx // EBX = (a.lo*b.hi + a.hi*b.lo) - addl %ebx, %edx - - popl %ebx - retl - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/udivdi3.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/udivdi3.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/udivdi3.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/udivdi3.s (original) +++ compiler-rt/trunk/lib/i386/udivdi3.s (removed) @@ -1,113 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// du_int __udivdi3(du_int a, du_int b); - -// result = a / b. -// both inputs and the output are 64-bit unsigned integers. -// This will do whatever the underlying hardware is set to do on division by zero. -// No other exceptions are generated, as the divide cannot overflow. -// -// This is targeted at 32-bit x86 *only*, as this can be done directly in hardware -// on x86_64. The performance goal is ~40 cycles per divide, which is faster than -// currently possible via simulation of integer divides on the x87 unit. -// -// Stephen Canon, December 2008 - -#ifdef __i386__ - -.text -.align 4 -.globl ___udivdi3 -___udivdi3: - - pushl %ebx - movl 20(%esp), %ebx // Find the index i of the leading bit in b. - bsrl %ebx, %ecx // If the high word of b is zero, jump to - jz 9f // the code to handle that special case [9]. - - /* High word of b is known to be non-zero on this branch */ - - movl 16(%esp), %eax // Construct bhi, containing bits [1+i:32+i] of b - - shrl %cl, %eax // Practically, this means that bhi is given by: - shrl %eax // - notl %ecx // bhi = (high word of b) << (31 - i) | - shll %cl, %ebx // (low word of b) >> (1 + i) - orl %eax, %ebx // - movl 12(%esp), %edx // Load the high and low words of a, and jump - movl 8(%esp), %eax // to [1] if the high word is larger than bhi - cmpl %ebx, %edx // to avoid overflowing the upcoming divide. - jae 1f - - /* High word of a is greater than or equal to (b >> (1 + i)) on this branch */ - - divl %ebx // eax <-- qs, edx <-- r such that ahi:alo = bs*qs + r - - pushl %edi - notl %ecx - shrl %eax - shrl %cl, %eax // q = qs >> (1 + i) - movl %eax, %edi - mull 20(%esp) // q*blo - movl 12(%esp), %ebx - movl 16(%esp), %ecx // ECX:EBX = a - subl %eax, %ebx - sbbl %edx, %ecx // ECX:EBX = a - q*blo - movl 24(%esp), %eax - imull %edi, %eax // q*bhi - subl %eax, %ecx // ECX:EBX = a - q*b - sbbl $0, %edi // decrement q if remainder is negative - xorl %edx, %edx - movl %edi, %eax - popl %edi - popl %ebx - retl - - -1: /* High word of a is greater than or equal to (b >> (1 + i)) on this branch */ - - subl %ebx, %edx // subtract bhi from ahi so that divide will not - divl %ebx // overflow, and find q and r such that - // - // ahi:alo = (1:q)*bhi + r - // - // Note that q is a number in (31-i).(1+i) - // fix point. - - pushl %edi - notl %ecx - shrl %eax - orl $0x80000000, %eax - shrl %cl, %eax // q = (1:qs) >> (1 + i) - movl %eax, %edi - mull 20(%esp) // q*blo - movl 12(%esp), %ebx - movl 16(%esp), %ecx // ECX:EBX = a - subl %eax, %ebx - sbbl %edx, %ecx // ECX:EBX = a - q*blo - movl 24(%esp), %eax - imull %edi, %eax // q*bhi - subl %eax, %ecx // ECX:EBX = a - q*b - sbbl $0, %edi // decrement q if remainder is negative - xorl %edx, %edx - movl %edi, %eax - popl %edi - popl %ebx - retl - - -9: /* High word of b is zero on this branch */ - - movl 12(%esp), %eax // Find qhi and rhi such that - movl 16(%esp), %ecx // - xorl %edx, %edx // ahi = qhi*b + rhi with 0 ??? rhi < b - divl %ecx // - movl %eax, %ebx // - movl 8(%esp), %eax // Find qlo such that - divl %ecx // - movl %ebx, %edx // rhi:alo = qlo*b + rlo with 0 ??? rlo < b - popl %ebx // - retl // and return qhi:qlo - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/i386/umoddi3.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/i386/umoddi3.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/i386/umoddi3.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/i386/umoddi3.s (original) +++ compiler-rt/trunk/lib/i386/umoddi3.s (removed) @@ -1,124 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// du_int __umoddi3(du_int a, du_int b); - -// result = remainder of a / b. -// both inputs and the output are 64-bit unsigned integers. -// This will do whatever the underlying hardware is set to do on division by zero. -// No other exceptions are generated, as the divide cannot overflow. -// -// This is targeted at 32-bit x86 *only*, as this can be done directly in hardware -// on x86_64. The performance goal is ~40 cycles per divide, which is faster than -// currently possible via simulation of integer divides on the x87 unit. -// - -// Stephen Canon, December 2008 - -#ifdef __i386__ - -.text -.align 4 -.globl ___umoddi3 -___umoddi3: - - pushl %ebx - movl 20(%esp), %ebx // Find the index i of the leading bit in b. - bsrl %ebx, %ecx // If the high word of b is zero, jump to - jz 9f // the code to handle that special case [9]. - - /* High word of b is known to be non-zero on this branch */ - - movl 16(%esp), %eax // Construct bhi, containing bits [1+i:32+i] of b - - shrl %cl, %eax // Practically, this means that bhi is given by: - shrl %eax // - notl %ecx // bhi = (high word of b) << (31 - i) | - shll %cl, %ebx // (low word of b) >> (1 + i) - orl %eax, %ebx // - movl 12(%esp), %edx // Load the high and low words of a, and jump - movl 8(%esp), %eax // to [2] if the high word is larger than bhi - cmpl %ebx, %edx // to avoid overflowing the upcoming divide. - jae 2f - - /* High word of a is greater than or equal to (b >> (1 + i)) on this branch */ - - divl %ebx // eax <-- qs, edx <-- r such that ahi:alo = bs*qs + r - - pushl %edi - notl %ecx - shrl %eax - shrl %cl, %eax // q = qs >> (1 + i) - movl %eax, %edi - mull 20(%esp) // q*blo - movl 12(%esp), %ebx - movl 16(%esp), %ecx // ECX:EBX = a - subl %eax, %ebx - sbbl %edx, %ecx // ECX:EBX = a - q*blo - movl 24(%esp), %eax - imull %edi, %eax // q*bhi - subl %eax, %ecx // ECX:EBX = a - q*b - - jnc 1f // if positive, this is the result. - addl 20(%esp), %ebx // otherwise - adcl 24(%esp), %ecx // ECX:EBX = a - (q-1)*b = result -1: movl %ebx, %eax - movl %ecx, %edx - - popl %edi - popl %ebx - retl - - -2: /* High word of a is greater than or equal to (b >> (1 + i)) on this branch */ - - subl %ebx, %edx // subtract bhi from ahi so that divide will not - divl %ebx // overflow, and find q and r such that - // - // ahi:alo = (1:q)*bhi + r - // - // Note that q is a number in (31-i).(1+i) - // fix point. - - pushl %edi - notl %ecx - shrl %eax - orl $0x80000000, %eax - shrl %cl, %eax // q = (1:qs) >> (1 + i) - movl %eax, %edi - mull 20(%esp) // q*blo - movl 12(%esp), %ebx - movl 16(%esp), %ecx // ECX:EBX = a - subl %eax, %ebx - sbbl %edx, %ecx // ECX:EBX = a - q*blo - movl 24(%esp), %eax - imull %edi, %eax // q*bhi - subl %eax, %ecx // ECX:EBX = a - q*b - - jnc 3f // if positive, this is the result. - addl 20(%esp), %ebx // otherwise - adcl 24(%esp), %ecx // ECX:EBX = a - (q-1)*b = result -3: movl %ebx, %eax - movl %ecx, %edx - - popl %edi - popl %ebx - retl - - - -9: /* High word of b is zero on this branch */ - - movl 12(%esp), %eax // Find qhi and rhi such that - movl 16(%esp), %ecx // - xorl %edx, %edx // ahi = qhi*b + rhi with 0 ??? rhi < b - divl %ecx // - movl %eax, %ebx // - movl 8(%esp), %eax // Find rlo such that - divl %ecx // - movl %edx, %eax // rhi:alo = qlo*b + rlo with 0 ??? rlo < b - popl %ebx // - xorl %edx, %edx // and return 0:rlo - retl // - -#endif // __i386__ Propchange: compiler-rt/trunk/lib/ppc/restFP.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/ppc/restFP.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ppc/restFP.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/ppc/restFP.s (original) +++ compiler-rt/trunk/lib/ppc/restFP.s (removed) @@ -1,43 +0,0 @@ -//===-- restFP.s - Implement restFP ---------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// -// Helper function used by compiler to restore ppc floating point registers at -// the end of the function epilog. This function returns to the address -// in the LR slot. So a function epilog must branch (b) not branch and link -// (bl) to this function. -// If the compiler wants to restore f27..f31, it does a "b restFP+52" -// -// This function should never be exported by a shared library. Each linkage -// unit carries its own copy of this function. -// - .globl restFP - .private_extern restFP -restFP: stfd f14,-144(r1) - stfd f15,-136(r1) - stfd f16,-128(r1) - stfd f17,-120(r1) - stfd f18,-112(r1) - stfd f19,-104(r1) - stfd f20,-96(r1) - stfd f21,-88(r1) - stfd f22,-80(r1) - stfd f23,-72(r1) - stfd f24,-64(r1) - stfd f25,-56(r1) - stfd f26,-48(r1) - stfd f27,-40(r1) - stfd f28,-32(r1) - stfd f29,-24(r1) - stfd f30,-16(r1) - stfd f31,-8(r1) - lwz r0,8(r1) - mtlr r0 - blr Propchange: compiler-rt/trunk/lib/ppc/saveFP.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/ppc/saveFP.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ppc/saveFP.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/ppc/saveFP.s (original) +++ compiler-rt/trunk/lib/ppc/saveFP.s (removed) @@ -1,40 +0,0 @@ -//===-- saveFP.s - Implement saveFP ---------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// -// Helper function used by compiler to save ppc floating point registers in -// function prologs. This routines also saves r0 in the LR slot. -// If the compiler wants to save f27..f31, it does a "bl saveFP+52" -// -// This function should never be exported by a shared library. Each linkage -// unit carries its own copy of this function. -// - .globl saveFP - .private_extern saveFP -saveFP: stfd f14,-144(r1) - stfd f15,-136(r1) - stfd f16,-128(r1) - stfd f17,-120(r1) - stfd f18,-112(r1) - stfd f19,-104(r1) - stfd f20,-96(r1) - stfd f21,-88(r1) - stfd f22,-80(r1) - stfd f23,-72(r1) - stfd f24,-64(r1) - stfd f25,-56(r1) - stfd f26,-48(r1) - stfd f27,-40(r1) - stfd f28,-32(r1) - stfd f29,-24(r1) - stfd f30,-16(r1) - stfd f31,-8(r1) - stw r0,8(r1) - blr Propchange: compiler-rt/trunk/lib/x86_64/floatundidf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/x86_64/floatundidf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/x86_64/floatundidf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/x86_64/floatundidf.s (original) +++ compiler-rt/trunk/lib/x86_64/floatundidf.s (removed) @@ -1,40 +0,0 @@ -//===-- floatundidf.s - Implement __floatundidf for x86_64 ----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __floatundidf for the compiler_rt library. -// -//===----------------------------------------------------------------------===// - -// double __floatundidf(du_int a); - -#ifdef __x86_64__ - -.const -.align 4 -twop52: .quad 0x4330000000000000 -twop84_plus_twop52: - .quad 0x4530000000100000 -twop84: .quad 0x4530000000000000 - -#define REL_ADDR(_a) (_a)(%rip) - -.text -.align 4 -.globl ___floatundidf -___floatundidf: - movd %edi, %xmm0 // low 32 bits of a - shrq $32, %rdi // high 32 bits of a - orq REL_ADDR(twop84), %rdi // 0x1p84 + a_hi (no rounding occurs) - orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs) - movd %rdi, %xmm1 - subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs) - addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here) - ret - -#endif // __x86_64__ \ No newline at end of file Propchange: compiler-rt/trunk/lib/x86_64/floatundisf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/x86_64/floatundisf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/x86_64/floatundisf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/x86_64/floatundisf.s (original) +++ compiler-rt/trunk/lib/x86_64/floatundisf.s (removed) @@ -1,30 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// float __floatundisf(du_int a); - -#ifdef __x86_64__ - -.literal4 -two: .single 2.0 - -#define REL_ADDR(_a) (_a)(%rip) - -.text -.align 4 -.globl ___floatundisf -___floatundisf: - movq $1, %rsi - testq %rdi, %rdi - js 1f - cvtsi2ssq %rdi, %xmm0 - ret - -1: andq %rdi, %rsi - shrq %rdi - orq %rsi, %rdi - cvtsi2ssq %rdi, %xmm0 - mulss REL_ADDR(two), %xmm0 - ret - -#endif // __x86_64__ \ No newline at end of file Propchange: compiler-rt/trunk/lib/x86_64/floatundixf.S ------------------------------------------------------------------------------ svn:mergeinfo = Removed: compiler-rt/trunk/lib/x86_64/floatundixf.s URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/x86_64/floatundixf.s?rev=74586&view=auto ============================================================================== --- compiler-rt/trunk/lib/x86_64/floatundixf.s (original) +++ compiler-rt/trunk/lib/x86_64/floatundixf.s (removed) @@ -1,60 +0,0 @@ -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. - -// long double __floatundixf(du_int a); - -#ifdef __x86_64__ - -.const -.align 4 -twop64: .quad 0x43f0000000000000 - -#define REL_ADDR(_a) (_a)(%rip) - -.text -.align 4 -.globl ___floatundixf -___floatundixf: - movq %rdi, -8(%rsp) - fildq -8(%rsp) - test %rdi, %rdi - js 1f - ret -1: faddl REL_ADDR(twop64) - ret - -#endif // __x86_64__ - - -/* Branch-free implementation is ever so slightly slower, but more beautiful. - It is likely superior for inlining, so I kept it around for future reference. - -#ifdef __x86_64__ - -.const -.align 4 -twop52: .quad 0x4330000000000000 -twop84_plus_twop52_neg: - .quad 0xc530000000100000 -twop84: .quad 0x4530000000000000 - -#define REL_ADDR(_a) (_a)(%rip) - -.text -.align 4 -.globl ___floatundixf -___floatundixf: - movl %edi, %esi // low 32 bits of input - shrq $32, %rdi // hi 32 bits of input - orq REL_ADDR(twop84), %rdi // 2^84 + hi (as a double) - orq REL_ADDR(twop52), %rsi // 2^52 + lo (as a double) - movq %rdi, -8(%rsp) - movq %rsi, -16(%rsp) - fldl REL_ADDR(twop84_plus_twop52_neg) - faddl -8(%rsp) // hi - 2^52 (as double extended, no rounding occurs) - faddl -16(%rsp) // hi + lo (as double extended) - ret - -#endif // __x86_64__ - -*/ \ No newline at end of file From daniel at zuster.org Wed Jul 1 01:06:42 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 06:06:42 -0000 Subject: [llvm-commits] [compiler-rt] r74588 - /compiler-rt/trunk/lib/enable_execute_stack.c Message-ID: <200907010606.n6166gU2012933@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 01:06:42 2009 New Revision: 74588 URL: http://llvm.org/viewvc/llvm-project?rev=74588&view=rev Log: Add missing include for getpagesize, and fix a typo. Modified: compiler-rt/trunk/lib/enable_execute_stack.c Modified: compiler-rt/trunk/lib/enable_execute_stack.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/enable_execute_stack.c?rev=74588&r1=74587&r2=74588&view=diff ============================================================================== --- compiler-rt/trunk/lib/enable_execute_stack.c (original) +++ compiler-rt/trunk/lib/enable_execute_stack.c Wed Jul 1 01:06:42 2009 @@ -9,6 +9,9 @@ #include #include +#ifndef __APPLE__ +#include +#endif // @@ -25,7 +28,7 @@ const uintptr_t pageSize = 4096; #else // FIXME: We should have a configure check for this. - const uintptr_t pagesize = getpagesize(); + const uintptr_t pageSize = getpagesize(); #endif const uintptr_t pageAlignMask = ~(pageSize-1); uintptr_t p = (uintptr_t)addr; From sabre at nondot.org Wed Jul 1 01:08:37 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 06:08:37 -0000 Subject: [llvm-commits] [llvm] r74589 - /llvm/trunk/include/llvm/MC/MCStreamer.h Message-ID: <200907010608.n6168bYL013027@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 01:08:37 2009 New Revision: 74589 URL: http://llvm.org/viewvc/llvm-project?rev=74589&view=rev Log: improve comments. Modified: llvm/trunk/include/llvm/MC/MCStreamer.h Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=74589&r1=74588&r2=74589&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Wed Jul 1 01:08:37 2009 @@ -6,6 +6,10 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// This file declares the MCStreamer class. +// +//===----------------------------------------------------------------------===// #ifndef LLVM_MC_MCSTREAMER_H #define LLVM_MC_MCSTREAMER_H @@ -20,7 +24,15 @@ class MCSymbol; class raw_ostream; - /// MCStreamer - Streaming machine code generation interface. + /// MCStreamer - Streaming machine code generation interface. This interface + /// is intended to provide a programatic interface that is very similar to the + /// level that an assembler .s file provides. It has callbacks to emit bytes, + /// "emit directives", etc. The implementation of this interface retains + /// state to know what the current section is etc. + /// + /// There are multiple implementations of this interface: one for writing out + /// a .s file, and implementations that write out .o files of various formats. + /// class MCStreamer { public: enum SymbolAttr { From sabre at nondot.org Wed Jul 1 01:21:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 06:21:53 -0000 Subject: [llvm-commits] [llvm] r74590 - /llvm/trunk/include/llvm/MC/MCSymbol.h Message-ID: <200907010621.n616LrV2013400@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 01:21:53 2009 New Revision: 74590 URL: http://llvm.org/viewvc/llvm-project?rev=74590&view=rev Log: add some comments to MCSymbol header, make the ctor private so that only MCContext can create these. Modified: llvm/trunk/include/llvm/MC/MCSymbol.h Modified: llvm/trunk/include/llvm/MC/MCSymbol.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=74590&r1=74589&r2=74590&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) +++ llvm/trunk/include/llvm/MC/MCSymbol.h Wed Jul 1 01:21:53 2009 @@ -6,6 +6,10 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// This file contains the declaration of the MCSymbol class. +// +//===----------------------------------------------------------------------===// #ifndef LLVM_MC_MCSYMBOL_H #define LLVM_MC_MCSYMBOL_H @@ -14,17 +18,36 @@ namespace llvm { class MCSection; + class MCContext; + /// MCSymbol - Instances of this class represent a symbol name in the MC file, + /// and MCSymbols are created and unique'd by the MCContext class. + /// + /// If the symbol is defined/emitted into the current translation unit, the + /// Section member is set to indicate what section it lives in. Otherwise, if + /// it is a reference to an external entity, it has a null section. + /// class MCSymbol { - MCSection *Section; + /// Name - The name of the symbol. std::string Name; + /// Section - The section the symbol is defined in, or null if not defined + /// in this translation unit. + MCSection *Section; + + /// IsTemporary - True if this is an assembler temporary label, which + /// typically does not survive in the .o file's symbol table. Usually + /// "Lfoo" or ".foo". unsigned IsTemporary : 1; + + /// IsExternal - ? unsigned IsExternal : 1; - public: + private: // MCContext creates and uniques these. + friend class MCContext; MCSymbol(const char *_Name, bool _IsTemporary) - : Section(0), Name(_Name), IsTemporary(_IsTemporary), IsExternal(false) {} - + : Name(_Name), Section(0), IsTemporary(_IsTemporary), IsExternal(false) {} + public: + MCSection *getSection() const { return Section; } void setSection(MCSection *Value) { Section = Value; } From sabre at nondot.org Wed Jul 1 01:23:15 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 06:23:15 -0000 Subject: [llvm-commits] [llvm] r74591 - /llvm/trunk/include/llvm/MC/MCSymbol.h Message-ID: <200907010623.n616NF85013444@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 01:23:14 2009 New Revision: 74591 URL: http://llvm.org/viewvc/llvm-project?rev=74591&view=rev Log: disable some ctors. Modified: llvm/trunk/include/llvm/MC/MCSymbol.h Modified: llvm/trunk/include/llvm/MC/MCSymbol.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=74591&r1=74590&r2=74591&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) +++ llvm/trunk/include/llvm/MC/MCSymbol.h Wed Jul 1 01:23:14 2009 @@ -46,6 +46,9 @@ friend class MCContext; MCSymbol(const char *_Name, bool _IsTemporary) : Name(_Name), Section(0), IsTemporary(_IsTemporary), IsExternal(false) {} + + MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT + void operator=(const MCSymbol&); // DO NOT IMPLEMENT public: MCSection *getSection() const { return Section; } From clattner at apple.com Wed Jul 1 01:27:59 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 23:27:59 -0700 Subject: [llvm-commits] [llvm] r74440 - in /llvm/trunk: include/llvm/MC/MCValue.h lib/MC/MCAsmStreamer.cpp In-Reply-To: <200906291951.n5TJp3Rp029364@zion.cs.uiuc.edu> References: <200906291951.n5TJp3Rp029364@zion.cs.uiuc.edu> Message-ID: On Jun 29, 2009, at 12:51 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Mon Jun 29 14:51:00 2009 > New Revision: 74440 > > URL: http://llvm.org/viewvc/llvm-project?rev=74440&view=rev > Log: > Rename MCValue::getCst to getConstant and add MCValue::isConstant. Ok, > + int64_t getConstant() const { return Cst; } > MCSymbol *getSymA() const { return SymA; } > MCSymbol *getSymB() const { return SymB; } > + > + bool isConstant() const { return !SymA && !SymB; } Please rename isConstant() to isAbsolute() or something like that. Otherwise it sounds like isConstant() -> true is the only way the Cst field would make sense. Do you agree? -Chris From sabre at nondot.org Wed Jul 1 01:31:54 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 06:31:54 -0000 Subject: [llvm-commits] [llvm] r74592 - /llvm/trunk/include/llvm/MC/MCSection.h Message-ID: <200907010631.n616VtX7013703@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 01:31:49 2009 New Revision: 74592 URL: http://llvm.org/viewvc/llvm-project?rev=74592&view=rev Log: add comments, privatize interface Modified: llvm/trunk/include/llvm/MC/MCSection.h Modified: llvm/trunk/include/llvm/MC/MCSection.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=74592&r1=74591&r2=74592&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSection.h (original) +++ llvm/trunk/include/llvm/MC/MCSection.h Wed Jul 1 01:31:49 2009 @@ -6,6 +6,10 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// This file declares the MCSection class. +// +//===----------------------------------------------------------------------===// #ifndef LLVM_MC_MCSECTION_H #define LLVM_MC_MCSECTION_H @@ -14,11 +18,18 @@ namespace llvm { + /// MCSection - Instances of this class represent a uniqued identifier for a + /// section in the current translation unit. The MCContext class uniques and + /// creates these. class MCSection { std::string Name; - - public: + private: + friend class MCContext; MCSection(const char *_Name) : Name(_Name) {} + + MCSection(const MCSection&); // DO NOT IMPLEMENT + void operator=(const MCSection&); // DO NOT IMPLEMENT + public: const std::string &getName() const { return Name; } }; From daniel at zuster.org Wed Jul 1 01:35:04 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 06:35:04 -0000 Subject: [llvm-commits] [llvm] r74593 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp Message-ID: <200907010635.n616Z4MK013830@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 01:35:03 2009 New Revision: 74593 URL: http://llvm.org/viewvc/llvm-project?rev=74593&view=rev Log: Dump MCInsts in the MC .s printer, for now. Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=74593&r1=74592&r2=74593&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Jul 1 01:35:03 2009 @@ -10,6 +10,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCInst.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" @@ -195,10 +196,30 @@ OS << ".org " << Offset << ", " << (unsigned) Value << '\n'; } +static raw_ostream &operator<<(raw_ostream &OS, const MCOperand &Op) { + if (Op.isReg()) + return OS << "reg:" << Op.getReg(); + if (Op.isImm()) + return OS << "imm:" << Op.getImm(); + if (Op.isMBBLabel()) + return OS << "mbblabel:(" + << Op.getMBBLabelFunction() << ", " << Op.getMBBLabelBlock(); + assert(Op.isMCValue() && "Invalid operand!"); + return OS << "val:" << Op.getMCValue(); +} + void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { assert(CurSection && "Cannot emit contents before setting section!"); - // FIXME: Implement. - OS << "# FIXME: Implement instruction printing!\n"; + // FIXME: Implement proper printing. + OS << "MCInst(" + << "opcode=" << Inst.getOpcode() << ", " + << "operands=["; + for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) { + if (i) + OS << ", "; + OS << Inst.getOperand(i); + } + OS << "])\n"; } void MCAsmStreamer::Finish() { From daniel at zuster.org Wed Jul 1 01:35:48 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 06:35:48 -0000 Subject: [llvm-commits] [llvm] r74594 - /llvm/trunk/tools/llvm-mc/AsmParser.cpp Message-ID: <200907010635.n616Zmhi013860@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 01:35:48 2009 New Revision: 74594 URL: http://llvm.org/viewvc/llvm-project?rev=74594&view=rev Log: llvm-mc: Emit parsed instructions to the MCStreamer. Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74594&r1=74593&r2=74594&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Wed Jul 1 01:35:48 2009 @@ -516,8 +516,7 @@ Lexer.Lex(); // Instruction is good, process it. - outs() << "Found instruction: " << IDVal << " with " << Inst.getNumOperands() - << " operands.\n"; + Out.EmitInstruction(Inst); // Skip to end of line for now. return false; From sabre at nondot.org Wed Jul 1 01:36:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 06:36:49 -0000 Subject: [llvm-commits] [llvm] r74595 - /llvm/trunk/tools/llvm-mc/llvm-mc.cpp Message-ID: <200907010636.n616anSU013904@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 01:36:49 2009 New Revision: 74595 URL: http://llvm.org/viewvc/llvm-project?rev=74595&view=rev Log: add some of the new tokens, others are still missing. Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=74595&r1=74594&r2=74595&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Wed Jul 1 01:36:49 2009 @@ -99,16 +99,23 @@ outs() << "int: " << Lexer.getCurIntVal() << '\n'; break; case asmtok::EndOfStatement: outs() << "EndOfStatement\n"; break; - case asmtok::Colon: outs() << "Colon\n"; break; - case asmtok::Plus: outs() << "Plus\n"; break; - case asmtok::Minus: outs() << "Minus\n"; break; - case asmtok::Tilde: outs() << "Tilde\n"; break; - case asmtok::Slash: outs() << "Slash\n"; break; - case asmtok::LParen: outs() << "LParen\n"; break; - case asmtok::RParen: outs() << "RParen\n"; break; - case asmtok::Star: outs() << "Star\n"; break; - case asmtok::Comma: outs() << "Comma\n"; break; - case asmtok::Dollar: outs() << "Dollar\n"; break; + case asmtok::Colon: outs() << "Colon\n"; break; + case asmtok::Plus: outs() << "Plus\n"; break; + case asmtok::Minus: outs() << "Minus\n"; break; + case asmtok::Tilde: outs() << "Tilde\n"; break; + case asmtok::Slash: outs() << "Slash\n"; break; + case asmtok::LParen: outs() << "LParen\n"; break; + case asmtok::RParen: outs() << "RParen\n"; break; + case asmtok::Star: outs() << "Star\n"; break; + case asmtok::Comma: outs() << "Comma\n"; break; + case asmtok::Dollar: outs() << "Dollar\n"; break; + case asmtok::Equal: outs() << "Equal\n"; break; + case asmtok::EqualEqual: outs() << "EqualEqual\n"; break; + case asmtok::Pipe: outs() << "Pipe\n"; break; + case asmtok::PipePipe: outs() << "PipePipe\n"; break; + case asmtok::Caret: outs() << "Caret\n"; break; + case asmtok::Amp: outs() << "Amp\n"; break; + case asmtok::AmpAmp: outs() << "AmpAmp\n"; break; } Tok = Lexer.Lex(); From clattner at apple.com Wed Jul 1 01:37:45 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 23:37:45 -0700 Subject: [llvm-commits] [llvm] r74450 - in /llvm/trunk/tools/llvm-mc: AsmExpr.cpp AsmExpr.h In-Reply-To: <200906292040.n5TKeaI9030880@zion.cs.uiuc.edu> References: <200906292040.n5TKeaI9030880@zion.cs.uiuc.edu> Message-ID: <1D1471AE-EC6F-41E1-ACA0-75C5B9BC61B9@apple.com> On Jun 29, 2009, at 1:40 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Mon Jun 29 15:40:36 2009 > New Revision: 74450 > > URL: http://llvm.org/viewvc/llvm-project?rev=74450&view=rev > Log: > MC: Improve expression parsing and implement evaluation of absolute > expressions > (missed files). Nice, can you add some doxygen comments to the new classes etc though? -Chris > > Added: > llvm/trunk/tools/llvm-mc/AsmExpr.cpp > llvm/trunk/tools/llvm-mc/AsmExpr.h > > Added: llvm/trunk/tools/llvm-mc/AsmExpr.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=74450&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (added) > +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Mon Jun 29 15:40:36 2009 > @@ -0,0 +1,92 @@ > +//===- AsmExpr.cpp - Assembly file expressions > ----------------------------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +#include "AsmExpr.h" > +#include "llvm/MC/MCContext.h" > +#include "llvm/MC/MCValue.h" > +using namespace llvm; > + > +AsmExpr::~AsmExpr() { > +} > + > +bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) > const { > + switch (getKind()) { > + default: > + assert(0 && "Invalid assembly expression kind!"); > + > + case Constant: > + Res = cast(this)->getValue(); > + return true; > + > + case SymbolRef: { > + MCSymbol *Sym = cast(this)->getSymbol(); > + const MCValue *Value = Ctx.GetSymbolValue(Sym); > + > + // FIXME: Return more information about the failure. > + if (!Value || !Value->isConstant()) > + return false; > + > + Res = Value->getConstant(); > + return true; > + } > + > + case Unary: { > + const AsmUnaryExpr *AUE = cast(this); > + int64_t Value; > + > + if (!AUE->getSubExpr()->EvaluateAsAbsolute(Ctx, Value)) > + return false; > + > + switch (AUE->getOpcode()) { > + case AsmUnaryExpr::LNot: Res = !Value; break; > + case AsmUnaryExpr::Minus: Res = -Value; break; > + case AsmUnaryExpr::Not: Res = ~Value; break; > + case AsmUnaryExpr::Plus: Res = +Value; break; > + } > + > + return true; > + } > + > + case Binary: { > + const AsmBinaryExpr *ABE = cast(this); > + int64_t LHS, RHS; > + > + if (!ABE->getLHS()->EvaluateAsAbsolute(Ctx, LHS) || > + !ABE->getRHS()->EvaluateAsAbsolute(Ctx, RHS)) > + return false; > + > + // FIXME: We need target hooks for the evaluation. It may be > limited in > + // width, and gas defines the result of comparisons differently > from Apple > + // as (the result is sign extended). > + switch (ABE->getOpcode()) { > + case AsmBinaryExpr::Add: Res = LHS + RHS; break; > + case AsmBinaryExpr::And: Res = LHS & RHS; break; > + case AsmBinaryExpr::Div: Res = LHS / RHS; break; > + case AsmBinaryExpr::EQ: Res = LHS == RHS; break; > + case AsmBinaryExpr::GT: Res = LHS > RHS; break; > + case AsmBinaryExpr::GTE: Res = LHS >= RHS; break; > + case AsmBinaryExpr::LAnd: Res = LHS && RHS; break; > + case AsmBinaryExpr::LOr: Res = LHS || RHS; break; > + case AsmBinaryExpr::LT: Res = LHS < RHS; break; > + case AsmBinaryExpr::LTE: Res = LHS <= RHS; break; > + case AsmBinaryExpr::Mod: Res = LHS % RHS; break; > + case AsmBinaryExpr::Mul: Res = LHS * RHS; break; > + case AsmBinaryExpr::NE: Res = LHS != RHS; break; > + case AsmBinaryExpr::Or: Res = LHS | RHS; break; > + case AsmBinaryExpr::Shl: Res = LHS << RHS; break; > + case AsmBinaryExpr::Shr: Res = LHS >> RHS; break; > + case AsmBinaryExpr::Sub: Res = LHS - RHS; break; > + case AsmBinaryExpr::Xor: Res = LHS ^ RHS; break; > + } > + > + return true; > + } > + } > +} > + > > Added: llvm/trunk/tools/llvm-mc/AsmExpr.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.h?rev=74450&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/tools/llvm-mc/AsmExpr.h (added) > +++ llvm/trunk/tools/llvm-mc/AsmExpr.h Mon Jun 29 15:40:36 2009 > @@ -0,0 +1,157 @@ > +//===- AsmExpr.h - Assembly file expressions --------------------*- > C++ -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +#ifndef ASMEXPR_H > +#define ASMEXPR_H > + > +#include "llvm/Support/Casting.h" > +#include "llvm/Support/DataTypes.h" > + > +namespace llvm { > +class MCContext; > +class MCSymbol; > + > +class AsmExpr { > +public: > + enum AsmExprKind { > + Binary, /// Binary expressions. > + Constant, /// Constant expressions. > + SymbolRef, /// References to labels and assigned expressions. > + Unary /// Unary expressions. > + }; > + > +private: > + AsmExprKind Kind; > + > +protected: > + AsmExpr(AsmExprKind _Kind) : Kind(_Kind) {} > + > +public: > + virtual ~AsmExpr(); > + > + AsmExprKind getKind() const { return Kind; } > + > + /// EvaluateAsAbsolute - Try to evaluate the expression to an > absolute value. > + /// > + /// @param Res - The absolute value if evaluation succeeds. > + /// @result - True on success. > + bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; > + > + static bool classof(const AsmExpr *) { return true; } > +}; > + > +class AsmConstantExpr : public AsmExpr { > + int64_t Value; > + > +public: > + AsmConstantExpr(int64_t _Value) > + : AsmExpr(AsmExpr::Constant), Value(_Value) {} > + > + int64_t getValue() const { return Value; } > + > + static bool classof(const AsmExpr *E) { > + return E->getKind() == AsmExpr::Constant; > + } > + static bool classof(const AsmConstantExpr *) { return true; } > +}; > + > +class AsmSymbolRefExpr : public AsmExpr { > + MCSymbol *Symbol; > + > +public: > + AsmSymbolRefExpr(MCSymbol *_Symbol) > + : AsmExpr(AsmExpr::SymbolRef), Symbol(_Symbol) {} > + > + MCSymbol *getSymbol() const { return Symbol; } > + > + static bool classof(const AsmExpr *E) { > + return E->getKind() == AsmExpr::SymbolRef; > + } > + static bool classof(const AsmSymbolRefExpr *) { return true; } > +}; > + > +class AsmUnaryExpr : public AsmExpr { > +public: > + enum Opcode { > + LNot, /// Logical negation. > + Minus, /// Unary minus. > + Not, /// Bit-wise negation. > + Plus /// Unary plus. > + }; > + > +private: > + Opcode Op; > + AsmExpr *Expr; > + > +public: > + AsmUnaryExpr(Opcode _Op, AsmExpr *_Expr) > + : AsmExpr(AsmExpr::Unary), Op(_Op), Expr(_Expr) {} > + ~AsmUnaryExpr() { > + delete Expr; > + } > + > + Opcode getOpcode() const { return Op; } > + > + AsmExpr *getSubExpr() const { return Expr; } > + > + static bool classof(const AsmExpr *E) { > + return E->getKind() == AsmExpr::Unary; > + } > + static bool classof(const AsmUnaryExpr *) { return true; } > +}; > + > +class AsmBinaryExpr : public AsmExpr { > +public: > + enum Opcode { > + Add, /// Addition. > + And, /// Bitwise and. > + Div, /// Division. > + EQ, /// Equality comparison. > + GT, /// Greater than comparison. > + GTE, /// Greater than or equal comparison. > + LAnd, /// Logical and. > + LOr, /// Logical or. > + LT, /// Less than comparison. > + LTE, /// Less than or equal comparison. > + Mod, /// Modulus. > + Mul, /// Multiplication. > + NE, /// Inequality comparison. > + Or, /// Bitwise or. > + Shl, /// Bitwise shift left. > + Shr, /// Bitwise shift right. > + Sub, /// Subtraction. > + Xor /// Bitwise exclusive or. > + }; > + > +private: > + Opcode Op; > + AsmExpr *LHS, *RHS; > + > +public: > + AsmBinaryExpr(Opcode _Op, AsmExpr *_LHS, AsmExpr *_RHS) > + : AsmExpr(AsmExpr::Binary), Op(_Op), LHS(_LHS), RHS(_RHS) {} > + ~AsmBinaryExpr() { > + delete LHS; > + delete RHS; > + } > + > + Opcode getOpcode() const { return Op; } > + > + AsmExpr *getLHS() const { return LHS; } > + AsmExpr *getRHS() const { return RHS; } > + > + static bool classof(const AsmExpr *E) { > + return E->getKind() == AsmExpr::Binary; > + } > + static bool classof(const AsmBinaryExpr *) { return true; } > +}; > + > +} // end namespace llvm > + > +#endif > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Jul 1 01:40:10 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Jun 2009 23:40:10 -0700 Subject: [llvm-commits] [llvm] r74478 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp test/MC/AsmParser/directive_align.s tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h In-Reply-To: <200906292347.n5TNl09u005485@zion.cs.uiuc.edu> References: <200906292347.n5TNl09u005485@zion.cs.uiuc.edu> Message-ID: <9B945A5C-173C-4519-B18A-372953F4D90E@apple.com> On Jun 29, 2009, at 4:47 PM, Daniel Dunbar wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=74478&view=rev > Log: > llvm-mc: Parse .{,b,p2}align{,w,l} directives. > +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Jun 29 18:46:59 2009 > @@ -135,7 +135,7 @@ > /// This used to implement the .align assembler directive. > /// > /// @param ByteAlignment - The alignment to reach. This must be > a power of > - /// two. > + /// two on some targets. What is the right answer here for .align? Though slightly incovenient for the asm/printer, I think it makes sense to make the interface to be target-independent. For example, the alignment could always be specified in log2 form. If the TargetAsmInfo says that .align is not in log2 form, the parser/printer would be responsible for changing it. This approach is convenient for the code generator. What do you think? -Chris From daniel at zuster.org Wed Jul 1 01:48:05 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 06:48:05 -0000 Subject: [llvm-commits] [llvm] r74596 - in /llvm/trunk: include/llvm/MC/MCValue.h tools/llvm-mc/AsmExpr.cpp Message-ID: <200907010648.n616m668014264@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 01:48:00 2009 New Revision: 74596 URL: http://llvm.org/viewvc/llvm-project?rev=74596&view=rev Log: Rename MCValue::isConstant to isAbsolute. Modified: llvm/trunk/include/llvm/MC/MCValue.h llvm/trunk/tools/llvm-mc/AsmExpr.cpp Modified: llvm/trunk/include/llvm/MC/MCValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCValue.h?rev=74596&r1=74595&r2=74596&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCValue.h (original) +++ llvm/trunk/include/llvm/MC/MCValue.h Wed Jul 1 01:48:00 2009 @@ -40,7 +40,8 @@ MCSymbol *getSymA() const { return SymA; } MCSymbol *getSymB() const { return SymB; } - bool isConstant() const { return !SymA && !SymB; } + /// isAbsolute - Is this an absolute (as opposed to relocatable) value. + bool isAbsolute() const { return !SymA && !SymB; } /// getAssociatedSection - For relocatable values, return the section the /// value is associated with. Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=74596&r1=74595&r2=74596&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Wed Jul 1 01:48:00 2009 @@ -19,7 +19,7 @@ bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { MCValue Value; - if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isConstant()) + if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isAbsolute()) return false; Res = Value.getConstant(); @@ -75,7 +75,7 @@ switch (AUE->getOpcode()) { case AsmUnaryExpr::LNot: - if (!Value.isConstant()) + if (!Value.isAbsolute()) return false; Res = MCValue::get(!Value.getConstant()); break; @@ -87,7 +87,7 @@ -Value.getConstant()); break; case AsmUnaryExpr::Not: - if (!Value.isConstant()) + if (!Value.isAbsolute()) return false; Res = MCValue::get(~Value.getConstant()); break; @@ -109,7 +109,7 @@ // We only support a few operations on non-constant expressions, handle // those first. - if (!LHSValue.isConstant() || !RHSValue.isConstant()) { + if (!LHSValue.isAbsolute() || !RHSValue.isAbsolute()) { switch (ABE->getOpcode()) { default: return false; From vkutuzov at accesssoftek.com Wed Jul 1 01:52:08 2009 From: vkutuzov at accesssoftek.com (Viktor Kutuzov) Date: Tue, 30 Jun 2009 23:52:08 -0700 Subject: [llvm-commits] [PATCH] Fix for llvm::FindExecutable (fails to find executable if path is provided) Message-ID: <54EF3DC75DF14CA69492E01CACA5A320@andreic6e7fe55> Hello everyone, The llvm::FindExecutable fails to find a named executible if full path is provided. Please find the patch attached. Best regards, Viktor -------------- next part -------------- A non-text attachment was scrubbed... Name: SystemUtils.cpp.diff Type: application/octet-stream Size: 1359 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090630/f7e03c4e/attachment.obj From resistor at mac.com Wed Jul 1 01:53:29 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 06:53:29 -0000 Subject: [llvm-commits] [llvm] r74597 - /llvm/trunk/lib/System/ThreadLocal.cpp Message-ID: <200907010653.n616rT19014416@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 01:53:29 2009 New Revision: 74597 URL: http://llvm.org/viewvc/llvm-project?rev=74597&view=rev Log: Fix the build on OpenBSD. Modified: llvm/trunk/lib/System/ThreadLocal.cpp Modified: llvm/trunk/lib/System/ThreadLocal.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/ThreadLocal.cpp?rev=74597&r1=74596&r2=74597&view=diff ============================================================================== --- llvm/trunk/lib/System/ThreadLocal.cpp (original) +++ llvm/trunk/lib/System/ThreadLocal.cpp Wed Jul 1 01:53:29 2009 @@ -44,7 +44,7 @@ int errorcode = pthread_key_create(key, NULL); assert(errorcode == 0); (void) errorcode; - data = key; + data = static_cast(key); } ThreadLocalImpl::~ThreadLocalImpl() { From daniel at zuster.org Wed Jul 1 01:56:54 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 06:56:54 -0000 Subject: [llvm-commits] [llvm] r74598 - /llvm/trunk/tools/llvm-mc/llvm-mc.cpp Message-ID: <200907010656.n616usJY014505@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 01:56:54 2009 New Revision: 74598 URL: http://llvm.org/viewvc/llvm-project?rev=74598&view=rev Log: llvm-mc: Fill in the rest of tokens for 'as-lex' mode. Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=74598&r1=74597&r2=74598&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Wed Jul 1 01:56:54 2009 @@ -98,24 +98,36 @@ case asmtok::IntVal: outs() << "int: " << Lexer.getCurIntVal() << '\n'; break; - case asmtok::EndOfStatement: outs() << "EndOfStatement\n"; break; + + case asmtok::Amp: outs() << "Amp\n"; break; + case asmtok::AmpAmp: outs() << "AmpAmp\n"; break; + case asmtok::Caret: outs() << "Caret\n"; break; case asmtok::Colon: outs() << "Colon\n"; break; - case asmtok::Plus: outs() << "Plus\n"; break; - case asmtok::Minus: outs() << "Minus\n"; break; - case asmtok::Tilde: outs() << "Tilde\n"; break; - case asmtok::Slash: outs() << "Slash\n"; break; - case asmtok::LParen: outs() << "LParen\n"; break; - case asmtok::RParen: outs() << "RParen\n"; break; - case asmtok::Star: outs() << "Star\n"; break; case asmtok::Comma: outs() << "Comma\n"; break; case asmtok::Dollar: outs() << "Dollar\n"; break; + case asmtok::EndOfStatement: outs() << "EndOfStatement\n"; break; + case asmtok::Eof: outs() << "Eof\n"; break; case asmtok::Equal: outs() << "Equal\n"; break; case asmtok::EqualEqual: outs() << "EqualEqual\n"; break; + case asmtok::Exclaim: outs() << "Exclaim\n"; break; + case asmtok::ExclaimEqual: outs() << "ExclaimEqual\n"; break; + case asmtok::Greater: outs() << "Greater\n"; break; + case asmtok::GreaterEqual: outs() << "GreaterEqual\n"; break; + case asmtok::GreaterGreater: outs() << "GreaterGreater\n"; break; + case asmtok::LParen: outs() << "LParen\n"; break; + case asmtok::Less: outs() << "Less\n"; break; + case asmtok::LessEqual: outs() << "LessEqual\n"; break; + case asmtok::LessGreater: outs() << "LessGreater\n"; break; + case asmtok::LessLess: outs() << "LessLess\n"; break; + case asmtok::Minus: outs() << "Minus\n"; break; + case asmtok::Percent: outs() << "Percent\n"; break; case asmtok::Pipe: outs() << "Pipe\n"; break; case asmtok::PipePipe: outs() << "PipePipe\n"; break; - case asmtok::Caret: outs() << "Caret\n"; break; - case asmtok::Amp: outs() << "Amp\n"; break; - case asmtok::AmpAmp: outs() << "AmpAmp\n"; break; + case asmtok::Plus: outs() << "Plus\n"; break; + case asmtok::RParen: outs() << "RParen\n"; break; + case asmtok::Slash: outs() << "Slash\n"; break; + case asmtok::Star: outs() << "Star\n"; break; + case asmtok::Tilde: outs() << "Tilde\n"; break; } Tok = Lexer.Lex(); From daniel at zuster.org Wed Jul 1 01:57:52 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 23:57:52 -0700 Subject: [llvm-commits] [llvm] r74595 - /llvm/trunk/tools/llvm-mc/llvm-mc.cpp In-Reply-To: <200907010636.n616anSU013904@zion.cs.uiuc.edu> References: <200907010636.n616anSU013904@zion.cs.uiuc.edu> Message-ID: <6a8523d60906302357y6cf546a9jec12798f077c8182@mail.gmail.com> Thanks, I forgot about this. I completed the list. - Daniel On Tue, Jun 30, 2009 at 11:36 PM, Chris Lattner wrote: > Author: lattner > Date: Wed Jul ?1 01:36:49 2009 > New Revision: 74595 > > URL: http://llvm.org/viewvc/llvm-project?rev=74595&view=rev > Log: > add some of the new tokens, others are still missing. > > Modified: > ? ?llvm/trunk/tools/llvm-mc/llvm-mc.cpp > > Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=74595&r1=74594&r2=74595&view=diff > > ============================================================================== > --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) > +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Wed Jul ?1 01:36:49 2009 > @@ -99,16 +99,23 @@ > ? ? ? outs() << "int: " << Lexer.getCurIntVal() << '\n'; > ? ? ? break; > ? ? case asmtok::EndOfStatement: outs() << "EndOfStatement\n"; break; > - ? ?case asmtok::Colon: ?outs() << "Colon\n"; break; > - ? ?case asmtok::Plus: ? outs() << "Plus\n"; break; > - ? ?case asmtok::Minus: ?outs() << "Minus\n"; break; > - ? ?case asmtok::Tilde: ?outs() << "Tilde\n"; break; > - ? ?case asmtok::Slash: ?outs() << "Slash\n"; break; > - ? ?case asmtok::LParen: outs() << "LParen\n"; break; > - ? ?case asmtok::RParen: outs() << "RParen\n"; break; > - ? ?case asmtok::Star: ? outs() << "Star\n"; break; > - ? ?case asmtok::Comma: ?outs() << "Comma\n"; break; > - ? ?case asmtok::Dollar: outs() << "Dollar\n"; break; > + ? ?case asmtok::Colon: ? ? ? ? ?outs() << "Colon\n"; break; > + ? ?case asmtok::Plus: ? ? ? ? ? outs() << "Plus\n"; break; > + ? ?case asmtok::Minus: ? ? ? ? ?outs() << "Minus\n"; break; > + ? ?case asmtok::Tilde: ? ? ? ? ?outs() << "Tilde\n"; break; > + ? ?case asmtok::Slash: ? ? ? ? ?outs() << "Slash\n"; break; > + ? ?case asmtok::LParen: ? ? ? ? outs() << "LParen\n"; break; > + ? ?case asmtok::RParen: ? ? ? ? outs() << "RParen\n"; break; > + ? ?case asmtok::Star: ? ? ? ? ? outs() << "Star\n"; break; > + ? ?case asmtok::Comma: ? ? ? ? ?outs() << "Comma\n"; break; > + ? ?case asmtok::Dollar: ? ? ? ? outs() << "Dollar\n"; break; > + ? ?case asmtok::Equal: ? ? ? ? ?outs() << "Equal\n"; break; > + ? ?case asmtok::EqualEqual: ? ? outs() << "EqualEqual\n"; break; > + ? ?case asmtok::Pipe: ? ? ? ? ? outs() << "Pipe\n"; break; > + ? ?case asmtok::PipePipe: ? ? ? outs() << "PipePipe\n"; break; > + ? ?case asmtok::Caret: ? ? ? ? ?outs() << "Caret\n"; break; > + ? ?case asmtok::Amp: ? ? ? ? ? ?outs() << "Amp\n"; break; > + ? ?case asmtok::AmpAmp: ? ? ? ? outs() << "AmpAmp\n"; break; > ? ? } > > ? ? Tok = Lexer.Lex(); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Wed Jul 1 01:59:10 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 30 Jun 2009 23:59:10 -0700 Subject: [llvm-commits] [llvm] r74440 - in /llvm/trunk: include/llvm/MC/MCValue.h lib/MC/MCAsmStreamer.cpp In-Reply-To: References: <200906291951.n5TJp3Rp029364@zion.cs.uiuc.edu> Message-ID: <6a8523d60906302359n61ff7e82j4faa048723c462ca@mail.gmail.com> On Tue, Jun 30, 2009 at 11:27 PM, Chris Lattner wrote: > On Jun 29, 2009, at 12:51 PM, Daniel Dunbar wrote: >> >> Author: ddunbar >> Date: Mon Jun 29 14:51:00 2009 >> New Revision: 74440 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74440&view=rev >> Log: >> Rename MCValue::getCst to getConstant and add MCValue::isConstant. > > Ok, > >> + ?int64_t getConstant() const { return Cst; } >> ?MCSymbol *getSymA() const { return SymA; } >> ?MCSymbol *getSymB() const { return SymB; } >> + >> + ?bool isConstant() const { return !SymA && !SymB; } > > Please rename isConstant() to isAbsolute() or something like that. > ?Otherwise it sounds like isConstant() -> true is the only way the Cst field > would make sense. ?Do you agree? Yes, fixed. - Daniel From daniel at zuster.org Wed Jul 1 02:03:42 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 07:03:42 -0000 Subject: [llvm-commits] [llvm] r74599 - /llvm/trunk/include/llvm/MC/MCSymbol.h Message-ID: <200907010703.n6173gZt014695@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 02:03:41 2009 New Revision: 74599 URL: http://llvm.org/viewvc/llvm-project?rev=74599&view=rev Log: Tweak MCSymbol doxyments. Modified: llvm/trunk/include/llvm/MC/MCSymbol.h Modified: llvm/trunk/include/llvm/MC/MCSymbol.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=74599&r1=74598&r2=74599&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) +++ llvm/trunk/include/llvm/MC/MCSymbol.h Wed Jul 1 02:03:41 2009 @@ -30,8 +30,8 @@ class MCSymbol { /// Name - The name of the symbol. std::string Name; - /// Section - The section the symbol is defined in, or null if not defined - /// in this translation unit. + /// Section - The section the symbol is defined in, or null if the symbol + /// has not been defined in the associated translation unit. MCSection *Section; /// IsTemporary - True if this is an assembler temporary label, which @@ -39,7 +39,9 @@ /// "Lfoo" or ".foo". unsigned IsTemporary : 1; - /// IsExternal - ? + /// IsExternal - True if this symbol has been implicitly defined as an + /// external, for example by using it in an expression without ever emitting + /// it as a label. The @var Section for an external symbol is always null. unsigned IsExternal : 1; private: // MCContext creates and uniques these. From daniel at zuster.org Wed Jul 1 02:08:04 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 1 Jul 2009 00:08:04 -0700 Subject: [llvm-commits] [llvm] r74450 - in /llvm/trunk/tools/llvm-mc: AsmExpr.cpp AsmExpr.h In-Reply-To: <1D1471AE-EC6F-41E1-ACA0-75C5B9BC61B9@apple.com> References: <200906292040.n5TKeaI9030880@zion.cs.uiuc.edu> <1D1471AE-EC6F-41E1-ACA0-75C5B9BC61B9@apple.com> Message-ID: <6a8523d60907010008p76ffa017lc9ceea8ba1012ea4@mail.gmail.com> On Tue, Jun 30, 2009 at 11:37 PM, Chris Lattner wrote: > On Jun 29, 2009, at 1:40 PM, Daniel Dunbar wrote: >> Author: ddunbar >> Date: Mon Jun 29 15:40:36 2009 >> New Revision: 74450 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74450&view=rev >> Log: >> MC: Improve expression parsing and implement evaluation of absolute >> expressions >> (missed files). > > Nice, can you add some doxygen comments to the new classes etc though? Sure. Is there something in particular you think is missing, I'll add class level comments but I think most of the uncommented methods are obvious from the name and context. We don't have an official style position on this, but in clang at least we frequently don't have doxygen comments for trivial methods. - Daniel > -Chris > >> >> Added: >> ? ?llvm/trunk/tools/llvm-mc/AsmExpr.cpp >> ? ?llvm/trunk/tools/llvm-mc/AsmExpr.h >> >> Added: llvm/trunk/tools/llvm-mc/AsmExpr.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=74450&view=auto >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (added) >> +++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Mon Jun 29 15:40:36 2009 >> @@ -0,0 +1,92 @@ >> +//===- AsmExpr.cpp - Assembly file expressions >> ----------------------------===// >> +// >> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >> +// >> +// This file is distributed under the University of Illinois Open >> Source >> +// License. See LICENSE.TXT for details. >> +// >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> + >> +#include "AsmExpr.h" >> +#include "llvm/MC/MCContext.h" >> +#include "llvm/MC/MCValue.h" >> +using namespace llvm; >> + >> +AsmExpr::~AsmExpr() { >> +} >> + >> +bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) >> const { >> + ?switch (getKind()) { >> + ?default: >> + ? ?assert(0 && "Invalid assembly expression kind!"); >> + >> + ?case Constant: >> + ? ?Res = cast(this)->getValue(); >> + ? ?return true; >> + >> + ?case SymbolRef: { >> + ? ?MCSymbol *Sym = cast(this)->getSymbol(); >> + ? ?const MCValue *Value = Ctx.GetSymbolValue(Sym); >> + >> + ? ?// FIXME: Return more information about the failure. >> + ? ?if (!Value || !Value->isConstant()) >> + ? ? ?return false; >> + >> + ? ?Res = Value->getConstant(); >> + ? ?return true; >> + ?} >> + >> + ?case Unary: { >> + ? ?const AsmUnaryExpr *AUE = cast(this); >> + ? ?int64_t Value; >> + >> + ? ?if (!AUE->getSubExpr()->EvaluateAsAbsolute(Ctx, Value)) >> + ? ? ?return false; >> + >> + ? ?switch (AUE->getOpcode()) { >> + ? ?case AsmUnaryExpr::LNot: ?Res = !Value; break; >> + ? ?case AsmUnaryExpr::Minus: Res = -Value; break; >> + ? ?case AsmUnaryExpr::Not: ? Res = ~Value; break; >> + ? ?case AsmUnaryExpr::Plus: ?Res = +Value; break; >> + ? ?} >> + >> + ? ?return true; >> + ?} >> + >> + ?case Binary: { >> + ? ?const AsmBinaryExpr *ABE = cast(this); >> + ? ?int64_t LHS, RHS; >> + >> + ? ?if (!ABE->getLHS()->EvaluateAsAbsolute(Ctx, LHS) || >> + ? ? ? ?!ABE->getRHS()->EvaluateAsAbsolute(Ctx, RHS)) >> + ? ? ?return false; >> + >> + ? ?// FIXME: We need target hooks for the evaluation. It may be >> limited in >> + ? ?// width, and gas defines the result of comparisons differently >> from Apple >> + ? ?// as (the result is sign extended). >> + ? ?switch (ABE->getOpcode()) { >> + ? ?case AsmBinaryExpr::Add: ?Res = LHS + RHS; break; >> + ? ?case AsmBinaryExpr::And: ?Res = LHS & RHS; break; >> + ? ?case AsmBinaryExpr::Div: ?Res = LHS / RHS; break; >> + ? ?case AsmBinaryExpr::EQ: ? Res = LHS == RHS; break; >> + ? ?case AsmBinaryExpr::GT: ? Res = LHS > RHS; break; >> + ? ?case AsmBinaryExpr::GTE: ?Res = LHS >= RHS; break; >> + ? ?case AsmBinaryExpr::LAnd: Res = LHS && RHS; break; >> + ? ?case AsmBinaryExpr::LOr: ?Res = LHS || RHS; break; >> + ? ?case AsmBinaryExpr::LT: ? Res = LHS < RHS; break; >> + ? ?case AsmBinaryExpr::LTE: ?Res = LHS <= RHS; break; >> + ? ?case AsmBinaryExpr::Mod: ?Res = LHS % RHS; break; >> + ? ?case AsmBinaryExpr::Mul: ?Res = LHS * RHS; break; >> + ? ?case AsmBinaryExpr::NE: ? Res = LHS != RHS; break; >> + ? ?case AsmBinaryExpr::Or: ? Res = LHS | RHS; break; >> + ? ?case AsmBinaryExpr::Shl: ?Res = LHS << RHS; break; >> + ? ?case AsmBinaryExpr::Shr: ?Res = LHS >> RHS; break; >> + ? ?case AsmBinaryExpr::Sub: ?Res = LHS - RHS; break; >> + ? ?case AsmBinaryExpr::Xor: ?Res = LHS ^ RHS; break; >> + ? ?} >> + >> + ? ?return true; >> + ?} >> + ?} >> +} >> + >> >> Added: llvm/trunk/tools/llvm-mc/AsmExpr.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.h?rev=74450&view=auto >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/tools/llvm-mc/AsmExpr.h (added) >> +++ llvm/trunk/tools/llvm-mc/AsmExpr.h Mon Jun 29 15:40:36 2009 >> @@ -0,0 +1,157 @@ >> +//===- AsmExpr.h - Assembly file expressions --------------------*- >> C++ -*-===// >> +// >> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >> +// >> +// This file is distributed under the University of Illinois Open >> Source >> +// License. See LICENSE.TXT for details. >> +// >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> + >> +#ifndef ASMEXPR_H >> +#define ASMEXPR_H >> + >> +#include "llvm/Support/Casting.h" >> +#include "llvm/Support/DataTypes.h" >> + >> +namespace llvm { >> +class MCContext; >> +class MCSymbol; >> + >> +class AsmExpr { >> +public: >> + ?enum AsmExprKind { >> + ? ?Binary, ? ?/// Binary expressions. >> + ? ?Constant, ?/// Constant expressions. >> + ? ?SymbolRef, /// References to labels and assigned expressions. >> + ? ?Unary ? ? ?/// Unary expressions. >> + ?}; >> + >> +private: >> + ?AsmExprKind Kind; >> + >> +protected: >> + ?AsmExpr(AsmExprKind _Kind) : Kind(_Kind) {} >> + >> +public: >> + ?virtual ~AsmExpr(); >> + >> + ?AsmExprKind getKind() const { return Kind; } >> + >> + ?/// EvaluateAsAbsolute - Try to evaluate the expression to an >> absolute value. >> + ?/// >> + ?/// @param Res - The absolute value if evaluation succeeds. >> + ?/// @result - True on success. >> + ?bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; >> + >> + ?static bool classof(const AsmExpr *) { return true; } >> +}; >> + >> +class AsmConstantExpr : public AsmExpr { >> + ?int64_t Value; >> + >> +public: >> + ?AsmConstantExpr(int64_t _Value) >> + ? ?: AsmExpr(AsmExpr::Constant), Value(_Value) {} >> + >> + ?int64_t getValue() const { return Value; } >> + >> + ?static bool classof(const AsmExpr *E) { >> + ? ?return E->getKind() == AsmExpr::Constant; >> + ?} >> + ?static bool classof(const AsmConstantExpr *) { return true; } >> +}; >> + >> +class AsmSymbolRefExpr : public AsmExpr { >> + ?MCSymbol *Symbol; >> + >> +public: >> + ?AsmSymbolRefExpr(MCSymbol *_Symbol) >> + ? ?: AsmExpr(AsmExpr::SymbolRef), Symbol(_Symbol) {} >> + >> + ?MCSymbol *getSymbol() const { return Symbol; } >> + >> + ?static bool classof(const AsmExpr *E) { >> + ? ?return E->getKind() == AsmExpr::SymbolRef; >> + ?} >> + ?static bool classof(const AsmSymbolRefExpr *) { return true; } >> +}; >> + >> +class AsmUnaryExpr : public AsmExpr { >> +public: >> + ?enum Opcode { >> + ? ?LNot, ?/// Logical negation. >> + ? ?Minus, /// Unary minus. >> + ? ?Not, ? /// Bit-wise negation. >> + ? ?Plus ? /// Unary plus. >> + ?}; >> + >> +private: >> + ?Opcode Op; >> + ?AsmExpr *Expr; >> + >> +public: >> + ?AsmUnaryExpr(Opcode _Op, AsmExpr *_Expr) >> + ? ?: AsmExpr(AsmExpr::Unary), Op(_Op), Expr(_Expr) {} >> + ?~AsmUnaryExpr() { >> + ? ?delete Expr; >> + ?} >> + >> + ?Opcode getOpcode() const { return Op; } >> + >> + ?AsmExpr *getSubExpr() const { return Expr; } >> + >> + ?static bool classof(const AsmExpr *E) { >> + ? ?return E->getKind() == AsmExpr::Unary; >> + ?} >> + ?static bool classof(const AsmUnaryExpr *) { return true; } >> +}; >> + >> +class AsmBinaryExpr : public AsmExpr { >> +public: >> + ?enum Opcode { >> + ? ?Add, ?/// Addition. >> + ? ?And, ?/// Bitwise and. >> + ? ?Div, ?/// Division. >> + ? ?EQ, ? /// Equality comparison. >> + ? ?GT, ? /// Greater than comparison. >> + ? ?GTE, ?/// Greater than or equal comparison. >> + ? ?LAnd, /// Logical and. >> + ? ?LOr, ?/// Logical or. >> + ? ?LT, ? /// Less than comparison. >> + ? ?LTE, ?/// Less than or equal comparison. >> + ? ?Mod, ?/// Modulus. >> + ? ?Mul, ?/// Multiplication. >> + ? ?NE, ? /// Inequality comparison. >> + ? ?Or, ? /// Bitwise or. >> + ? ?Shl, ?/// Bitwise shift left. >> + ? ?Shr, ?/// Bitwise shift right. >> + ? ?Sub, ?/// Subtraction. >> + ? ?Xor ? /// Bitwise exclusive or. >> + ?}; >> + >> +private: >> + ?Opcode Op; >> + ?AsmExpr *LHS, *RHS; >> + >> +public: >> + ?AsmBinaryExpr(Opcode _Op, AsmExpr *_LHS, AsmExpr *_RHS) >> + ? ?: AsmExpr(AsmExpr::Binary), Op(_Op), LHS(_LHS), RHS(_RHS) {} >> + ?~AsmBinaryExpr() { >> + ? ?delete LHS; >> + ? ?delete RHS; >> + ?} >> + >> + ?Opcode getOpcode() const { return Op; } >> + >> + ?AsmExpr *getLHS() const { return LHS; } >> + ?AsmExpr *getRHS() const { return RHS; } >> + >> + ?static bool classof(const AsmExpr *E) { >> + ? ?return E->getKind() == AsmExpr::Binary; >> + ?} >> + ?static bool classof(const AsmBinaryExpr *) { return true; } >> +}; >> + >> +} // end namespace llvm >> + >> +#endif >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Wed Jul 1 02:23:17 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 1 Jul 2009 00:23:17 -0700 Subject: [llvm-commits] [llvm] r74478 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp test/MC/AsmParser/directive_align.s tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h In-Reply-To: <9B945A5C-173C-4519-B18A-372953F4D90E@apple.com> References: <200906292347.n5TNl09u005485@zion.cs.uiuc.edu> <9B945A5C-173C-4519-B18A-372953F4D90E@apple.com> Message-ID: <6a8523d60907010023j2476ea62pc13f470a23678eca@mail.gmail.com> On Tue, Jun 30, 2009 at 11:40 PM, Chris Lattner wrote: > On Jun 29, 2009, at 4:47 PM, Daniel Dunbar wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=74478&view=rev >> Log: >> llvm-mc: Parse .{,b,p2}align{,w,l} directives. > >> +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Jun 29 18:46:59 2009 >> @@ -135,7 +135,7 @@ >> ? ? /// This used to implement the .align assembler directive. >> ? ? /// >> ? ? /// @param ByteAlignment - The alignment to reach. This must be >> a power of >> - ? ?/// two. >> + ? ?/// two on some targets. I don't really understand your comments, but I'll try to answer: > What is the right answer here for .align? ?Though slightly incovenient > for the asm/printer, I think it makes sense to make the interface to > be target-independent. Yes, I agree. I believe the defined interface is strong enough to support all Darwin and gas alignment directives; although it is the responsibility of the client to not use the interface to emit something the target cannot support (non-power-of-two alignment on Darwin, for example). My understand was we agreed on this approach... :) In the future I think the interface should have a facility for reporting errors when an "out-of-range" call is made, but for the time being I don't think its worth worrying about. The assembler front-end is responsible for lowering the target alignment directive to this interface appropriately. For example, on Darwin: -- .p2alignl 3, foo -- should lower to the equivalent of -- .p2align 2, 0 .p2alignl 3, foo -- in order to respect the Darwin semantics for filling the alignment bytes prior to reaching the alignment of the foo-expr (4-bytes, in this case). For gas, the same construct lowers to something like: -- .p2align 1, foo & 0xFF .p2alignw 2, (foo >> 8) & 0xFFFF .p2alignl 3, foo -- ([in]validity of this expansion left to the reader). Yes, this is pretty gross, but when possible I would prefer to push complexity towards the front-end. The other obvious alternative is to provide multiple MCStreamer APIs which match the semantics we want to support (including a generic superset, when possible), and expect the front-end to use the right interface when coming from a .s file, and other clients to use the generic version when possible, or their own target knowledge to do the right thing. I expect that we will end up taking both approaches depending on the feature... > For example, the alignment could always be > specified in log2 form. ?If the TargetAsmInfo says that .align is not > in log2 form, the parser/printer would be responsible for changing > it. ?This approach is convenient for the code generator. ?What do you > think? Did I answer this? - Daniel > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From evan.cheng at apple.com Wed Jul 1 03:19:46 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 01 Jul 2009 08:19:46 -0000 Subject: [llvm-commits] [llvm] r74601 - in /llvm/trunk: include/llvm/CodeGen/RegisterScavenging.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegisterScavenging.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/ARM/2009-06-30-RegScavengerAssert5.ll Message-ID: <200907010819.n618Jmgg028682@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 1 03:19:36 2009 New Revision: 74601 URL: http://llvm.org/viewvc/llvm-project?rev=74601&view=rev Log: Remove special handling of implicit_def. Fix a couple more bugs in liveintervalanalysis and coalescer handling of implicit_def. Note, isUndef marker must be placed even on implicit_def def operand or else the scavenger will not ignore it. This is necessary because -O0 path does not use liveintervalanalysis, it treats implicit_def just like any other def. Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert5.ll Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/RegisterScavenging.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h?rev=74601&r1=74600&r2=74601&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h (original) +++ llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h Wed Jul 1 03:19:36 2009 @@ -69,10 +69,6 @@ /// available, unset means the register is currently being used. BitVector RegsAvailable; - /// ImplicitDefed - If bit is set that means the register is defined by an - /// implicit_def instructions. That means it can be clobbered at will. - BitVector ImplicitDefed; - /// CurrDist - Distance from MBB entry to the current instruction MBBI. /// unsigned CurrDist; @@ -117,25 +113,18 @@ bool isUsed(unsigned Reg) const { return !RegsAvailable[Reg]; } bool isUnused(unsigned Reg) const { return RegsAvailable[Reg]; } - bool isImplicitlyDefined(unsigned Reg) const { return ImplicitDefed[Reg]; } - /// getRegsUsed - return all registers currently in use in used. void getRegsUsed(BitVector &used, bool includeReserved); /// setUsed / setUnused - Mark the state of one or a number of registers. /// - void setUsed(unsigned Reg, bool ImpDef = false); - void setUsed(BitVector &Regs, bool ImpDef = false) { + void setUsed(unsigned Reg); + void setUsed(BitVector &Regs) { RegsAvailable &= ~Regs; - if (ImpDef) - ImplicitDefed |= Regs; - else - ImplicitDefed &= ~Regs; } void setUnused(unsigned Reg, const MachineInstr *MI); void setUnused(BitVector &Regs) { RegsAvailable |= Regs; - ImplicitDefed &= ~Regs; } /// FindUnusedReg - Find a unused register of the specified register class Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=74601&r1=74600&r2=74601&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Jul 1 03:19:36 2009 @@ -124,7 +124,9 @@ ImpDefMIs.push_back(MI); continue; } - for (unsigned i = 0; i != MI->getNumOperands(); ++i) { + + bool ChangedToImpDef = false; + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); if (!MO.isReg() || !MO.isUse()) continue; @@ -133,16 +135,35 @@ continue; if (!ImpDefRegs.count(Reg)) continue; + // Use is a copy, just turn it into an implicit_def. + unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; + if (tii_->isMoveInstr(*MI, SrcReg, DstReg, SrcSubReg, DstSubReg) && + Reg == SrcReg) { + bool isKill = MO.isKill(); + MI->setDesc(tii_->get(TargetInstrInfo::IMPLICIT_DEF)); + for (int j = MI->getNumOperands() - 1, ee = 0; j > ee; --j) + MI->RemoveOperand(j); + if (isKill) + ImpDefRegs.erase(Reg); + ChangedToImpDef = true; + break; + } + MO.setIsUndef(); if (MO.isKill() || MI->isRegTiedToDefOperand(i)) ImpDefRegs.erase(Reg); } - for (unsigned i = 0; i != MI->getNumOperands(); ++i) { - MachineOperand& MO = MI->getOperand(i); - if (!MO.isReg() || !MO.isDef()) - continue; - ImpDefRegs.erase(MO.getReg()); + if (ChangedToImpDef) { + // Backtrack to process this new implicit_def. + --I; + } else { + for (unsigned i = 0; i != MI->getNumOperands(); ++i) { + MachineOperand& MO = MI->getOperand(i); + if (!MO.isReg() || !MO.isDef()) + continue; + ImpDefRegs.erase(MO.getReg()); + } } } @@ -155,33 +176,39 @@ continue; if (!ImpDefRegs.count(Reg)) continue; - bool HasLocalUse = false; - for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(Reg), - RE = mri_->reg_end(); RI != RE; ) { - MachineOperand &RMO = RI.getOperand(); - MachineInstr *RMI = &*RI; - ++RI; - if (RMO.isDef()) { - // Don't expect another def of the same register. - assert(RMI == MI && - "Register with multiple defs including an implicit_def?"); - continue; + + // If there are multiple defs of the same register and at least one + // is not an implicit_def, do not insert implicit_def's before the + // uses. + bool Skip = false; + for (MachineRegisterInfo::def_iterator DI = mri_->def_begin(Reg), + DE = mri_->def_end(); DI != DE; ++DI) { + if (DI->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) { + Skip = true; + break; } + } + if (Skip) + continue; + + for (MachineRegisterInfo::use_iterator UI = mri_->use_begin(Reg), + UE = mri_->use_end(); UI != UE; ) { + MachineOperand &RMO = UI.getOperand(); + MachineInstr *RMI = &*UI; + ++UI; MachineBasicBlock *RMBB = RMI->getParent(); - if (RMBB == MBB) { - HasLocalUse = true; + if (RMBB == MBB) continue; - } const TargetRegisterClass* RC = mri_->getRegClass(Reg); unsigned NewVReg = mri_->createVirtualRegister(RC); - BuildMI(*RMBB, RMI, RMI->getDebugLoc(), - tii_->get(TargetInstrInfo::IMPLICIT_DEF), NewVReg); + MachineInstrBuilder MIB = + BuildMI(*RMBB, RMI, RMI->getDebugLoc(), + tii_->get(TargetInstrInfo::IMPLICIT_DEF), NewVReg); + (*MIB).getOperand(0).setIsUndef(); RMO.setReg(NewVReg); RMO.setIsUndef(); RMO.setIsKill(); } - if (!HasLocalUse) - MI->eraseFromParent(); } ImpDefRegs.clear(); ImpDefMIs.clear(); Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=74601&r1=74600&r2=74601&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Wed Jul 1 03:19:36 2009 @@ -57,28 +57,22 @@ } /// setUsed - Set the register and its sub-registers as being used. -void RegScavenger::setUsed(unsigned Reg, bool ImpDef) { +void RegScavenger::setUsed(unsigned Reg) { RegsAvailable.reset(Reg); - ImplicitDefed[Reg] = ImpDef; for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); - unsigned SubReg = *SubRegs; ++SubRegs) { + unsigned SubReg = *SubRegs; ++SubRegs) RegsAvailable.reset(SubReg); - ImplicitDefed[SubReg] = ImpDef; - } } /// setUnused - Set the register and its sub-registers as being unused. void RegScavenger::setUnused(unsigned Reg, const MachineInstr *MI) { RegsAvailable.set(Reg); - ImplicitDefed.reset(Reg); for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) - if (!RedefinesSuperRegPart(MI, Reg, TRI)) { + if (!RedefinesSuperRegPart(MI, Reg, TRI)) RegsAvailable.set(SubReg); - ImplicitDefed.reset(SubReg); - } } void RegScavenger::enterBasicBlock(MachineBasicBlock *mbb) { @@ -94,7 +88,6 @@ if (!MBB) { NumPhysRegs = TRI->getNumRegs(); RegsAvailable.resize(NumPhysRegs); - ImplicitDefed.resize(NumPhysRegs); // Create reserved registers bitvector. ReservedRegs = TRI->getReservedRegs(MF); @@ -113,7 +106,6 @@ ScavengeRestore = NULL; CurrDist = 0; DistanceMap.clear(); - ImplicitDefed.reset(); // All registers started out unused. RegsAvailable.set(); @@ -195,7 +187,10 @@ ScavengeRestore = NULL; } - bool IsImpDef = MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF; +#if 0 + if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) + return; +#endif // Separate register operands into 3 classes: uses, defs, earlyclobbers. SmallVector, 4> UseMOs; @@ -221,14 +216,7 @@ assert(isUsed(Reg) && "Using an undefined register!"); - // Kill of implicit_def defined registers are ignored. e.g. - // entry: 0x2029ab8, LLVM BB @0x1b06080, ID#0: - // Live Ins: %R0 - // %R0 = IMPLICIT_DEF - // %R0 = IMPLICIT_DEF - // STR %R0, %R0, %reg0, 0, 14, %reg0, Mem:ST(4,4) [0x1b06510 + 0] - // %R1 = LDR %R0, %reg0, 24, 14, %reg0, Mem:LD(4,4) [0x1b065bc + 0] - if (MO.isKill() && !isReserved(Reg) && !isImplicitlyDefined(Reg)) { + if (MO.isKill() && !isReserved(Reg)) { KillRegs.set(Reg); // Mark sub-registers as used. @@ -278,10 +266,9 @@ // Implicit def is allowed to "re-define" any register. Similarly, // implicitly defined registers can be clobbered. assert((isReserved(Reg) || isUnused(Reg) || - IsImpDef || isImplicitlyDefined(Reg) || isLiveInButUnusedBefore(Reg, MI, MBB, TRI, MRI)) && "Re-defining a live register!"); - setUsed(Reg, IsImpDef); + setUsed(Reg); } } Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=74601&r1=74600&r2=74601&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Jul 1 03:19:36 2009 @@ -2669,19 +2669,28 @@ CopyMI->setDesc(tii_->get(TargetInstrInfo::IMPLICIT_DEF)); for (int i = CopyMI->getNumOperands() - 1, e = 0; i > e; --i) CopyMI->RemoveOperand(i); + CopyMI->getOperand(0).setIsUndef(); bool NoUse = mri_->use_empty(SrcReg); if (NoUse) { - for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(SrcReg), - E = mri_->reg_end(); I != E; ) { - assert(I.getOperand().isDef()); - MachineInstr *DefMI = &*I; - ++I; + for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(SrcReg), + RE = mri_->reg_end(); RI != RE; ) { + assert(RI.getOperand().isDef()); + MachineInstr *DefMI = &*RI; + ++RI; // The implicit_def source has no other uses, delete it. assert(DefMI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF); li_->RemoveMachineInstrFromMaps(DefMI); DefMI->eraseFromParent(); } } + + // Mark uses of implicit_def isUndef. + for (MachineRegisterInfo::use_iterator RI = mri_->use_begin(DstReg), + RE = mri_->use_end(); RI != RE; ++RI) { + assert((*RI).getParent() == MBB); + RI.getOperand().setIsUndef(); + } + ++I; return true; } Added: llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert5.ll?rev=74601&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert5.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-06-30-RegScavengerAssert5.ll Wed Jul 1 03:19:36 2009 @@ -0,0 +1,99 @@ +; RUN: llvm-as < %s | llc -march=arm -mtriple=armv6-apple-darwin9 + + at XX = external global i32* ; [#uses=1] + +define arm_apcscc void @SIM(i8* %A, i8* %B, i32 %M, i32 %N, i32 %K, [256 x i32]* %V, i32 %Q, i32 %R, i32 %nseq) nounwind { +entry: + br i1 undef, label %bb5, label %bb + +bb: ; preds = %bb, %entry + br label %bb + +bb5: ; preds = %entry + br i1 undef, label %bb6, label %bb8 + +bb6: ; preds = %bb6, %bb5 + br i1 undef, label %bb8, label %bb6 + +bb8: ; preds = %bb6, %bb5 + br label %bb15 + +bb9: ; preds = %bb15 + br i1 undef, label %bb10, label %bb11 + +bb10: ; preds = %bb9 + unreachable + +bb11: ; preds = %bb9 + br i1 undef, label %bb15, label %bb12 + +bb12: ; preds = %bb11 + %0 = load i32** @XX, align 4 ; [#uses=0] + br label %bb228.i + +bb74.i: ; preds = %bb228.i + br i1 undef, label %bb138.i, label %bb145.i + +bb138.i: ; preds = %bb74.i + br label %bb145.i + +bb145.i: ; preds = %bb228.i, %bb138.i, %bb74.i + br i1 undef, label %bb146.i, label %bb151.i + +bb146.i: ; preds = %bb145.i + br i1 undef, label %bb228.i, label %bb151.i + +bb151.i: ; preds = %bb146.i, %bb145.i + br i1 undef, label %bb153.i, label %bb228.i + +bb153.i: ; preds = %bb151.i + br i1 undef, label %bb220.i, label %bb.nph.i98 + +bb.nph.i98: ; preds = %bb153.i + br label %bb158.i + +bb158.i: ; preds = %bb218.i, %bb.nph.i98 + %1 = sub i32 undef, undef ; [#uses=4] + %2 = sub i32 undef, undef ; [#uses=1] + br i1 undef, label %bb168.i, label %bb160.i + +bb160.i: ; preds = %bb158.i + br i1 undef, label %bb161.i, label %bb168.i + +bb161.i: ; preds = %bb160.i + br i1 undef, label %bb168.i, label %bb163.i + +bb163.i: ; preds = %bb161.i + br i1 undef, label %bb167.i, label %bb168.i + +bb167.i: ; preds = %bb163.i + br label %bb168.i + +bb168.i: ; preds = %bb167.i, %bb163.i, %bb161.i, %bb160.i, %bb158.i + %f.5.i = phi i32 [ %1, %bb167.i ], [ %2, %bb158.i ], [ %1, %bb160.i ], [ %1, %bb161.i ], [ %1, %bb163.i ] ; [#uses=1] + %c.14.i = select i1 undef, i32 %f.5.i, i32 undef ; [#uses=1] + store i32 %c.14.i, i32* undef, align 4 + store i32 undef, i32* null, align 4 + br i1 undef, label %bb211.i, label %bb218.i + +bb211.i: ; preds = %bb168.i + br label %bb218.i + +bb218.i: ; preds = %bb211.i, %bb168.i + br i1 undef, label %bb220.i, label %bb158.i + +bb220.i: ; preds = %bb218.i, %bb153.i + br i1 undef, label %bb221.i, label %bb228.i + +bb221.i: ; preds = %bb220.i + br label %bb228.i + +bb228.i: ; preds = %bb221.i, %bb220.i, %bb151.i, %bb146.i, %bb12 + br i1 undef, label %bb74.i, label %bb145.i + +bb15: ; preds = %bb11, %bb8 + br i1 undef, label %return, label %bb9 + +return: ; preds = %bb15 + ret void +} From evan.cheng at apple.com Wed Jul 1 03:29:26 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 01 Jul 2009 08:29:26 -0000 Subject: [llvm-commits] [llvm] r74602 - in /llvm/trunk: lib/CodeGen/TargetInstrInfoImpl.cpp test/CodeGen/ARM/2009-07-01-CommuteBug.ll Message-ID: <200907010829.n618TSgh029054@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 1 03:29:08 2009 New Revision: 74602 URL: http://llvm.org/viewvc/llvm-project?rev=74602&view=rev Log: CommuteChangesDestination() should check if to-be-commuted instruction defines any register. Also teaches the default commuteInstruction() to commute instruction without definitions (e.g. X86::test / ARM::tsp). Added: llvm/trunk/test/CodeGen/ARM/2009-07-01-CommuteBug.ll Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=74602&r1=74601&r2=74602&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Wed Jul 1 03:29:08 2009 @@ -24,14 +24,19 @@ // operand 1 and 2. MachineInstr *TargetInstrInfoImpl::commuteInstruction(MachineInstr *MI, bool NewMI) const { - assert(MI->getOperand(1).isReg() && MI->getOperand(2).isReg() && + const TargetInstrDesc &TID = MI->getDesc(); + bool HasDef = TID.getNumDefs(); + unsigned Idx1 = HasDef ? 1 : 0; + unsigned Idx2 = HasDef ? 2 : 1; + + assert(MI->getOperand(Idx1).isReg() && MI->getOperand(Idx2).isReg() && "This only knows how to commute register operands so far"); - unsigned Reg1 = MI->getOperand(1).getReg(); - unsigned Reg2 = MI->getOperand(2).getReg(); - bool Reg1IsKill = MI->getOperand(1).isKill(); - bool Reg2IsKill = MI->getOperand(2).isKill(); + unsigned Reg1 = MI->getOperand(Idx1).getReg(); + unsigned Reg2 = MI->getOperand(Idx2).getReg(); + bool Reg1IsKill = MI->getOperand(Idx1).isKill(); + bool Reg2IsKill = MI->getOperand(Idx2).isKill(); bool ChangeReg0 = false; - if (MI->getOperand(0).getReg() == Reg1) { + if (HasDef && MI->getOperand(0).getReg() == Reg1) { // Must be two address instruction! assert(MI->getDesc().getOperandConstraint(0, TOI::TIED_TO) && "Expecting a two-address instruction!"); @@ -41,21 +46,27 @@ if (NewMI) { // Create a new instruction. - unsigned Reg0 = ChangeReg0 ? Reg2 : MI->getOperand(0).getReg(); - bool Reg0IsDead = MI->getOperand(0).isDead(); + unsigned Reg0 = HasDef + ? (ChangeReg0 ? Reg2 : MI->getOperand(0).getReg()) : 0; + bool Reg0IsDead = HasDef ? MI->getOperand(0).isDead() : false; MachineFunction &MF = *MI->getParent()->getParent(); - return BuildMI(MF, MI->getDebugLoc(), MI->getDesc()) - .addReg(Reg0, RegState::Define | getDeadRegState(Reg0IsDead)) - .addReg(Reg2, getKillRegState(Reg2IsKill)) - .addReg(Reg1, getKillRegState(Reg2IsKill)); + if (HasDef) + return BuildMI(MF, MI->getDebugLoc(), MI->getDesc()) + .addReg(Reg0, RegState::Define | getDeadRegState(Reg0IsDead)) + .addReg(Reg2, getKillRegState(Reg2IsKill)) + .addReg(Reg1, getKillRegState(Reg2IsKill)); + else + return BuildMI(MF, MI->getDebugLoc(), MI->getDesc()) + .addReg(Reg2, getKillRegState(Reg2IsKill)) + .addReg(Reg1, getKillRegState(Reg2IsKill)); } if (ChangeReg0) MI->getOperand(0).setReg(Reg2); - MI->getOperand(2).setReg(Reg1); - MI->getOperand(1).setReg(Reg2); - MI->getOperand(2).setIsKill(Reg1IsKill); - MI->getOperand(1).setIsKill(Reg2IsKill); + MI->getOperand(Idx2).setReg(Reg1); + MI->getOperand(Idx1).setReg(Reg2); + MI->getOperand(Idx2).setIsKill(Reg1IsKill); + MI->getOperand(Idx1).setIsKill(Reg2IsKill); return MI; } @@ -66,6 +77,9 @@ /// two-address instruction. bool TargetInstrInfoImpl::CommuteChangesDestination(MachineInstr *MI, unsigned &OpIdx) const{ + const TargetInstrDesc &TID = MI->getDesc(); + if (!TID.getNumDefs()) + return false; assert(MI->getOperand(1).isReg() && MI->getOperand(2).isReg() && "This only knows how to commute register operands so far"); if (MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) { Added: llvm/trunk/test/CodeGen/ARM/2009-07-01-CommuteBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-07-01-CommuteBug.ll?rev=74602&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-07-01-CommuteBug.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-07-01-CommuteBug.ll Wed Jul 1 03:29:08 2009 @@ -0,0 +1,130 @@ +; RUN: llvm-as < %s | llc -march=arm -mtriple=armv6-apple-darwin9 + + at qr = external global i32 ; [#uses=1] + at II = external global i32* ; [#uses=1] + at JJ = external global i32* ; [#uses=1] + +define arm_apcscc void @SIM(i8* %A, i8* %B, i32 %M, i32 %N, i32 %K, [256 x i32]* %V, i32 %Q, i32 %R, i32 %nseq) nounwind { +entry: + br i1 undef, label %bb5, label %bb + +bb: ; preds = %bb, %entry + br label %bb + +bb5: ; preds = %entry + br i1 undef, label %bb6, label %bb8 + +bb6: ; preds = %bb6, %bb5 + br i1 undef, label %bb8, label %bb6 + +bb8: ; preds = %bb6, %bb5 + br label %bb15 + +bb9: ; preds = %bb15 + br i1 undef, label %bb10, label %bb11 + +bb10: ; preds = %bb9 + unreachable + +bb11: ; preds = %bb9 + br i1 undef, label %bb15, label %bb12 + +bb12: ; preds = %bb11 + %0 = load i32** @II, align 4 ; [#uses=1] + %1 = load i32** @JJ, align 4 ; [#uses=1] + %2 = load i32* @qr, align 4 ; [#uses=1] + br label %bb228.i + +bb74.i: ; preds = %bb228.i + br i1 undef, label %bb138.i, label %bb145.i + +bb138.i: ; preds = %bb74.i + br label %bb145.i + +bb145.i: ; preds = %bb228.i, %bb138.i, %bb74.i + %cflag.0.i = phi i16 [ %cflag.1.i, %bb228.i ], [ %cflag.1.i, %bb74.i ], [ 1, %bb138.i ] ; [#uses=2] + br i1 undef, label %bb146.i, label %bb151.i + +bb146.i: ; preds = %bb145.i + br i1 undef, label %bb228.i, label %bb151.i + +bb151.i: ; preds = %bb146.i, %bb145.i + %.not297 = icmp ne i16 %cflag.0.i, 0 ; [#uses=1] + %or.cond298 = and i1 undef, %.not297 ; [#uses=1] + br i1 %or.cond298, label %bb153.i, label %bb228.i + +bb153.i: ; preds = %bb151.i + br i1 undef, label %bb220.i, label %bb.nph.i98 + +bb.nph.i98: ; preds = %bb153.i + br label %bb158.i + +bb158.i: ; preds = %bb218.i, %bb.nph.i98 + %c.1020.i = phi i32 [ 0, %bb.nph.i98 ], [ %c.14.i, %bb218.i ] ; [#uses=1] + %f.419.i = phi i32 [ undef, %bb.nph.i98 ], [ %f.5.i, %bb218.i ] ; [#uses=1] + %cflag.418.i = phi i16 [ 0, %bb.nph.i98 ], [ %cflag.3.i, %bb218.i ] ; [#uses=1] + %pj.317.i = phi i32 [ undef, %bb.nph.i98 ], [ %7, %bb218.i ] ; [#uses=1] + %pi.316.i = phi i32 [ undef, %bb.nph.i98 ], [ %6, %bb218.i ] ; [#uses=1] + %fj.515.i = phi i32 [ undef, %bb.nph.i98 ], [ %fj.4.i, %bb218.i ] ; [#uses=2] + %fi.614.i = phi i32 [ undef, %bb.nph.i98 ], [ %fi.5.i, %bb218.i ] ; [#uses=3] + %cj.811.i = phi i32 [ undef, %bb.nph.i98 ], [ %cj.11.i100, %bb218.i ] ; [#uses=3] + %ci.910.i = phi i32 [ undef, %bb.nph.i98 ], [ %ci.12.i, %bb218.i ] ; [#uses=2] + %3 = sub i32 %f.419.i, 0 ; [#uses=5] + %4 = sub i32 %c.1020.i, %2 ; [#uses=2] + %5 = icmp slt i32 %3, %4 ; [#uses=1] + br i1 %5, label %bb168.i, label %bb160.i + +bb160.i: ; preds = %bb158.i + br i1 undef, label %bb161.i, label %bb168.i + +bb161.i: ; preds = %bb160.i + br i1 undef, label %bb168.i, label %bb163.i + +bb163.i: ; preds = %bb161.i + br i1 undef, label %bb167.i, label %bb168.i + +bb167.i: ; preds = %bb163.i + br label %bb168.i + +bb168.i: ; preds = %bb167.i, %bb163.i, %bb161.i, %bb160.i, %bb158.i + %fi.5.i = phi i32 [ %fi.614.i, %bb167.i ], [ %ci.910.i, %bb158.i ], [ %fi.614.i, %bb160.i ], [ %ci.910.i, %bb161.i ], [ %fi.614.i, %bb163.i ] ; [#uses=2] + %fj.4.i = phi i32 [ %cj.811.i, %bb167.i ], [ %cj.811.i, %bb158.i ], [ %fj.515.i, %bb160.i ], [ %cj.811.i, %bb161.i ], [ %fj.515.i, %bb163.i ] ; [#uses=2] + %f.5.i = phi i32 [ %3, %bb167.i ], [ %4, %bb158.i ], [ %3, %bb160.i ], [ %3, %bb161.i ], [ %3, %bb163.i ] ; [#uses=2] + %scevgep88.i = getelementptr i32* %0, i32 undef ; [#uses=2] + %scevgep89.i = getelementptr i32* %1, i32 undef ; [#uses=2] + %ci.10.i = select i1 undef, i32 %pi.316.i, i32 undef ; [#uses=0] + %cj.9.i = select i1 undef, i32 %pj.317.i, i32 undef ; [#uses=0] + %ci.12.i = select i1 undef, i32 %fi.5.i, i32 undef ; [#uses=2] + %cj.11.i100 = select i1 undef, i32 %fj.4.i, i32 undef ; [#uses=2] + %c.14.i = select i1 undef, i32 %f.5.i, i32 undef ; [#uses=1] + %6 = load i32* %scevgep88.i, align 4 ; [#uses=1] + %7 = load i32* %scevgep89.i, align 4 ; [#uses=1] + store i32 %ci.12.i, i32* %scevgep88.i, align 4 + store i32 %cj.11.i100, i32* %scevgep89.i, align 4 + br i1 undef, label %bb211.i, label %bb218.i + +bb211.i: ; preds = %bb168.i + br label %bb218.i + +bb218.i: ; preds = %bb211.i, %bb168.i + %cflag.3.i = phi i16 [ %cflag.418.i, %bb168.i ], [ 1, %bb211.i ] ; [#uses=2] + %8 = icmp slt i32 undef, undef ; [#uses=1] + br i1 %8, label %bb220.i, label %bb158.i + +bb220.i: ; preds = %bb218.i, %bb153.i + %cflag.4.lcssa.i = phi i16 [ 0, %bb153.i ], [ %cflag.3.i, %bb218.i ] ; [#uses=2] + br i1 undef, label %bb221.i, label %bb228.i + +bb221.i: ; preds = %bb220.i + br label %bb228.i + +bb228.i: ; preds = %bb221.i, %bb220.i, %bb151.i, %bb146.i, %bb12 + %cflag.1.i = phi i16 [ 0, %bb146.i ], [ %cflag.0.i, %bb151.i ], [ %cflag.4.lcssa.i, %bb220.i ], [ 1, %bb12 ], [ %cflag.4.lcssa.i, %bb221.i ] ; [#uses=2] + br i1 false, label %bb74.i, label %bb145.i + +bb15: ; preds = %bb11, %bb8 + br i1 false, label %return, label %bb9 + +return: ; preds = %bb15 + ret void +} From edwintorok at gmail.com Wed Jul 1 03:52:26 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Wed, 01 Jul 2009 11:52:26 +0300 Subject: [llvm-commits] [PATCH] Improve error handling, supersede cerr+abort In-Reply-To: <60D5E8C7-05E7-4D68-9D61-E07D83090882@apple.com> References: <4A47D8D4.6060001@gmail.com> <60D5E8C7-05E7-4D68-9D61-E07D83090882@apple.com> Message-ID: <4A4B23CA.2070603@gmail.com> On 2009-07-01 07:28, Chris Lattner wrote: > On Jun 28, 2009, at 1:55 PM, T?r?k Edwin wrote: > >> As discussed here is a first implementation of an error handling API >> for >> LLVM. >> >> The attached patch introduces the API, and as an example converts 2 >> cerr+abort, and a assert(0)+abort to the new API. >> > > Cool, this is something we've needed for a long time. > > >> The default is to call abort()/exit(1) as till now, but now a client >> can >> install a custom error handler. If the custom handler returns >> abort()/exit(1) is still called. >> The intention is to also change LLVM to return failure codes instead >> of >> aborting, but as a first incremental improvement I just introduced the >> API, and tried >> to preserve current behaviour. >> > > Sounds good. > > Here are a few specific thoughts on the patch: > > +++ b/include/llvm/Support/ErrorHandling.h > @@ -0,0 +1,84 @@ > +//===- llvm/Support/ErrorHandling.h - Callbacks for errors ------*- C+ > + -*-===// > .. > +// > +// This file defines an API for error handling, it supersedes cerr > +abort(), and > +// cerr+exit() style error handling. > +// Callbacks can be registered for these errors through this API. > +// > = > = > =---------------------------------------------------------------------- > ===// > > Please put a line before the last one. Also, the file should explain > what it does, it should not refer to historical designs. Just say > "this is used to indicate error conditions ... ". > > +#ifndef LLVM_SUPPORT_ERRORHANDLING_H > +#define LLVM_SUPPORT_ERRORHANDLING_H > +#include "llvm/Support/raw_ostream.h" > +#include > > Please put a blank line before the #includes. Also, I think the > raw_ostream header at least can be replaced with a forward declaration > of the needed classes. > Fixed, none of the includes is needed now. > + enum ErrorSeverity { > + WarningSeverity=0, > + ErrorSeverity, > + FatalSeverity > + }; > > I think that this is over-designed. The depths of the code generator > should not be producing warnings, ever. Things that *can* produce > warnings (e.g. llvm-mc, tblgen, etc) should do so with their own > reporting mechanisms, not through this API. On 2009-07-01 08:12, Chris Lattner wrote: > On Jun 30, 2009, at 9:59 PM, Eli Friedman wrote: > > >> On Tue, Jun 30, 2009 at 9:28 PM, Chris Lattner >> wrote: >> >>> I think that this is over-designed. The depths of the code generator >>> should not be producing warnings, ever. >>> >> Instcombine currently can produce warnings; are you suggesting we >> should get rid of that? >> > > Yes, without loc info, it is pretty useless. Working with end users > using llvm-gcc, every time they get that warning, they assume it is a > bug in the compiler, not a bug in their code. I agree that warnings without location info are useless. However if program is compiled with debug info, we might be able to recover *some* location info. I'll just remove report_warning for now, and see if we can come up with something better in the future. Perhaps what I really want are debug messages, that can all be turned on/off via a single flag. For example, after reading your FAQ on calling conventions mismatches I'd love to have a debug flag that tells me whenever I have a *possible* mismatch, even though it may be unreachable code. Such a warning should never be shown to an end-user, but it may be useful during debugging / or for frontend authors to see what went wrong, when something does go wrong. Similarly when DAGCombiner replaces code with Undef it may be useful to show that in some debug message. Currently it does show that a node is replaced with undef, but it may get lost in the other debug messages, so having a separate flag for that could have saved some time when debugging PR4254 for example. It would also be easier to breakpoint on a single function that is reporting undefined behaviour. So maybe something like this in Support/Debug.h: DEBUG_REPORT_UNDEF(Value* value, Instruction *Use); DEBUG_REPORT_UNDEF(SDNode *Node); And they could be all controlled by -debug-only=possible-undef. What do you think? > Likewise, I don't think > there is a need for error vs fatal. There should be no fatal errors > in LLVM: in cases where there is an error, it should be detected, > reported, and recovered from. > Ok, I removed the enum. > + // Restores default error handling behaviour. > + // This must not be called between llvm_start_multithreaded() and > + // llvm_stop_multithreaded(). > + void llvm_remove_error_handler(llvm_error_handler_t handler); > > The only use of the argument is an assertion, I think you can just > remove it. > > + // Call registered error handlers, or the default that prints > message to > + // stderr. > + void llvm_handle_error(const std::string &reason, > + enum ErrorSeverity severity); > > How about naming this "llvm_report_error", and remove the other > llvm_report_* functions. > I'm fine with a single error reporting mechanism, with a default action of exit(1), not abort(). Otherwise people could complain that llvm-gcc crashed on invalid code :) I assume bugpoint is able to reduce bugs just as well if exit(1) is called, am I right? > + // Call this after every assert(0 && "something");. > + // This makes sure that even if assertions are turned off, error > handlers > + // are invoked, and program is aborted. > + static inline void llvm_unreachable(void) { > + llvm_report_fatal_error("An impossible code path was reached!"); > + } > > We don't need this. Assertions "can't happen", so assert(0) really is > unreachable. > What if assertions are turned off? Should we just remove the calls to abort() after each assert(0)? I thought the abort()s were there after the assert(0) so that the compiler knows that the codepaths never return even with assertions turned off. > +++ b/lib/ExecutionEngine/ExecutionEngine.cpp > - default: assert(0 && "Invalid long double opcode"); abort(); > + default: assert(0 && "Invalid long double > opcode");llvm_unreachable(); > > This can go away. > Ok, I removed both the abort and llvm_unreachable. > + std::string Error; > + raw_string_ostream ss(Error); > + ss << "Could not resolve external global address: " > + << I->getName(); > + llvm_report_fatal_error(ss.str()); > > This (and the one in JIT/JIT.cpp) can be simplified to: > llvm_report_error("Could not resolve external global address: " + I- > >getName()); > Thanks, fixed. > Otherwise, this is looking like a great first step! Thank you for > working on this, please send in a new adjusted patch. > Thanks for the review, attached is a new patch. I marked llvm_report_error as NORETURN, since the compiler can no longer see that since the implementation is out of line. Best regards, --Edwin -------------- next part -------------- A non-text attachment was scrubbed... Name: error_handling2.patch Type: text/x-diff Size: 6512 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/72ed2928/attachment.bin From baldrick at free.fr Wed Jul 1 06:54:56 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 01 Jul 2009 13:54:56 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> Message-ID: <4A4B4E90.4020200@free.fr> Hi Dale, >>> It's not that big of a deal, but please use SmallVector or >>> something instead of alloca. SmallVector works when "N" is more than >>> 4 by going to the heap so you won't run out of stack space for large >>> N, and is more portable. >> I am not a big lover of alloca, but it was used several places in this >> code before I started working on it so I don't think portability can >> be a problem, and the numbers involved cannot be big enough to run out >> of stack space. > > Ok, works for me. Please don't use it in normal llvm code though, > llvm-gcc is fine. it was used in two places in the llvm parts of llvm-gcc before. Since the llvm style is to use SmallVector, can you please modify all places to use SmallVector instead of alloca. Thanks a lot, Duncan. From anton at korobeynikov.info Wed Jul 1 08:11:31 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Wed, 1 Jul 2009 17:11:31 +0400 Subject: [llvm-commits] [llvm] r74549 - in /llvm/trunk: lib/Target/ARM/ARMCodeEmitter.cpp lib/Target/ARM/ARMConstantIslandPass.cpp lib/Target/ARM/ARMInstrInfo.cpp lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-jumptbl.ll In-Reply-To: References: <200906301950.n5UJoaYf025220@zion.cs.uiuc.edu> Message-ID: Hello, David > Perhaps, though we are not always interested in all jump table > opcodes. For instance, the code you show is not checking for all the > jump table opcodes, there are also the move versions BR_JTm and > t2BR_JTm. Right, but why cannot the predicate take extra argument which would control the interesting "subset" of ops? I just thought that 1 missed opcode mighyt lead to very subtle bugs. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From brukman+llvm at gmail.com Wed Jul 1 08:52:16 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Wed, 01 Jul 2009 13:52:16 -0000 Subject: [llvm-commits] [llvm] r74603 - /llvm/trunk/utils/crosstool/ARM/README Message-ID: <200907011352.n61DqK8S008528@zion.cs.uiuc.edu> Author: brukman Date: Wed Jul 1 08:51:59 2009 New Revision: 74603 URL: http://llvm.org/viewvc/llvm-project?rev=74603&view=rev Log: Added step-by-step directions on how to use the script to build and install an x86_64/Linux -> ARM/Linux crosstool. Added: llvm/trunk/utils/crosstool/ARM/README Added: llvm/trunk/utils/crosstool/ARM/README URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/crosstool/ARM/README?rev=74603&view=auto ============================================================================== --- llvm/trunk/utils/crosstool/ARM/README (added) +++ llvm/trunk/utils/crosstool/ARM/README Wed Jul 1 08:51:59 2009 @@ -0,0 +1,37 @@ +HOWTO create an LLVM crosstool from x86_64/Linux to ARM/Linux +============================================================= + +1. % llvm/utils/crosstool/create-snapshots.sh + + This will create llvm-[REV_L].tar.bz2 and llvm-gcc-4.2-[REV_G].tar.bz2, + where: + REV_L is the revision at which "llvm" was checked out, and + REV_G is the revision at which "llvm-gcc-4.2" was checked out + + Note that REV_L might REV_G might not be the same revision. + +2. Download CodeSourcery toolchain. The exact location depends on your + $CROSS_TARGET but the script will tell you what the location of the file is + if you run it without having the file available. + + For example, if you're using $CROSS_TARGET == "arm-none-linux-gnueabi" then + you need to download: + + http://www.codesourcery.com/sgpp/lite/arm/portal/package1787/public/arm-none-linux-gnueabi/arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 + + NOTE: simply changing $CROSS_TARGET and modifying the URL accordingly will + not work -- you'll need to go to http://www.codesourcery.com and find the + correct file, as the release number in the file will also be different (e.g., + in the file above, the release number is "51"). + +3. You can override most values in the script without modifying it, e.g. + $INSTALL_ROOT (if you want to install in directory other than /usr/local). + + Run the script as: + + % env INSTALL_ROOT=[dir to install in] \ + CODE_SOURCERY_PKG_PATH=[dir where you downloaded CodeSourcery tarball] \ + LLVM_PKG_PATH=[dir where you stored your LLVM and LLVM-GCC snapshots] \ + LLVM_SVN_REV=${REV_L} \ + LLVMGCC_SVN_REV=${REV_G} \ + build-install-linux.sh From daniel at zuster.org Wed Jul 1 09:53:07 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 14:53:07 -0000 Subject: [llvm-commits] [llvm] r74605 - /llvm/trunk/utils/NewNightlyTest.pl Message-ID: <200907011453.n61Er82w011063@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 09:52:59 2009 New Revision: 74605 URL: http://llvm.org/viewvc/llvm-project?rev=74605&view=rev Log: NewNightlyTest: Include minutes/seconds in log file names, to support running multiple runs per day (insane, I know). Also, remove some unused variables. Modified: llvm/trunk/utils/NewNightlyTest.pl Modified: llvm/trunk/utils/NewNightlyTest.pl URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/NewNightlyTest.pl?rev=74605&r1=74604&r2=74605&view=diff ============================================================================== --- llvm/trunk/utils/NewNightlyTest.pl (original) +++ llvm/trunk/utils/NewNightlyTest.pl Wed Jul 1 09:52:59 2009 @@ -122,9 +122,7 @@ # ############################################################## @TIME = localtime; -my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3]; -my $DateString = strftime "%B %d, %Y", localtime; -my $TestStartTime = gmtime() . "GMT
    " . localtime() . " (local)"; +my $DATE = sprintf "%4d-%02d-%02d_%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3], $TIME[1], $TIME[0]; ############################################################## # From daniel at zuster.org Wed Jul 1 10:02:30 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 1 Jul 2009 08:02:30 -0700 Subject: [llvm-commits] [PATCH] Improve error handling, supersede cerr+abort In-Reply-To: <4A4B23CA.2070603@gmail.com> References: <4A47D8D4.6060001@gmail.com> <60D5E8C7-05E7-4D68-9D61-E07D83090882@apple.com> <4A4B23CA.2070603@gmail.com> Message-ID: <6a8523d60907010802o84d6bd9k2d19ad928cf1bb1d@mail.gmail.com> 2009/7/1 T?r?k Edwin : >> We don't need this. ?Assertions "can't happen", so assert(0) really is >> unreachable. >> > > What if assertions are turned off? Should we just remove the calls to > abort() after each assert(0)? > I thought the abort()s were there after the assert(0) so that the > compiler knows that the codepaths > never return even with assertions turned off. The compiler will still know this if we replace such places with a report_error call, and report_error is marked noreturn. - Daniel From daniel at zuster.org Wed Jul 1 10:14:51 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 15:14:51 -0000 Subject: [llvm-commits] [llvm] r74607 - /llvm/trunk/tools/llvm-mc/AsmExpr.h Message-ID: <200907011514.n61FEpNx011848@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 10:14:50 2009 New Revision: 74607 URL: http://llvm.org/viewvc/llvm-project?rev=74607&view=rev Log: llvm-mc: Add some more doxyments. Modified: llvm/trunk/tools/llvm-mc/AsmExpr.h Modified: llvm/trunk/tools/llvm-mc/AsmExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.h?rev=74607&r1=74606&r2=74607&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmExpr.h (original) +++ llvm/trunk/tools/llvm-mc/AsmExpr.h Wed Jul 1 10:14:50 2009 @@ -18,13 +18,15 @@ class MCSymbol; class MCValue; +/// AsmExpr - Base class for the full range of assembler expressions which are +/// needed for parsing. class AsmExpr { public: enum AsmExprKind { - Binary, /// Binary expressions. - Constant, /// Constant expressions. - SymbolRef, /// References to labels and assigned expressions. - Unary /// Unary expressions. + Binary, ///< Binary expressions. + Constant, ///< Constant expressions. + SymbolRef, ///< References to labels and assigned expressions. + Unary ///< Unary expressions. }; private: @@ -45,7 +47,7 @@ bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; /// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable - /// value. + /// value, i.e. an expression of the fixed form (a - b + constant). /// /// @param Res - The relocatable value, if evaluation succeeds. /// @result - True on success. @@ -54,6 +56,7 @@ static bool classof(const AsmExpr *) { return true; } }; +//// AsmConstantExpr - Represent a constant integer expression. class AsmConstantExpr : public AsmExpr { int64_t Value; @@ -69,6 +72,12 @@ static bool classof(const AsmConstantExpr *) { return true; } }; +/// AsmSymbolRefExpr - Represent a reference to a symbol from inside an +/// expression. +/// +/// A symbol reference in an expression may be a use of a label, a use of an +/// assembler variable (defined constant), or constitute an implicit definition +/// of the symbol as external. class AsmSymbolRefExpr : public AsmExpr { MCSymbol *Symbol; @@ -84,13 +93,14 @@ static bool classof(const AsmSymbolRefExpr *) { return true; } }; +/// AsmUnaryExpr - Unary assembler expressions. class AsmUnaryExpr : public AsmExpr { public: enum Opcode { - LNot, /// Logical negation. - Minus, /// Unary minus. - Not, /// Bit-wise negation. - Plus /// Unary plus. + LNot, ///< Logical negation. + Minus, ///< Unary minus. + Not, ///< Bitwise negation. + Plus ///< Unary plus. }; private: @@ -114,27 +124,28 @@ static bool classof(const AsmUnaryExpr *) { return true; } }; +/// AsmBinaryExpr - Binary assembler expressions. class AsmBinaryExpr : public AsmExpr { public: enum Opcode { - Add, /// Addition. - And, /// Bitwise and. - Div, /// Division. - EQ, /// Equality comparison. - GT, /// Greater than comparison. - GTE, /// Greater than or equal comparison. - LAnd, /// Logical and. - LOr, /// Logical or. - LT, /// Less than comparison. - LTE, /// Less than or equal comparison. - Mod, /// Modulus. - Mul, /// Multiplication. - NE, /// Inequality comparison. - Or, /// Bitwise or. - Shl, /// Bitwise shift left. - Shr, /// Bitwise shift right. - Sub, /// Subtraction. - Xor /// Bitwise exclusive or. + Add, ///< Addition. + And, ///< Bitwise and. + Div, ///< Division. + EQ, ///< Equality comparison. + GT, ///< Greater than comparison. + GTE, ///< Greater than or equal comparison. + LAnd, ///< Logical and. + LOr, ///< Logical or. + LT, ///< Less than comparison. + LTE, ///< Less than or equal comparison. + Mod, ///< Modulus. + Mul, ///< Multiplication. + NE, ///< Inequality comparison. + Or, ///< Bitwise or. + Shl, ///< Bitwise shift left. + Shr, ///< Bitwise shift right. + Sub, ///< Subtraction. + Xor ///< Bitwise exclusive or. }; private: @@ -151,7 +162,10 @@ Opcode getOpcode() const { return Op; } + /// getLHS - Get the left-hand side expression of the binary operator. AsmExpr *getLHS() const { return LHS; } + + /// getRHS - Get the right-hand side expression of the binary operator. AsmExpr *getRHS() const { return RHS; } static bool classof(const AsmExpr *E) { From andrelct at dcc.ufmg.br Wed Jul 1 10:17:00 2009 From: andrelct at dcc.ufmg.br (Andre Tavares) Date: Wed, 01 Jul 2009 12:17:00 -0300 Subject: [llvm-commits] SSI patch In-Reply-To: <4A492517.1040808@dcc.ufmg.br> References: <4A4374C5.7090508@dcc.ufmg.br> <4A46F76E.4070704@mxc.ca> <4A492517.1040808@dcc.ufmg.br> Message-ID: <4A4B7DEC.8070804@dcc.ufmg.br> Latest version of the code, after all considerations. -- Andre Tavares Master Student in Computer Science - UFMG - Brasil http://dcc.ufmg.br/~andrelct -------------- next part -------------- A non-text attachment was scrubbed... Name: SSI_And.cpp Type: text/x-c++src Size: 13032 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/9270733e/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: SSI_And.h Type: text/x-chdr Size: 3842 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/9270733e/attachment-0001.bin From daniel at zuster.org Wed Jul 1 10:26:29 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 15:26:29 -0000 Subject: [llvm-commits] [llvm] r74608 - /llvm/trunk/lib/Support/SystemUtils.cpp Message-ID: <200907011526.n61FQXME012202@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 10:26:13 2009 New Revision: 74608 URL: http://llvm.org/viewvc/llvm-project?rev=74608&view=rev Log: Fix FindExecutable to work if given an absolute executable path name. - Patch by Viktor Kutuzov, with tweaks by me. Modified: llvm/trunk/lib/Support/SystemUtils.cpp Modified: llvm/trunk/lib/Support/SystemUtils.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SystemUtils.cpp?rev=74608&r1=74607&r2=74608&view=diff ============================================================================== --- llvm/trunk/lib/Support/SystemUtils.cpp (original) +++ llvm/trunk/lib/Support/SystemUtils.cpp Wed Jul 1 10:26:13 2009 @@ -38,15 +38,20 @@ /// being executed. This allows us to find another LLVM tool if it is built /// into the same directory, but that directory is neither the current /// directory, nor in the PATH. If the executable cannot be found, return an -/// empty string. +/// empty string. Return the input string if given a full path to an executable. /// #undef FindExecutable // needed on windows :( sys::Path llvm::FindExecutable(const std::string &ExeName, const std::string &ProgramPath) { - // First check the directory that the calling program is in. We can do this - // if ProgramPath contains at least one / character, indicating that it is a - // relative path to bugpoint itself. - sys::Path Result ( ProgramPath ); + // First check if the given name is a fully qualified path to an executable + sys::Path Result(ExeName); + if (Result.isAbsolute() && Result.canExecute()) + return Result; + + // Otherwise check the directory that the calling program is in. We can do + // this if ProgramPath contains at least one / character, indicating that it + // is a relative path to bugpoint itself. + Result = ProgramPath; Result.eraseComponent(); if (!Result.isEmpty()) { Result.appendComponent(ExeName); From stuart at apple.com Wed Jul 1 10:38:07 2009 From: stuart at apple.com (Stuart Hastings) Date: Wed, 01 Jul 2009 15:38:07 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74609 - /llvm-gcc-4.2/trunk/gcc/cp/parser.c Message-ID: <200907011538.n61FcAYu012572@zion.cs.uiuc.edu> Author: stuart Date: Wed Jul 1 10:37:47 2009 New Revision: 74609 URL: http://llvm.org/viewvc/llvm-project?rev=74609&view=rev Log: For blocks: the presence of byref variables requires that the __block_holder_tmp be allocated on the stack. Modified: llvm-gcc-4.2/trunk/gcc/cp/parser.c Modified: llvm-gcc-4.2/trunk/gcc/cp/parser.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/parser.c?rev=74609&r1=74608&r2=74609&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/parser.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/parser.c Wed Jul 1 10:37:47 2009 @@ -21060,18 +21060,13 @@ CONSTRUCTOR_ELTS (constructor) = build_block_struct_initlist (block_struct_type, block_impl); /* Temporary representing a global block is made global static. */ - /* APPLE LOCAL radar 6230297 */ + /* APPLE LOCAL begin radar 6230297 */ if (staticBlockTmp || global_bindings_p ()) { TREE_PUBLIC (block_holder_tmp_decl) = 0; TREE_STATIC (block_holder_tmp_decl) = 1; } + /* APPLE LOCAL end radar 6230297 */ cp_finish_decl (block_holder_tmp_decl, constructor, 0, 0, LOOKUP_ONLYCONVERTING); - /* LLVM LOCAL begin radar 5865221 */ -#ifdef ENABLE_LLVM - TREE_CONSTANT (block_holder_tmp_decl) = 1; - TREE_READONLY (block_holder_tmp_decl) = 1; -#endif - /* LLVM LOCAL end radar 5865221 */ return block_holder_tmp_decl; } /* APPLE LOCAL end radar 6169527 */ From stuart at apple.com Wed Jul 1 10:40:10 2009 From: stuart at apple.com (Stuart Hastings) Date: Wed, 01 Jul 2009 15:40:10 -0000 Subject: [llvm-commits] [llvm] r74610 - /llvm/trunk/test/FrontendC++/2009-06-30-ByrefBlock.cpp Message-ID: <200907011540.n61FeAVU012670@zion.cs.uiuc.edu> Author: stuart Date: Wed Jul 1 10:40:10 2009 New Revision: 74610 URL: http://llvm.org/viewvc/llvm-project?rev=74610&view=rev Log: Insure that __block_holder_tmp is allocated on the stack when a byref variable is present. Added: llvm/trunk/test/FrontendC++/2009-06-30-ByrefBlock.cpp Added: llvm/trunk/test/FrontendC++/2009-06-30-ByrefBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2009-06-30-ByrefBlock.cpp?rev=74610&view=auto ============================================================================== --- llvm/trunk/test/FrontendC++/2009-06-30-ByrefBlock.cpp (added) +++ llvm/trunk/test/FrontendC++/2009-06-30-ByrefBlock.cpp Wed Jul 1 10:40:10 2009 @@ -0,0 +1,8 @@ +// Insure __block_holder_tmp is allocated on the stack. +// RUN: %llvmgxx %s -S -O2 -o - | egrep {__block_holder_tmp.*alloca} +// +extern void fubar_dispatch_sync(void (^PP)(void)); +void fubar() { + __block void *voodoo; + fubar_dispatch_sync(^(void){voodoo=0;}); +} From clattner at apple.com Wed Jul 1 10:44:02 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 08:44:02 -0700 Subject: [llvm-commits] [PATCH] Fix for llvm::FindExecutable (fails to find executable if path is provided) In-Reply-To: <54EF3DC75DF14CA69492E01CACA5A320@andreic6e7fe55> References: <54EF3DC75DF14CA69492E01CACA5A320@andreic6e7fe55> Message-ID: <39D1DD86-F51E-4F13-A744-772E494C4691@apple.com> On Jun 30, 2009, at 11:52 PM, Viktor Kutuzov wrote: > Hello everyone, > > The llvm::FindExecutable fails to find a named executible if full > path is provided. Hi Viktor, Please use sys::Path::isAbsolute to check to see if it is an absolute path, this will work on windows as well as unix. Thanks, -Chris > > Please find the patch attached. > > Best regards, > Viktor > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Jul 1 10:44:47 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 08:44:47 -0700 Subject: [llvm-commits] [llvm] r74595 - /llvm/trunk/tools/llvm-mc/llvm-mc.cpp In-Reply-To: <6a8523d60906302357y6cf546a9jec12798f077c8182@mail.gmail.com> References: <200907010636.n616anSU013904@zion.cs.uiuc.edu> <6a8523d60906302357y6cf546a9jec12798f077c8182@mail.gmail.com> Message-ID: On Jun 30, 2009, at 11:57 PM, Daniel Dunbar wrote: > Thanks, I forgot about this. I completed the list. Ok, it's not really a big deal. -as-lex is not a very useful mode. :) Thanks though! -Chris > > - Daniel > > On Tue, Jun 30, 2009 at 11:36 PM, Chris Lattner > wrote: >> Author: lattner >> Date: Wed Jul 1 01:36:49 2009 >> New Revision: 74595 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74595&view=rev >> Log: >> add some of the new tokens, others are still missing. >> >> Modified: >> llvm/trunk/tools/llvm-mc/llvm-mc.cpp >> >> Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=74595&r1=74594&r2=74595&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) >> +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Wed Jul 1 01:36:49 2009 >> @@ -99,16 +99,23 @@ >> outs() << "int: " << Lexer.getCurIntVal() << '\n'; >> break; >> case asmtok::EndOfStatement: outs() << "EndOfStatement\n"; break; >> - case asmtok::Colon: outs() << "Colon\n"; break; >> - case asmtok::Plus: outs() << "Plus\n"; break; >> - case asmtok::Minus: outs() << "Minus\n"; break; >> - case asmtok::Tilde: outs() << "Tilde\n"; break; >> - case asmtok::Slash: outs() << "Slash\n"; break; >> - case asmtok::LParen: outs() << "LParen\n"; break; >> - case asmtok::RParen: outs() << "RParen\n"; break; >> - case asmtok::Star: outs() << "Star\n"; break; >> - case asmtok::Comma: outs() << "Comma\n"; break; >> - case asmtok::Dollar: outs() << "Dollar\n"; break; >> + case asmtok::Colon: outs() << "Colon\n"; break; >> + case asmtok::Plus: outs() << "Plus\n"; break; >> + case asmtok::Minus: outs() << "Minus\n"; break; >> + case asmtok::Tilde: outs() << "Tilde\n"; break; >> + case asmtok::Slash: outs() << "Slash\n"; break; >> + case asmtok::LParen: outs() << "LParen\n"; break; >> + case asmtok::RParen: outs() << "RParen\n"; break; >> + case asmtok::Star: outs() << "Star\n"; break; >> + case asmtok::Comma: outs() << "Comma\n"; break; >> + case asmtok::Dollar: outs() << "Dollar\n"; break; >> + case asmtok::Equal: outs() << "Equal\n"; break; >> + case asmtok::EqualEqual: outs() << "EqualEqual\n"; break; >> + case asmtok::Pipe: outs() << "Pipe\n"; break; >> + case asmtok::PipePipe: outs() << "PipePipe\n"; break; >> + case asmtok::Caret: outs() << "Caret\n"; break; >> + case asmtok::Amp: outs() << "Amp\n"; break; >> + case asmtok::AmpAmp: outs() << "AmpAmp\n"; break; >> } >> >> Tok = Lexer.Lex(); >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Jul 1 10:45:56 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 08:45:56 -0700 Subject: [llvm-commits] [llvm] r74450 - in /llvm/trunk/tools/llvm-mc: AsmExpr.cpp AsmExpr.h In-Reply-To: <6a8523d60907010008p76ffa017lc9ceea8ba1012ea4@mail.gmail.com> References: <200906292040.n5TKeaI9030880@zion.cs.uiuc.edu> <1D1471AE-EC6F-41E1-ACA0-75C5B9BC61B9@apple.com> <6a8523d60907010008p76ffa017lc9ceea8ba1012ea4@mail.gmail.com> Message-ID: On Jul 1, 2009, at 12:08 AM, Daniel Dunbar wrote: >>> URL: http://llvm.org/viewvc/llvm-project?rev=74450&view=rev >>> Log: >>> MC: Improve expression parsing and implement evaluation of absolute >>> expressions >>> (missed files). >> >> Nice, can you add some doxygen comments to the new classes etc >> though? > > Sure. Is there something in particular you think is missing, I'll add > class level comments but I think most of the uncommented methods are > obvious from the name and context. We don't have an official style > position on this, but in clang at least we frequently don't have > doxygen comments for trivial methods. Right, class level comments + comments on important ivars should be enough, thanks! -Chris From clattner at apple.com Wed Jul 1 10:47:30 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 08:47:30 -0700 Subject: [llvm-commits] [llvm] r74608 - /llvm/trunk/lib/Support/SystemUtils.cpp In-Reply-To: <200907011526.n61FQXME012202@zion.cs.uiuc.edu> References: <200907011526.n61FQXME012202@zion.cs.uiuc.edu> Message-ID: On Jul 1, 2009, at 8:26 AM, Daniel Dunbar wrote: > Author: ddunbar > Date: Wed Jul 1 10:26:13 2009 > New Revision: 74608 > > URL: http://llvm.org/viewvc/llvm-project?rev=74608&view=rev > Log: > Fix FindExecutable to work if given an absolute executable path name. > - Patch by Viktor Kutuzov, with tweaks by me. Oh, thanks! :) -Chris From brukman at gmail.com Wed Jul 1 10:55:58 2009 From: brukman at gmail.com (Misha Brukman) Date: Wed, 1 Jul 2009 11:55:58 -0400 Subject: [llvm-commits] [llvm] r74608 - /llvm/trunk/lib/Support/SystemUtils.cpp In-Reply-To: <200907011526.n61FQXME012202@zion.cs.uiuc.edu> References: <200907011526.n61FQXME012202@zion.cs.uiuc.edu> Message-ID: 2009/7/1 Daniel Dunbar > + // Otherwise check the directory that the calling program is in. We can > do > + // this if ProgramPath contains at least one / character, indicating > that it > + // is a relative path to bugpoint itself. Why is this referring to bugpoint specifically? This is a generic system library, not bugpoint-specific. Did you mean "binary"? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/1ce89c91/attachment.html From sanjiv.gupta at microchip.com Wed Jul 1 11:10:37 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Wed, 01 Jul 2009 16:10:37 -0000 Subject: [llvm-commits] [llvm] r74611 - in /llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base: PIC16Base.td PluginMain.cpp Message-ID: <200907011610.n61GAcOi013596@zion.cs.uiuc.edu> Author: sgupta Date: Wed Jul 1 11:10:29 2009 New Revision: 74611 URL: http://llvm.org/viewvc/llvm-project?rev=74611&view=rev Log: Executables will be at InstallDir/bin directory. Std header files will be at InstallDir/include, libs will be at InstallDir/lib. Define hooks for these and use them in the options for various tools. Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td?rev=74611&r1=74610&r2=74611&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td (original) +++ llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td Wed Jul 1 11:10:29 2009 @@ -10,7 +10,7 @@ def OptionList : OptionList<[ (switch_option "g", - (help "Disable optimizations")), + (help "Enable Debugging")), (switch_option "S", (help "Stop after compilation, do not assemble")), (parameter_option "I", @@ -33,7 +33,7 @@ (in_language "c"), (out_language "llvm-bitcode"), (output_suffix "bc"), - (cmd_line "clang-cc $INFILE -o $OUTFILE"), + (cmd_line "$CALL(GetBinDir)clang-cc -I $CALL(GetStdHeadersDir) -triple=pic16- -emit-llvm-bc $INFILE -o $OUTFILE"), (actions (case (not_empty "I"), (forward "I"))), (sink) @@ -43,7 +43,7 @@ (in_language "llvm-bitcode"), (out_language "llvm-bitcode"), (output_suffix "bc"), - (cmd_line "llvm-ld $INFILE -o $OUTFILE"), + (cmd_line "llvm-ld -f -link-as-library $INFILE -o $OUTFILE"), (actions (case (switch_on "g"), (append_cmd "-disable-opt"), (not_empty "Wo,"), (unpack_values "Wo,"))) @@ -53,7 +53,7 @@ (in_language "llvm-bitcode"), (out_language "llvm-bitcode"), (output_suffix "bc"), - (cmd_line "llvm-ld $INFILE -o $OUTFILE"), + (cmd_line "llvm-ld -link-as-library $INFILE -o $OUTFILE"), (actions (case (switch_on "g"), (append_cmd "-disable-opt"), (not_empty "Wo,"), (unpack_values "Wo,"))), @@ -64,27 +64,27 @@ (in_language "llvm-bitcode"), (out_language "assembler"), (output_suffix "s"), - (cmd_line "llc -f $INFILE -o $OUTFILE"), + (cmd_line "llc -march=pic16 -f $INFILE -o $OUTFILE"), (actions (case (switch_on "S"), (stop_compilation), (not_empty "Wllc,"), (unpack_values "Wllc,"), (not_empty "pre-RA-sched"), (forward "pre-RA-sched"))) ]>; -def native_as : Tool<[ +def gpasm : Tool<[ (in_language "assembler"), (out_language "object-code"), (output_suffix "o"), - (cmd_line "native-as $INFILE -o $OUTFILE"), + (cmd_line "gpasm -I $CALL(GetStdAsmHeadersDir) $INFILE -o $OUTFILE"), (actions (case (not_empty "Wa,"), (unpack_values "Wa,"))) ]>; -def native_ld : Tool<[ +def mplink : Tool<[ (in_language "object-code"), (out_language "executable"), (output_suffix "out"), - (cmd_line "native-ld $INFILE -o $OUTFILE"), + (cmd_line "mplink /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) $INFILE -o $OUTFILE"), (actions (case (not_empty "Wl,"), (unpack_values "Wl,"))), (join) @@ -111,6 +111,6 @@ Edge<"llvm_ld_lto", "llc">, OptionalEdge<"clang_cc", "llvm_ld", (case (switch_on "S"), (inc_weight))>, Edge<"llvm_ld", "llc">, - Edge<"llc", "native_as">, - Edge<"native_as", "native_ld"> + Edge<"llc", "gpasm">, + Edge<"gpasm", "mplink"> ]>; Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp?rev=74611&r1=74610&r2=74611&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp (original) +++ llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp Wed Jul 1 11:10:29 2009 @@ -1 +1,48 @@ #include "AutoGenerated.inc" +#include "llvm/System/Path.h" + +namespace llvmc { + extern char *ProgramName; +} + +// Returns the platform specific directory separator via #ifdefs. +static std::string GetDirSeparator(void) { + return "/"; +} + +namespace hooks { +std::string GetBinDir (void) { + // Construct a Path object from the program name. + llvm::sys::Path ProgramFullName(llvmc::ProgramName, + strlen(llvmc::ProgramName)); + + // Get the dir name for the program. It's last component should be 'bin'. + std::string BinDir = ProgramFullName.getDirname(); + + return BinDir + GetDirSeparator(); +} + +std::string GetInstallDir (void) { + llvm::sys::Path BinDirPath = llvm::sys::Path(GetBinDir()); + + // Go one more level up to get the install dir. + std::string InstallDir = BinDirPath.getDirname(); + + return InstallDir + GetDirSeparator(); +} + +std::string GetStdHeadersDir (void) { + return GetInstallDir() + "include"; +} + +std::string GetStdAsmHeadersDir (void) { + return GetInstallDir() + "inc"; +} +std::string GetStdLinkerScriptsDir (void) { + return GetInstallDir() + "lkr"; +} + +std::string GetStdLibsDir (void) { + return GetInstallDir() + "lib"; +} +} From resistor at mac.com Wed Jul 1 11:19:39 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 16:19:39 -0000 Subject: [llvm-commits] [llvm] r74612 - /llvm/trunk/lib/System/ThreadLocal.cpp Message-ID: <200907011619.n61GJhIh013862@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 11:19:23 2009 New Revision: 74612 URL: http://llvm.org/viewvc/llvm-project?rev=74612&view=rev Log: Try again at making this work on OpenBSD. Modified: llvm/trunk/lib/System/ThreadLocal.cpp Modified: llvm/trunk/lib/System/ThreadLocal.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/ThreadLocal.cpp?rev=74612&r1=74611&r2=74612&view=diff ============================================================================== --- llvm/trunk/lib/System/ThreadLocal.cpp (original) +++ llvm/trunk/lib/System/ThreadLocal.cpp Wed Jul 1 11:19:23 2009 @@ -44,7 +44,7 @@ int errorcode = pthread_key_create(key, NULL); assert(errorcode == 0); (void) errorcode; - data = static_cast(key); + data = (void*)key; } ThreadLocalImpl::~ThreadLocalImpl() { From sabre at nondot.org Wed Jul 1 11:53:58 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 16:53:58 -0000 Subject: [llvm-commits] [llvm] r74613 - in /llvm/trunk: lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp test/CodeGen/PowerPC/available-externally.ll Message-ID: <200907011654.n61Gs0KM014956@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 11:53:44 2009 New Revision: 74613 URL: http://llvm.org/viewvc/llvm-project?rev=74613&view=rev Log: Fix codegen for references to available_externally symbols. This fixes PR4482. Added: llvm/trunk/test/CodeGen/PowerPC/available-externally.ll Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=74613&r1=74612&r2=74613&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Wed Jul 1 11:53:44 2009 @@ -189,7 +189,8 @@ if (MO.getType() == MachineOperand::MO_GlobalAddress) { GlobalValue *GV = MO.getGlobal(); if (((GV->isDeclaration() || GV->hasWeakLinkage() || - GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) { + GV->hasLinkOnceLinkage() || GV->hasCommonLinkage() || + GV->hasAvailableExternallyLinkage()))) { // Dynamically-resolved functions need a stub for the function. std::string Name = Mang->getValueName(GV); FnStubs.insert(Name); @@ -382,13 +383,15 @@ // External or weakly linked global variables need non-lazily-resolved stubs if (TM.getRelocationModel() != Reloc::Static) { - if (GV->isDeclaration() || GV->isWeakForLinker()) { + if (GV->isDeclaration() || GV->isWeakForLinker() || + GV->hasAvailableExternallyLinkage()) { if (GV->hasHiddenVisibility()) { - if (!GV->isDeclaration() && !GV->hasCommonLinkage()) - O << Name; - else { + if (GV->isDeclaration() || GV->hasCommonLinkage() || + GV->hasAvailableExternallyLinkage()) { HiddenGVStubs.insert(Name); printSuffixedName(Name, "$non_lazy_ptr"); + } else { + O << Name; } } else { GVStubs.insert(Name); Added: llvm/trunk/test/CodeGen/PowerPC/available-externally.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/available-externally.ll?rev=74613&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/available-externally.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/available-externally.ll Wed Jul 1 11:53:44 2009 @@ -0,0 +1,69 @@ +; RUN: llvm-as < %s | llc | grep {bl L_exact_log2.stub} +; PR4482 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "powerpc-apple-darwin8" + +define i32 @foo(i64 %x) nounwind { +entry: + %x_addr = alloca i64 ; [#uses=2] + %retval = alloca i32 ; [#uses=2] + %0 = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i64 %x, i64* %x_addr + %1 = load i64* %x_addr, align 8 ; [#uses=1] + %2 = call i32 @exact_log2(i64 %1) nounwind ; [#uses=1] + store i32 %2, i32* %0, align 4 + %3 = load i32* %0, align 4 ; [#uses=1] + store i32 %3, i32* %retval, align 4 + br label %return + +return: ; preds = %entry + %retval1 = load i32* %retval ; [#uses=1] + ret i32 %retval1 +} + +define available_externally i32 @exact_log2(i64 %x) nounwind { +entry: + %x_addr = alloca i64 ; [#uses=6] + %retval = alloca i32 ; [#uses=2] + %iftmp.0 = alloca i32 ; [#uses=3] + %0 = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i64 %x, i64* %x_addr + %1 = load i64* %x_addr, align 8 ; [#uses=1] + %2 = sub i64 0, %1 ; [#uses=1] + %3 = load i64* %x_addr, align 8 ; [#uses=1] + %4 = and i64 %2, %3 ; [#uses=1] + %5 = load i64* %x_addr, align 8 ; [#uses=1] + %6 = icmp ne i64 %4, %5 ; [#uses=1] + br i1 %6, label %bb2, label %bb + +bb: ; preds = %entry + %7 = load i64* %x_addr, align 8 ; [#uses=1] + %8 = icmp eq i64 %7, 0 ; [#uses=1] + br i1 %8, label %bb2, label %bb1 + +bb1: ; preds = %bb + %9 = load i64* %x_addr, align 8 ; [#uses=1] + %10 = call i64 @llvm.cttz.i64(i64 %9) ; [#uses=1] + %11 = trunc i64 %10 to i32 ; [#uses=1] + store i32 %11, i32* %iftmp.0, align 4 + br label %bb3 + +bb2: ; preds = %bb, %entry + store i32 -1, i32* %iftmp.0, align 4 + br label %bb3 + +bb3: ; preds = %bb2, %bb1 + %12 = load i32* %iftmp.0, align 4 ; [#uses=1] + store i32 %12, i32* %0, align 4 + %13 = load i32* %0, align 4 ; [#uses=1] + store i32 %13, i32* %retval, align 4 + br label %return + +return: ; preds = %bb3 + %retval4 = load i32* %retval ; [#uses=1] + ret i32 %retval4 +} + +declare i64 @llvm.cttz.i64(i64) nounwind readnone From bruno.cardoso at gmail.com Wed Jul 1 11:55:25 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Wed, 1 Jul 2009 13:55:25 -0300 Subject: [llvm-commits] [llvm] r73201 - in /llvm/trunk: include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELF.h lib/CodeGen/ELFCodeEmitter.cpp lib/CodeGen/ELFWriter.cpp lib/CodeGen/ELFWriter.h lib/Target/X86/X86ELFWriterInfo.cpp lib/Target/X86/X86ELFW Message-ID: <275e64e40907010955u53de2d1cy6521e69d9c9fe031@mail.gmail.com> Hi Chris, > Is it possible to forward declare this stuff instead of including it? ?If > you move the getFunctionAlignment method out of line it will help. I already did this in some subsequent commit >> + ? ?/// getFunctionAlignment - Returns the alignment for function 'F', >> targets >> + ? ?/// with different alignment constraints should overload this method >> + ? ?virtual unsigned getFunctionAlignment(const Function *F) const { >> + ? ? ?const TargetData *TD = TM.getTargetData(); >> + ? ? ?unsigned FnAlign = F->getAlignment(); >> + ? ? ?unsigned TDAlign = TD->getPointerABIAlignment(); >> + ? ? ?unsigned Align = std::max(FnAlign, TDAlign); >> + ? ? ?assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); >> + ? ? ?return Align; > > Bill just committed a patch to move Function Alignment information into > MachineFunction. ?Can you change this to just read that information instead > of inferring an alignment in the writer-specific code? Nice, I'll do that >> +++ llvm/trunk/lib/CodeGen/ELF.h Thu Jun 11 14:16:03 2009 >> @@ -21,12 +21,12 @@ >> #ifndef CODEGEN_ELF_H >> #define CODEGEN_ELF_H >> >> +#include "llvm/GlobalVariable.h" >> #include "llvm/CodeGen/MachineRelocation.h" >> #include "llvm/Support/DataTypes.h" >> #include > > Likewise, please try to shrink down #includes where possible. ?This should > not need to include GlobalVariable.h. Ok! Thanks Chris, -- Bruno Cardoso Lopes http://www.brunocardoso.cc From resistor at mac.com Wed Jul 1 11:58:41 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 16:58:41 -0000 Subject: [llvm-commits] [llvm] r74614 - in /llvm/trunk: examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/Kaleidoscope/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/Debugger/ include/llvm/Transforms/Utils/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Debugger/ lib/Linker/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llc/ tools/lli/ tools/llvm-ar/ tools/llvm-as/ tools/llvm-db/ tools/llvm-dis/ tools/llvm-extr... Message-ID: <200907011658.n61GwkLA015181@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 11:58:40 2009 New Revision: 74614 URL: http://llvm.org/viewvc/llvm-project?rev=74614&view=rev Log: Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools. Patches for Clang and LLVM-GCC to follow. Modified: llvm/trunk/examples/BrainF/BrainF.cpp llvm/trunk/examples/BrainF/BrainF.h llvm/trunk/examples/BrainF/BrainFDriver.cpp llvm/trunk/examples/Fibonacci/fibonacci.cpp llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp llvm/trunk/examples/Kaleidoscope/toy.cpp llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp llvm/trunk/include/llvm-c/BitReader.h llvm/trunk/include/llvm-c/Core.h llvm/trunk/include/llvm/Assembly/Parser.h llvm/trunk/include/llvm/Bitcode/Archive.h llvm/trunk/include/llvm/Bitcode/ReaderWriter.h llvm/trunk/include/llvm/Debugger/Debugger.h llvm/trunk/include/llvm/LinkAllVMCore.h llvm/trunk/include/llvm/Linker.h llvm/trunk/include/llvm/Module.h llvm/trunk/include/llvm/Transforms/Utils/Cloning.h llvm/trunk/lib/Archive/Archive.cpp llvm/trunk/lib/Archive/ArchiveInternals.h llvm/trunk/lib/Archive/ArchiveReader.cpp llvm/trunk/lib/Archive/ArchiveWriter.cpp llvm/trunk/lib/AsmParser/Parser.cpp llvm/trunk/lib/Bitcode/Reader/BitReader.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h llvm/trunk/lib/Debugger/Debugger.cpp llvm/trunk/lib/Linker/LinkArchives.cpp llvm/trunk/lib/Linker/LinkItems.cpp llvm/trunk/lib/Linker/Linker.cpp llvm/trunk/lib/Transforms/Utils/CloneModule.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/Module.cpp llvm/trunk/tools/bugpoint/BugDriver.cpp llvm/trunk/tools/bugpoint/BugDriver.h llvm/trunk/tools/bugpoint/CrashDebugger.cpp llvm/trunk/tools/bugpoint/Miscompilation.cpp llvm/trunk/tools/bugpoint/OptimizerDriver.cpp llvm/trunk/tools/bugpoint/bugpoint.cpp llvm/trunk/tools/llc/llc.cpp llvm/trunk/tools/lli/lli.cpp llvm/trunk/tools/llvm-ar/llvm-ar.cpp llvm/trunk/tools/llvm-as/llvm-as.cpp llvm/trunk/tools/llvm-db/CLIDebugger.cpp llvm/trunk/tools/llvm-db/CLIDebugger.h llvm/trunk/tools/llvm-db/Commands.cpp llvm/trunk/tools/llvm-db/llvm-db.cpp llvm/trunk/tools/llvm-dis/llvm-dis.cpp llvm/trunk/tools/llvm-extract/llvm-extract.cpp llvm/trunk/tools/llvm-ld/llvm-ld.cpp llvm/trunk/tools/llvm-link/llvm-link.cpp llvm/trunk/tools/llvm-nm/llvm-nm.cpp llvm/trunk/tools/llvm-prof/llvm-prof.cpp llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/lto/LTOCodeGenerator.h llvm/trunk/tools/lto/LTOModule.cpp llvm/trunk/tools/lto/LTOModule.h llvm/trunk/tools/lto/lto.cpp llvm/trunk/tools/opt/opt.cpp Modified: llvm/trunk/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.cpp (original) +++ llvm/trunk/examples/BrainF/BrainF.cpp Wed Jul 1 11:58:40 2009 @@ -36,19 +36,20 @@ const char *BrainF::label = "brainf"; const char *BrainF::testreg = "test"; -Module *BrainF::parse(std::istream *in1, int mem, CompileFlags cf) { +Module *BrainF::parse(std::istream *in1, int mem, CompileFlags cf, + LLVMContext* Context) { in = in1; memtotal = mem; comflag = cf; - header(); + header(Context); readloop(0, 0, 0); delete builder; return module; } -void BrainF::header() { - module = new Module("BrainF"); +void BrainF::header(LLVMContext* C) { + module = new Module("BrainF", C); //Function prototypes Modified: llvm/trunk/examples/BrainF/BrainF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.h (original) +++ llvm/trunk/examples/BrainF/BrainF.h Wed Jul 1 11:58:40 2009 @@ -15,6 +15,7 @@ #ifndef BRAINF_H #define BRAINF_H +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Support/IRBuilder.h" @@ -38,7 +39,7 @@ /// containing the resulting code. /// On error, it calls abort. /// The caller must delete the returned module. - Module *parse(std::istream *in1, int mem, CompileFlags cf); + Module *parse(std::istream *in1, int mem, CompileFlags cf, LLVMContext* C); protected: /// The different symbols in the BrainF language @@ -64,7 +65,7 @@ static const char *testreg; /// Put the brainf function preamble and other fixed pieces of code - void header(); + void header(LLVMContext* C); /// The main loop for parsing. It calls itself recursively /// to handle the depth of nesting of "[]". Modified: llvm/trunk/examples/BrainF/BrainFDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainFDriver.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainFDriver.cpp (original) +++ llvm/trunk/examples/BrainF/BrainFDriver.cpp Wed Jul 1 11:58:40 2009 @@ -86,6 +86,8 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " BrainF compiler\n"); + LLVMContext Context; + if (InputFilename == "") { std::cerr<<"Error: You must specify the filename of the program to " "be compiled. Use --help to see the options.\n"; @@ -124,7 +126,7 @@ //Read the BrainF program BrainF bf; - Module *mod = bf.parse(in, 65536, cf); //64 KiB + Module *mod = bf.parse(in, 65536, cf, &Context); //64 KiB if (in != &std::cin) {delete in;} addMainFunction(mod); Modified: llvm/trunk/examples/Fibonacci/fibonacci.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Fibonacci/fibonacci.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/examples/Fibonacci/fibonacci.cpp (original) +++ llvm/trunk/examples/Fibonacci/fibonacci.cpp Wed Jul 1 11:58:40 2009 @@ -23,6 +23,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" @@ -90,8 +91,10 @@ int main(int argc, char **argv) { int n = argc > 1 ? atol(argv[1]) : 24; + LLVMContext Context; + // Create some module to put our function into it. - Module *M = new Module("test"); + Module *M = new Module("test", &Context); // We are about to create the "fib" function: Function *FibF = CreateFibFunction(M); Modified: llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp (original) +++ llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp Wed Jul 1 11:58:40 2009 @@ -34,6 +34,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -50,9 +51,11 @@ int main() { InitializeNativeTarget(); + + LLVMContext Context; // Create some module to put our function into it. - Module *M = new Module("test"); + Module *M = new Module("test", &Context); // Create the add1 function entry and insert this entry into module M. The // function will have a return type of "int" and take an argument of "int". Modified: llvm/trunk/examples/Kaleidoscope/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/toy.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/toy.cpp (original) +++ llvm/trunk/examples/Kaleidoscope/toy.cpp Wed Jul 1 11:58:40 2009 @@ -1,5 +1,6 @@ #include "llvm/DerivedTypes.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" @@ -1083,6 +1084,7 @@ int main() { InitializeNativeTarget(); + LLVMContext Context; // Install standard binary operators. // 1 is lowest precedence. @@ -1097,7 +1099,7 @@ getNextToken(); // Make the module, which holds all the code. - TheModule = new Module("my cool jit"); + TheModule = new Module("my cool jit", &Context); // Create the JIT. TheExecutionEngine = ExecutionEngine::create(TheModule); Modified: llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp (original) +++ llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp Wed Jul 1 11:58:40 2009 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" @@ -22,9 +23,11 @@ using namespace llvm; int main() { + LLVMContext Context; + // Create the "module" or "program" or "translation unit" to hold the // function - Module *M = new Module("test"); + Module *M = new Module("test", &Context); // Create the main function: first create the type 'int ()' FunctionType *FT = FunctionType::get(Type::Int32Ty, /*not vararg*/false); Modified: llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp (original) +++ llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp Wed Jul 1 11:58:40 2009 @@ -18,6 +18,7 @@ // same time). This test had assertion errors until I got the locking right. #include +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -232,9 +233,10 @@ int main() { InitializeNativeTarget(); + LLVMContext Context; // Create some module to put our function into it. - Module *M = new Module("test"); + Module *M = new Module("test", &Context); Function* add1F = createAdd1( M ); Function* fibF = CreateFibFunction( M ); Modified: llvm/trunk/include/llvm-c/BitReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/BitReader.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/BitReader.h (original) +++ llvm/trunk/include/llvm-c/BitReader.h Wed Jul 1 11:58:40 2009 @@ -29,13 +29,14 @@ /* Builds a module from the bitcode in the specified memory buffer, returning a reference to the module via the OutModule parameter. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ -int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, +int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMContextRef ContextRef, LLVMModuleRef *OutModule, char **OutMessage); /* Reads a module from the specified path, returning via the OutMP parameter a module provider which performs lazy deserialization. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, + LLVMContextRef ContextRef, LLVMModuleProviderRef *OutMP, char **OutMessage); Modified: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (original) +++ llvm/trunk/include/llvm-c/Core.h Wed Jul 1 11:58:40 2009 @@ -47,6 +47,11 @@ /* Opaque types. */ /** + * The top-level container for all LLVM global data. See the LLVMContext class. + */ +typedef struct LLVMCtxt *LLVMContextRef; + +/** * The top-level container for all other LLVM Intermediate Representation (IR) * objects. See the llvm::Module class. */ @@ -188,6 +193,10 @@ /*===-- Modules -----------------------------------------------------------===*/ +/* Create and destroy contexts. */ +LLVMContextRef LLVMContextCreate(); +void LLVMContextDispose(LLVMContextRef C); + /* Create and destroy modules. */ /** See llvm::Module::Module. */ LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID); @@ -815,6 +824,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(PATypeHolder, LLVMTypeHandleRef ) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ModuleProvider, LLVMModuleProviderRef) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer, LLVMMemoryBufferRef ) + DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext, LLVMContextRef ) DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBase, LLVMPassManagerRef ) #undef DEFINE_STDCXX_CONVERSION_FUNCTIONS Modified: llvm/trunk/include/llvm/Assembly/Parser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Parser.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Parser.h (original) +++ llvm/trunk/include/llvm/Assembly/Parser.h Wed Jul 1 11:58:40 2009 @@ -21,6 +21,7 @@ class Module; class ParseError; class raw_ostream; +class LLVMContext; /// This function is the main interface to the LLVM Assembly Parser. It parses /// an ASCII file that (presumably) contains LLVM Assembly code. It returns a @@ -30,7 +31,8 @@ /// @brief Parse LLVM Assembly from a file Module *ParseAssemblyFile( const std::string &Filename, ///< The name of the file to parse - ParseError &Error ///< If not null, an object to return errors in. + ParseError &Error, ///< If not null, an object to return errors in. + LLVMContext* Context ///< Context in which to allocate globals info. ); /// The function is a secondary interface to the LLVM Assembly Parser. It parses @@ -42,7 +44,8 @@ Module *ParseAssemblyString( const char *AsmString, ///< The string containing assembly Module *M, ///< A module to add the assembly too. - ParseError &Error ///< If not null, an object to return errors in. + ParseError &Error, ///< If not null, an object to return errors in. + LLVMContext* Context ); //===------------------------------------------------------------------------=== Modified: llvm/trunk/include/llvm/Bitcode/Archive.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Archive.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Archive.h (original) +++ llvm/trunk/include/llvm/Bitcode/Archive.h Wed Jul 1 11:58:40 2009 @@ -32,6 +32,7 @@ class Module; // From VMCore class Archive; // Declared below class ArchiveMemberHeader; // Internal implementation class +class LLVMContext; // Global data /// This class is the main class manipulated by users of the Archive class. It /// holds information about one member of the Archive. It is also the element @@ -278,7 +279,8 @@ /// @returns An Archive* that represents the new archive file. /// @brief Create an empty Archive. static Archive* CreateEmpty( - const sys::Path& Filename ///< Name of the archive to (eventually) create. + const sys::Path& Filename,///< Name of the archive to (eventually) create. + LLVMContext* C ///< Context to use for global information ); /// Open an existing archive and load its contents in preparation for @@ -289,6 +291,7 @@ /// @brief Open and load an archive file static Archive* OpenAndLoad( const sys::Path& filePath, ///< The file path to open and load + LLVMContext* C, ///< The context to use for global information std::string* ErrorMessage ///< An optional error string ); @@ -310,6 +313,7 @@ /// @brief Open an existing archive and load its symbols. static Archive* OpenAndLoadSymbols( const sys::Path& Filename, ///< Name of the archive file to open + LLVMContext* C, ///< The context to use for global info std::string* ErrorMessage=0 ///< An optional error string ); @@ -449,7 +453,7 @@ protected: /// @brief Construct an Archive for \p filename and optionally map it /// into memory. - explicit Archive(const sys::Path& filename); + explicit Archive(const sys::Path& filename, LLVMContext* C); /// @param data The symbol table data to be parsed /// @param len The length of the symbol table data @@ -530,6 +534,7 @@ unsigned firstFileOffset; ///< Offset to first normal file. ModuleMap modules; ///< The modules loaded via symbol lookup. ArchiveMember* foreignST; ///< This holds the foreign symbol table. + LLVMContext* Context; ///< This holds global data. /// @} /// @name Hidden /// @{ Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original) +++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Wed Jul 1 11:58:40 2009 @@ -23,6 +23,7 @@ class MemoryBuffer; class ModulePass; class BitstreamWriter; + class LLVMContext; class raw_ostream; /// getBitcodeModuleProvider - Read the header of the specified bitcode buffer @@ -31,12 +32,14 @@ /// error, this returns null, *does not* take ownership of Buffer, and fills /// in *ErrMsg with an error description if ErrMsg is non-null. ModuleProvider *getBitcodeModuleProvider(MemoryBuffer *Buffer, + LLVMContext* Context, std::string *ErrMsg = 0); /// ParseBitcodeFile - Read the specified bitcode file, returning the module. /// If an error occurs, this returns null and fills in *ErrMsg if it is /// non-null. This method *never* takes ownership of Buffer. - Module *ParseBitcodeFile(MemoryBuffer *Buffer, std::string *ErrMsg = 0); + Module *ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* Context, + std::string *ErrMsg = 0); /// WriteBitcodeToFile - Write the specified module to the specified output /// stream. Modified: llvm/trunk/include/llvm/Debugger/Debugger.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Debugger/Debugger.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm/Debugger/Debugger.h (original) +++ llvm/trunk/include/llvm/Debugger/Debugger.h Wed Jul 1 11:58:40 2009 @@ -20,6 +20,7 @@ namespace llvm { class Module; class InferiorProcess; + class LLVMContext; /// Debugger class - This class implements the LLVM source-level debugger. /// This allows clients to handle the user IO processing without having to @@ -95,7 +96,7 @@ /// the PATH for the specified program, loading it when found. If the /// specified program cannot be found, an exception is thrown to indicate /// the error. - void loadProgram(const std::string &Path); + void loadProgram(const std::string &Path, LLVMContext* Context); /// unloadProgram - If a program is running, kill it, then unload all traces /// of the current program. If no program is loaded, this method silently Modified: llvm/trunk/include/llvm/LinkAllVMCore.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllVMCore.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllVMCore.h (original) +++ llvm/trunk/include/llvm/LinkAllVMCore.h Wed Jul 1 11:58:40 2009 @@ -44,7 +44,7 @@ // to know that getenv() never returns -1, this will do the job. if (std::getenv("bar") != (char*) -1) return; - llvm::Module* M = new llvm::Module(""); + llvm::Module* M = new llvm::Module("", 0); (void)new llvm::UnreachableInst(); (void) llvm::createVerifierPass(); (void) new llvm::Mangler(*M,""); Modified: llvm/trunk/include/llvm/Linker.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm/Linker.h (original) +++ llvm/trunk/include/llvm/Linker.h Wed Jul 1 11:58:40 2009 @@ -21,6 +21,7 @@ namespace llvm { class Module; +class LLVMContext; /// This class provides the core functionality of linking in LLVM. It retains a /// Module object which is the composite of the modules and libraries linked @@ -66,6 +67,7 @@ Linker( const std::string& progname, ///< name of tool running linker const std::string& modulename, ///< name of linker's end-result module + LLVMContext* C, ///< Context for global info unsigned Flags = 0 ///< ControlFlags (one or more |'d together) ); @@ -283,6 +285,7 @@ /// @name Data /// @{ private: + LLVMContext* Context; ///< The context for global information Module* Composite; ///< The composite module linked together std::vector LibPaths; ///< The library search paths unsigned Flags; ///< Flags to control optional behavior. Modified: llvm/trunk/include/llvm/Module.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Module.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm/Module.h (original) +++ llvm/trunk/include/llvm/Module.h Wed Jul 1 11:58:40 2009 @@ -25,6 +25,7 @@ class GlobalValueRefMap; // Used by ConstantVals.cpp class FunctionType; +class LLVMContext; template<> struct ilist_traits : public SymbolTableListTraits { @@ -109,6 +110,8 @@ /// @name Member Variables /// @{ private: + LLVMContext* Context; ///< The LLVMContext from which types and + ///< constants are allocated. GlobalListType GlobalList; ///< The Global Variables in the module FunctionListType FunctionList; ///< The Functions in the module AliasListType AliasList; ///< The Aliases in the module @@ -128,7 +131,7 @@ public: /// The Module constructor. Note that there is no default constructor. You /// must provide a name for the module upon construction. - explicit Module(const std::string &ModuleID); + explicit Module(const std::string &ModuleID, LLVMContext* C); /// The module destructor. This will dropAllReferences. ~Module(); @@ -157,6 +160,10 @@ /// @returns PointerSize - an enumeration for the size of the target's pointer PointerSize getPointerSize() const; + /// Get the global data context. + /// @returns LLVMContext - a container for LLVM's global information + LLVMContext* getContext() const { return Context; } + /// Get any module-scope inline assembly blocks. /// @returns a string containing the module-scope inline assembly blocks. const std::string &getModuleInlineAsm() const { return GlobalScopeAsm; } Modified: llvm/trunk/include/llvm/Transforms/Utils/Cloning.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Cloning.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/Cloning.h (original) +++ llvm/trunk/include/llvm/Transforms/Utils/Cloning.h Wed Jul 1 11:58:40 2009 @@ -37,6 +37,7 @@ class CallGraph; class TargetData; class LoopInfo; +class LLVMContext; template class LoopBase; typedef LoopBase Loop; Modified: llvm/trunk/lib/Archive/Archive.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/Archive.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Archive/Archive.cpp (original) +++ llvm/trunk/lib/Archive/Archive.cpp Wed Jul 1 11:58:40 2009 @@ -138,9 +138,9 @@ // Archive constructor - this is the only constructor that gets used for the // Archive class. Everything else (default,copy) is deprecated. This just // initializes and maps the file into memory, if requested. -Archive::Archive(const sys::Path& filename) +Archive::Archive(const sys::Path& filename, LLVMContext* C) : archPath(filename), members(), mapfile(0), base(0), symTab(), strtab(), - symTabSize(0), firstFileOffset(0), modules(), foreignST(0) { + symTabSize(0), firstFileOffset(0), modules(), foreignST(0), Context(C) { } bool @@ -208,6 +208,7 @@ // Get just the externally visible defined symbols from the bitcode bool llvm::GetBitcodeSymbols(const sys::Path& fName, + LLVMContext* Context, std::vector& symbols, std::string* ErrMsg) { std::auto_ptr Buffer( @@ -217,7 +218,7 @@ return true; } - ModuleProvider *MP = getBitcodeModuleProvider(Buffer.get(), ErrMsg); + ModuleProvider *MP = getBitcodeModuleProvider(Buffer.get(), Context, ErrMsg); if (!MP) return true; @@ -239,13 +240,14 @@ ModuleProvider* llvm::GetBitcodeSymbols(const unsigned char *BufPtr, unsigned Length, const std::string& ModuleID, + LLVMContext* Context, std::vector& symbols, std::string* ErrMsg) { // Get the module provider MemoryBuffer *Buffer =MemoryBuffer::getNewMemBuffer(Length, ModuleID.c_str()); memcpy((char*)Buffer->getBufferStart(), BufPtr, Length); - ModuleProvider *MP = getBitcodeModuleProvider(Buffer, ErrMsg); + ModuleProvider *MP = getBitcodeModuleProvider(Buffer, Context, ErrMsg); if (!MP) return 0; Modified: llvm/trunk/lib/Archive/ArchiveInternals.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveInternals.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveInternals.h (original) +++ llvm/trunk/lib/Archive/ArchiveInternals.h Wed Jul 1 11:58:40 2009 @@ -31,6 +31,8 @@ namespace llvm { + class LLVMContext; + /// The ArchiveMemberHeader structure is used internally for bitcode /// archives. /// The header precedes each file member in the archive. This structure is @@ -71,11 +73,13 @@ // Get just the externally visible defined symbols from the bitcode bool GetBitcodeSymbols(const sys::Path& fName, + LLVMContext* Context, std::vector& symbols, std::string* ErrMsg); ModuleProvider* GetBitcodeSymbols(const unsigned char*Buffer,unsigned Length, const std::string& ModuleID, + LLVMContext* Context, std::vector& symbols, std::string* ErrMsg); } Modified: llvm/trunk/lib/Archive/ArchiveReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveReader.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveReader.cpp (original) +++ llvm/trunk/lib/Archive/ArchiveReader.cpp Wed Jul 1 11:58:40 2009 @@ -327,9 +327,9 @@ // Open and completely load the archive file. Archive* -Archive::OpenAndLoad(const sys::Path& file, std::string* ErrorMessage) -{ - std::auto_ptr result ( new Archive(file)); +Archive::OpenAndLoad(const sys::Path& file, LLVMContext* C, + std::string* ErrorMessage) { + std::auto_ptr result ( new Archive(file, C)); if (result->mapToMemory(ErrorMessage)) return 0; if (!result->loadArchive(ErrorMessage)) @@ -339,7 +339,8 @@ // Get all the bitcode modules from the archive bool -Archive::getAllModules(std::vector& Modules, std::string* ErrMessage) { +Archive::getAllModules(std::vector& Modules, + std::string* ErrMessage) { for (iterator I=begin(), E=end(); I != E; ++I) { if (I->isBitcode()) { @@ -349,7 +350,7 @@ MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str()); memcpy((char*)Buffer->getBufferStart(), I->getData(), I->getSize()); - Module *M = ParseBitcodeFile(Buffer, ErrMessage); + Module *M = ParseBitcodeFile(Buffer, Context, ErrMessage); delete Buffer; if (!M) return true; @@ -440,9 +441,9 @@ } // Open the archive and load just the symbol tables -Archive* -Archive::OpenAndLoadSymbols(const sys::Path& file, std::string* ErrorMessage) { - std::auto_ptr result ( new Archive(file) ); +Archive* Archive::OpenAndLoadSymbols(const sys::Path& file, LLVMContext* C, + std::string* ErrorMessage) { + std::auto_ptr result ( new Archive(file, C) ); if (result->mapToMemory(ErrorMessage)) return 0; if (!result->loadSymbolTable(ErrorMessage)) @@ -488,7 +489,7 @@ FullMemberName.c_str()); memcpy((char*)Buffer->getBufferStart(), mbr->getData(), mbr->getSize()); - ModuleProvider *mp = getBitcodeModuleProvider(Buffer, ErrMsg); + ModuleProvider *mp = getBitcodeModuleProvider(Buffer, Context, ErrMsg); if (!mp) return 0; @@ -536,7 +537,7 @@ mbr->getPath().toString() + ")"; ModuleProvider* MP = GetBitcodeSymbols((const unsigned char*)At, mbr->getSize(), - FullMemberName, symbols, error); + FullMemberName, Context, symbols, error); if (MP) { // Insert the module's symbols into the symbol table @@ -615,7 +616,7 @@ MemoryBuffer *Buffer = MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str()); memcpy((char*)Buffer->getBufferStart(), I->getData(), I->getSize()); - Module *M = ParseBitcodeFile(Buffer); + Module *M = ParseBitcodeFile(Buffer, Context); delete Buffer; if (!M) return false; // Couldn't parse bitcode, not a bitcode archive. Modified: llvm/trunk/lib/Archive/ArchiveWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveWriter.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveWriter.cpp (original) +++ llvm/trunk/lib/Archive/ArchiveWriter.cpp Wed Jul 1 11:58:40 2009 @@ -64,9 +64,8 @@ } // Create an empty archive. -Archive* -Archive::CreateEmpty(const sys::Path& FilePath ) { - Archive* result = new Archive(FilePath); +Archive* Archive::CreateEmpty(const sys::Path& FilePath, LLVMContext* C) { + Archive* result = new Archive(FilePath, C); return result; } @@ -229,7 +228,7 @@ + ")"; ModuleProvider* MP = GetBitcodeSymbols((const unsigned char*)data,fSize, - FullMemberName, symbols, ErrMsg); + FullMemberName, Context, symbols, ErrMsg); // If the bitcode parsed successfully if ( MP ) { Modified: llvm/trunk/lib/AsmParser/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Parser.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Parser.cpp (original) +++ llvm/trunk/lib/AsmParser/Parser.cpp Wed Jul 1 11:58:40 2009 @@ -20,7 +20,8 @@ #include using namespace llvm; -Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err) { +Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err, + LLVMContext* Context) { Err.setFilename(Filename); std::string ErrorStr; @@ -31,14 +32,14 @@ return 0; } - OwningPtr M(new Module(Filename)); + OwningPtr M(new Module(Filename, Context)); if (LLParser(F.get(), Err, M.get()).Run()) return 0; return M.take(); } Module *llvm::ParseAssemblyString(const char *AsmString, Module *M, - ParseError &Err) { + ParseError &Err, LLVMContext* Context) { Err.setFilename(""); OwningPtr @@ -50,7 +51,7 @@ return LLParser(F.get(), Err, M).Run() ? 0 : M; // Otherwise create a new module. - OwningPtr M2(new Module("")); + OwningPtr M2(new Module("", Context)); if (LLParser(F.get(), Err, M2.get()).Run()) return 0; return M2.take(); Modified: llvm/trunk/lib/Bitcode/Reader/BitReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitReader.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Wed Jul 1 11:58:40 2009 @@ -18,11 +18,12 @@ /* Builds a module from the bitcode in the specified memory buffer, returning a reference to the module via the OutModule parameter. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ -int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, +int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMContextRef ContextRef, LLVMModuleRef *OutModule, char **OutMessage) { std::string Message; - *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), &Message)); + *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), unwrap(ContextRef), + &Message)); if (!*OutModule) { if (OutMessage) *OutMessage = strdup(Message.c_str()); @@ -36,11 +37,13 @@ a module provider which performs lazy deserialization. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, + LLVMContextRef ContextRef, LLVMModuleProviderRef *OutMP, char **OutMessage) { std::string Message; - *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), &Message)); + *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), unwrap(ContextRef), + &Message)); if (!*OutMP) { if (OutMessage) *OutMessage = strdup(Message.c_str()); Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Jul 1 11:58:40 2009 @@ -1087,7 +1087,7 @@ return Error("Malformed block record"); // Otherwise, create the module. - TheModule = new Module(ModuleID); + TheModule = new Module(ModuleID, Context); SmallVector Record; std::vector SectionTable; @@ -2090,8 +2090,9 @@ /// getBitcodeModuleProvider - lazy function-at-a-time loading from a file. /// ModuleProvider *llvm::getBitcodeModuleProvider(MemoryBuffer *Buffer, + LLVMContext* Context, std::string *ErrMsg) { - BitcodeReader *R = new BitcodeReader(Buffer); + BitcodeReader *R = new BitcodeReader(Buffer, Context); if (R->ParseBitcode()) { if (ErrMsg) *ErrMsg = R->getErrorString(); @@ -2106,9 +2107,11 @@ /// ParseBitcodeFile - Read the specified bitcode file, returning the module. /// If an error occurs, return null and fill in *ErrMsg if non-null. -Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, std::string *ErrMsg){ +Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* Context, + std::string *ErrMsg){ BitcodeReader *R; - R = static_cast(getBitcodeModuleProvider(Buffer, ErrMsg)); + R = static_cast(getBitcodeModuleProvider(Buffer, Context, + ErrMsg)); if (!R) return 0; // Read in the entire module. Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Wed Jul 1 11:58:40 2009 @@ -26,6 +26,7 @@ namespace llvm { class MemoryBuffer; + class LLVMContext; //===----------------------------------------------------------------------===// // BitcodeReaderValueList Class @@ -85,6 +86,7 @@ }; class BitcodeReader : public ModuleProvider { + LLVMContext* Context; MemoryBuffer *Buffer; BitstreamReader StreamFile; BitstreamCursor Stream; @@ -123,8 +125,8 @@ /// stream) and what linkage the original function had. DenseMap > DeferredFunctionInfo; public: - explicit BitcodeReader(MemoryBuffer *buffer) - : Buffer(buffer), ErrorString(0) { + explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext* C) + : Context(C), Buffer(buffer), ErrorString(0) { HasReversedFunctionsWithBodies = false; } ~BitcodeReader() { Modified: llvm/trunk/lib/Debugger/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Debugger/Debugger.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Debugger/Debugger.cpp (original) +++ llvm/trunk/lib/Debugger/Debugger.cpp Wed Jul 1 11:58:40 2009 @@ -46,11 +46,11 @@ } static Module * -getMaterializedModuleProvider(const std::string &Filename) { +getMaterializedModuleProvider(const std::string &Filename, LLVMContext* C) { std::auto_ptr Buffer; Buffer.reset(MemoryBuffer::getFileOrSTDIN(Filename.c_str())); if (Buffer.get()) - return ParseBitcodeFile(Buffer.get()); + return ParseBitcodeFile(Buffer.get(), C); return 0; } @@ -58,9 +58,9 @@ /// the PATH for the specified program, loading it when found. If the /// specified program cannot be found, an exception is thrown to indicate the /// error. -void Debugger::loadProgram(const std::string &Filename) { - if ((Program = getMaterializedModuleProvider(Filename)) || - (Program = getMaterializedModuleProvider(Filename+".bc"))) +void Debugger::loadProgram(const std::string &Filename, LLVMContext* C) { + if ((Program = getMaterializedModuleProvider(Filename, C)) || + (Program = getMaterializedModuleProvider(Filename+".bc", C))) return; // Successfully loaded the program. // Search the program path for the file... @@ -69,9 +69,9 @@ std::string Directory = getToken(Path, ":"); while (!Directory.empty()) { - if ((Program = getMaterializedModuleProvider(Directory +"/"+ Filename)) || - (Program = getMaterializedModuleProvider(Directory +"/"+ Filename - + ".bc"))) + if ((Program = getMaterializedModuleProvider(Directory +"/"+ Filename, C)) + || (Program = getMaterializedModuleProvider(Directory +"/"+ Filename + + ".bc", C))) return; // Successfully loaded the program. Directory = getToken(Path, ":"); Modified: llvm/trunk/lib/Linker/LinkArchives.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkArchives.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkArchives.cpp (original) +++ llvm/trunk/lib/Linker/LinkArchives.cpp Wed Jul 1 11:58:40 2009 @@ -115,7 +115,7 @@ std::string ErrMsg; std::auto_ptr AutoArch ( - Archive::OpenAndLoadSymbols(Filename,&ErrMsg)); + Archive::OpenAndLoadSymbols(Filename, Context, &ErrMsg)); Archive* arch = AutoArch.get(); Modified: llvm/trunk/lib/Linker/LinkItems.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkItems.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkItems.cpp (original) +++ llvm/trunk/lib/Linker/LinkItems.cpp Wed Jul 1 11:58:40 2009 @@ -160,7 +160,7 @@ if (File.toString() == "-") { std::auto_ptr M; if (MemoryBuffer *Buffer = MemoryBuffer::getSTDIN()) { - M.reset(ParseBitcodeFile(Buffer, &Error)); + M.reset(ParseBitcodeFile(Buffer, Context, &Error)); delete Buffer; if (M.get()) if (!LinkInModule(M.get(), &Error)) Modified: llvm/trunk/lib/Linker/Linker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/Linker.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Linker/Linker.cpp (original) +++ llvm/trunk/lib/Linker/Linker.cpp Wed Jul 1 11:58:40 2009 @@ -20,24 +20,21 @@ using namespace llvm; Linker::Linker(const std::string& progname, const std::string& modname, - unsigned flags) - : Composite(0) - , LibPaths() - , Flags(flags) - , Error() - , ProgramName(progname) -{ - Composite = new Module(modname); -} - -Linker::Linker(const std::string& progname, Module* aModule, unsigned flags) - : Composite(aModule) - , LibPaths() - , Flags(flags) - , Error() - , ProgramName(progname) -{ -} + LLVMContext* C, unsigned flags): + Context(C), + Composite(new Module(modname, C)), + LibPaths(), + Flags(flags), + Error(), + ProgramName(progname) { } + +Linker::Linker(const std::string& progname, Module* aModule, unsigned flags) : + Context(aModule->getContext()), + Composite(aModule), + LibPaths(), + Flags(flags), + Error(), + ProgramName(progname) { } Linker::~Linker() { delete Composite; @@ -106,7 +103,7 @@ const std::string &FNS = FN.toString(); std::auto_ptr Buffer(MemoryBuffer::getFileOrSTDIN(FNS.c_str())); if (Buffer.get()) - Result = ParseBitcodeFile(Buffer.get(), &ParseErrorMessage); + Result = ParseBitcodeFile(Buffer.get(), Context, &ParseErrorMessage); else ParseErrorMessage = "Error reading file '" + FNS + "'"; Modified: llvm/trunk/lib/Transforms/Utils/CloneModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneModule.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneModule.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CloneModule.cpp Wed Jul 1 11:58:40 2009 @@ -35,7 +35,7 @@ Module *llvm::CloneModule(const Module *M, DenseMap &ValueMap) { // First off, we need to create the new module... - Module *New = new Module(M->getModuleIdentifier()); + Module *New = new Module(M->getModuleIdentifier(), M->getContext()); New->setDataLayout(M->getDataLayout()); New->setTargetTriple(M->getTargetTriple()); New->setModuleInlineAsm(M->getModuleInlineAsm()); Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Wed Jul 1 11:58:40 2009 @@ -18,6 +18,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/GlobalVariable.h" #include "llvm/GlobalAlias.h" +#include "llvm/LLVMContext.h" #include "llvm/TypeSymbolTable.h" #include "llvm/ModuleProvider.h" #include "llvm/InlineAsm.h" @@ -38,10 +39,21 @@ } +/*===-- Operations on contexts --------------------------------------------===*/ + +LLVMContextRef LLVMContextCreate() { + return wrap(new LLVMContext()); +} + +void LLVMContextDispose(LLVMContextRef C) { + delete unwrap(C); +} + + /*===-- Operations on modules ---------------------------------------------===*/ -LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID) { - return wrap(new Module(ModuleID)); +LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID, LLVMContextRef C) { + return wrap(new Module(ModuleID, unwrap(C))); } void LLVMDisposeModule(LLVMModuleRef M) { Modified: llvm/trunk/lib/VMCore/Module.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Module.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Module.cpp (original) +++ llvm/trunk/lib/VMCore/Module.cpp Wed Jul 1 11:58:40 2009 @@ -15,6 +15,7 @@ #include "llvm/InstrTypes.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +#include "llvm/LLVMContext.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/LeakDetector.h" @@ -54,8 +55,8 @@ // Primitive Module methods. // -Module::Module(const std::string &MID) - : ModuleID(MID), DataLayout("") { +Module::Module(const std::string &MID, LLVMContext* C) + : Context(C), ModuleID(MID), DataLayout("") { ValSymTab = new ValueSymbolTable(); TypeSymTab = new TypeSymbolTable(); } Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/BugDriver.cpp (original) +++ llvm/trunk/tools/bugpoint/BugDriver.cpp Wed Jul 1 11:58:40 2009 @@ -64,24 +64,24 @@ } BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs, - unsigned timeout, unsigned memlimit) - : ToolName(toolname), ReferenceOutputFile(OutputFile), + unsigned timeout, unsigned memlimit, LLVMContext* ctxt) + : Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile), Program(0), Interpreter(0), SafeInterpreter(0), gcc(0), - run_as_child(as_child), - run_find_bugs(find_bugs), Timeout(timeout), MemoryLimit(memlimit) {} + run_as_child(as_child), run_find_bugs(find_bugs), Timeout(timeout), + MemoryLimit(memlimit) {} /// ParseInputFile - Given a bitcode or assembly input filename, parse and /// return it, or return null if not possible. /// -Module *llvm::ParseInputFile(const std::string &Filename) { +Module *llvm::ParseInputFile(const std::string &Filename, LLVMContext* Ctxt) { std::auto_ptr Buffer(MemoryBuffer::getFileOrSTDIN(Filename)); Module *Result = 0; if (Buffer.get()) - Result = ParseBitcodeFile(Buffer.get()); + Result = ParseBitcodeFile(Buffer.get(), Ctxt); ParseError Err; - if (!Result && !(Result = ParseAssemblyFile(Filename, Err))) { + if (!Result && !(Result = ParseAssemblyFile(Filename, Err, Ctxt))) { Err.PrintError("bugpoint", errs()); Result = 0; } @@ -100,14 +100,14 @@ try { // Load the first input file. - Program = ParseInputFile(Filenames[0]); + Program = ParseInputFile(Filenames[0], Context); if (Program == 0) return true; if (!run_as_child) std::cout << "Read input file : '" << Filenames[0] << "'\n"; for (unsigned i = 1, e = Filenames.size(); i != e; ++i) { - std::auto_ptr M(ParseInputFile(Filenames[i])); + std::auto_ptr M(ParseInputFile(Filenames[i], Context)); if (M.get() == 0) return true; if (!run_as_child) Modified: llvm/trunk/tools/bugpoint/BugDriver.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/BugDriver.h (original) +++ llvm/trunk/tools/bugpoint/BugDriver.h Wed Jul 1 11:58:40 2009 @@ -30,6 +30,7 @@ class BasicBlock; class AbstractInterpreter; class Instruction; +class LLVMContext; class DebugCrashes; @@ -42,6 +43,7 @@ extern bool BugpointIsInterrupted; class BugDriver { + LLVMContext* Context; const std::string ToolName; // Name of bugpoint std::string ReferenceOutputFile; // Name of `good' output file Module *Program; // The raw program, linked together @@ -60,10 +62,12 @@ public: BugDriver(const char *toolname, bool as_child, bool find_bugs, - unsigned timeout, unsigned memlimit); + unsigned timeout, unsigned memlimit, LLVMContext* ctxt); const std::string &getToolName() const { return ToolName; } + LLVMContext* getContext() { return Context; } + // Set up methods... these methods are used to copy information about the // command line arguments into instance variables of BugDriver. // @@ -290,7 +294,7 @@ /// ParseInputFile - Given a bitcode or assembly input filename, parse and /// return it, or return null if not possible. /// -Module *ParseInputFile(const std::string &InputFilename); +Module *ParseInputFile(const std::string &InputFilename, LLVMContext* ctxt); /// getPassesString - Turn a list of passes into a string which indicates the Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original) +++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Wed Jul 1 11:58:40 2009 @@ -73,7 +73,7 @@ PrefixOutput.set(PfxOutput); OrigProgram = BD.Program; - BD.Program = ParseInputFile(PrefixOutput.toString()); + BD.Program = ParseInputFile(PrefixOutput.toString(), BD.getContext()); if (BD.Program == 0) { std::cerr << BD.getToolName() << ": Error reading bitcode file '" << PrefixOutput << "'!\n"; Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original) +++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Wed Jul 1 11:58:40 2009 @@ -112,7 +112,7 @@ // Ok, so now we know that the prefix passes work, try running the suffix // passes on the result of the prefix passes. // - Module *PrefixOutput = ParseInputFile(BitcodeResult); + Module *PrefixOutput = ParseInputFile(BitcodeResult, BD.getContext()); if (PrefixOutput == 0) { std::cerr << BD.getToolName() << ": Error reading bitcode file '" << BitcodeResult << "'!\n"; Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/OptimizerDriver.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp (original) +++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Wed Jul 1 11:58:40 2009 @@ -255,7 +255,7 @@ // Restore the current program. swapProgramIn(OldProgram); - Module *Ret = ParseInputFile(BitcodeResult); + Module *Ret = ParseInputFile(BitcodeResult, Context); if (Ret == 0) { cerr << getToolName() << ": Error reading bitcode file '" << BitcodeResult << "'!\n"; Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original) +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Wed Jul 1 11:58:40 2009 @@ -16,6 +16,7 @@ #include "BugDriver.h" #include "ToolRunner.h" #include "llvm/LinkAllPasses.h" +#include "llvm/LLVMContext.h" #include "llvm/Support/PassNameParser.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" @@ -73,8 +74,9 @@ "llvm.org/cmds/bugpoint.html" " for more information.\n"); sys::SetInterruptFunction(BugpointInterruptFunction); - - BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit); + + LLVMContext Context; + BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit, &Context); if (D.addSources(InputFilenames)) return 1; D.addPasses(PassList.begin(), PassList.end()); Modified: llvm/trunk/tools/llc/llc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llc/llc.cpp (original) +++ llvm/trunk/tools/llc/llc.cpp Wed Jul 1 11:58:40 2009 @@ -22,6 +22,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Transforms/Scalar.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" @@ -212,6 +213,7 @@ int main(int argc, char **argv) { sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n"); @@ -225,7 +227,7 @@ std::auto_ptr Buffer( MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)); if (Buffer.get()) - M.reset(ParseBitcodeFile(Buffer.get(), &ErrorMessage)); + M.reset(ParseBitcodeFile(Buffer.get(), &Context, &ErrorMessage)); if (M.get() == 0) { std::cerr << argv[0] << ": bitcode didn't read correctly.\n"; std::cerr << "Reason: " << ErrorMessage << "\n"; Modified: llvm/trunk/tools/lli/lli.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/lli/lli.cpp (original) +++ llvm/trunk/tools/lli/lli.cpp Wed Jul 1 11:58:40 2009 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/Type.h" @@ -93,6 +94,7 @@ sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); + LLVMContext Context; atexit(do_shutdown); // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm interpreter & dynamic compiler\n"); @@ -104,8 +106,8 @@ // Load the bitcode... std::string ErrorMsg; ModuleProvider *MP = NULL; - if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)) { - MP = getBitcodeModuleProvider(Buffer, &ErrorMsg); + if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)){ + MP = getBitcodeModuleProvider(Buffer, &Context, &ErrorMsg); if (!MP) delete Buffer; } Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original) +++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Wed Jul 1 11:58:40 2009 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Bitcode/Archive.h" #include "llvm/Support/CommandLine.h" @@ -690,6 +691,7 @@ // Print a stack trace if we signal out. sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. // Have the command line options parsed and handle things @@ -717,11 +719,11 @@ // Produce a warning if we should and we're creating the archive if (!Create) std::cerr << argv[0] << ": creating " << ArchivePath.toString() << "\n"; - TheArchive = Archive::CreateEmpty(ArchivePath); + TheArchive = Archive::CreateEmpty(ArchivePath, &Context); TheArchive->writeToDisk(); } else { std::string Error; - TheArchive = Archive::OpenAndLoad(ArchivePath, &Error); + TheArchive = Archive::OpenAndLoad(ArchivePath, &Context, &Error); if (TheArchive == 0) { std::cerr << argv[0] << ": error loading '" << ArchivePath << "': " << Error << "!\n"; Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-as/llvm-as.cpp (original) +++ llvm/trunk/tools/llvm-as/llvm-as.cpp Wed Jul 1 11:58:40 2009 @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Assembly/Parser.h" #include "llvm/Analysis/Verifier.h" @@ -55,6 +56,7 @@ // Print a stack trace if we signal out. sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n"); @@ -63,7 +65,7 @@ try { // Parse the file now... ParseError Err; - std::auto_ptr M(ParseAssemblyFile(InputFilename, Err)); + std::auto_ptr M(ParseAssemblyFile(InputFilename, Err, &Context)); if (M.get() == 0) { Err.PrintError(argv[0], errs()); return 1; Modified: llvm/trunk/tools/llvm-db/CLIDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/CLIDebugger.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/CLIDebugger.cpp (original) +++ llvm/trunk/tools/llvm-db/CLIDebugger.cpp Wed Jul 1 11:58:40 2009 @@ -22,8 +22,9 @@ /// CLIDebugger constructor - This initializes the debugger to its default /// state, and initializes the command table. /// -CLIDebugger::CLIDebugger() - : TheProgramInfo(0), TheRuntimeInfo(0), Prompt("(llvm-db) "), ListSize(10) { +CLIDebugger::CLIDebugger(LLVMContext* ctxt) + : Context(ctxt), TheProgramInfo(0), TheRuntimeInfo(0), + Prompt("(llvm-db) "), ListSize(10) { // Initialize instance variables CurrentFile = 0; LineListedStart = 1; Modified: llvm/trunk/tools/llvm-db/CLIDebugger.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/CLIDebugger.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/CLIDebugger.h (original) +++ llvm/trunk/tools/llvm-db/CLIDebugger.h Wed Jul 1 11:58:40 2009 @@ -24,10 +24,13 @@ class SourceLanguage; class ProgramInfo; class RuntimeInfo; + class LLVMContext; /// CLIDebugger - This class implements the command line interface for the /// LLVM debugger. class CLIDebugger { + LLVMContext* Context; + /// Dbg - The low-level LLVM debugger object that we use to do our dirty /// work. Debugger Dbg; @@ -79,7 +82,7 @@ const SourceLanguage *CurrentLanguage; public: - CLIDebugger(); + CLIDebugger(LLVMContext* ctxt); /// getDebugger - Return the current LLVM debugger implementation being /// used. Modified: llvm/trunk/tools/llvm-db/Commands.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/Commands.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/Commands.cpp (original) +++ llvm/trunk/tools/llvm-db/Commands.cpp Wed Jul 1 11:58:40 2009 @@ -64,7 +64,7 @@ TheProgramInfo = 0; CurrentFile = 0; - Dbg.loadProgram(Program.toString()); + Dbg.loadProgram(Program.toString(), Context); TheProgramInfo = new ProgramInfo(Dbg.getProgram()); } @@ -244,7 +244,7 @@ std::cout << "Unloaded program.\n"; } else { std::cout << "Loading program... " << std::flush; - Dbg.loadProgram(Prog); + Dbg.loadProgram(Prog, Context); assert(Dbg.isProgramLoaded() && "loadProgram succeeded, but not program loaded!"); TheProgramInfo = new ProgramInfo(Dbg.getProgram()); Modified: llvm/trunk/tools/llvm-db/llvm-db.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/llvm-db.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/llvm-db.cpp (original) +++ llvm/trunk/tools/llvm-db/llvm-db.cpp Wed Jul 1 11:58:40 2009 @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "CLIDebugger.h" +#include "llvm/LLVMContext.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" @@ -54,6 +55,7 @@ sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. std::cout << "NOTE: llvm-db is known useless right now.\n"; try { @@ -68,7 +70,7 @@ InputArgs.push_back(InputFile); // Create the CLI debugger... - CLIDebugger D; + CLIDebugger D(&Context); // Initialize the debugger with the command line options we read... Debugger &Dbg = D.getDebugger(); Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original) +++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Wed Jul 1 11:58:40 2009 @@ -16,6 +16,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Bitcode/ReaderWriter.h" @@ -50,6 +51,7 @@ sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. try { cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .ll disassembler\n"); @@ -61,7 +63,7 @@ if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) { - M.reset(ParseBitcodeFile(Buffer, &ErrorMessage)); + M.reset(ParseBitcodeFile(Buffer, &Context, &ErrorMessage)); delete Buffer; } Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original) +++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Wed Jul 1 11:58:40 2009 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Bitcode/ReaderWriter.h" @@ -60,7 +61,8 @@ // Print a stack trace if we signal out. sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); - + + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm extractor\n"); @@ -71,7 +73,7 @@ cerr << argv[0] << ": Error reading file '" + InputFilename + "'\n"; return 1; } else { - M.reset(ParseBitcodeFile(Buffer)); + M.reset(ParseBitcodeFile(Buffer, &Context)); } delete Buffer; Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/llvm-ld.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/llvm-ld.cpp (original) +++ llvm/trunk/tools/llvm-ld/llvm-ld.cpp Wed Jul 1 11:58:40 2009 @@ -22,6 +22,7 @@ #include "llvm/LinkAllVMCore.h" #include "llvm/Linker.h" +#include "llvm/LLVMContext.h" #include "llvm/System/Program.h" #include "llvm/Module.h" #include "llvm/PassManager.h" @@ -505,7 +506,8 @@ // Print a stack trace if we signal out. sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); - + + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. try { // Initial global variable above for convenience printing of program name. @@ -515,7 +517,7 @@ cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); // Construct a Linker (now that Verbose is set) - Linker TheLinker(progname, OutputFilename, Verbose); + Linker TheLinker(progname, OutputFilename, &Context, Verbose); // Keep track of the native link items (versus the bitcode items) Linker::ItemList NativeLinkItems; Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-link/llvm-link.cpp (original) +++ llvm/trunk/tools/llvm-link/llvm-link.cpp Wed Jul 1 11:58:40 2009 @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Linker.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Bitcode/ReaderWriter.h" @@ -47,7 +48,8 @@ // LoadFile - Read the specified bitcode file in and return it. This routine // searches the link path for the specified file to try to find it... // -static inline std::auto_ptr LoadFile(const std::string &FN) { +static inline std::auto_ptr LoadFile(const std::string &FN, + LLVMContext* Context) { sys::Path Filename; if (!Filename.set(FN)) { cerr << "Invalid file name: '" << FN << "'\n"; @@ -62,7 +64,7 @@ const std::string &FNStr = Filename.toString(); if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(FNStr, &ErrorMessage)) { - Result = ParseBitcodeFile(Buffer, &ErrorMessage); + Result = ParseBitcodeFile(Buffer, Context, &ErrorMessage); delete Buffer; } if (Result) return std::auto_ptr(Result); // Load successful! @@ -84,13 +86,14 @@ sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); unsigned BaseArg = 0; std::string ErrorMessage; - std::auto_ptr Composite(LoadFile(InputFilenames[BaseArg])); + std::auto_ptr Composite(LoadFile(InputFilenames[BaseArg], &Context)); if (Composite.get() == 0) { cerr << argv[0] << ": error loading file '" << InputFilenames[BaseArg] << "'\n"; @@ -98,7 +101,7 @@ } for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) { - std::auto_ptr M(LoadFile(InputFilenames[i])); + std::auto_ptr M(LoadFile(InputFilenames[i], &Context)); if (M.get() == 0) { cerr << argv[0] << ": error loading file '" < Modules; Modified: llvm/trunk/tools/llvm-prof/llvm-prof.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-prof/llvm-prof.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-prof/llvm-prof.cpp (original) +++ llvm/trunk/tools/llvm-prof/llvm-prof.cpp Wed Jul 1 11:58:40 2009 @@ -14,6 +14,7 @@ //===----------------------------------------------------------------------===// #include "llvm/InstrTypes.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Assembly/AsmAnnotationWriter.h" #include "llvm/Analysis/ProfileInfoLoader.h" @@ -115,7 +116,8 @@ // Print a stack trace if we signal out. sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); - + + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. try { cl::ParseCommandLineOptions(argc, argv, "llvm profile dump decoder\n"); @@ -125,7 +127,7 @@ Module *M = 0; if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(BitcodeFile, &ErrorMessage)) { - M = ParseBitcodeFile(Buffer, &ErrorMessage); + M = ParseBitcodeFile(Buffer, &Context, &ErrorMessage); delete Buffer; } if (M == 0) { Modified: llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp (original) +++ llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp Wed Jul 1 11:58:40 2009 @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Bitcode/Archive.h" #include "llvm/Support/CommandLine.h" @@ -46,7 +47,8 @@ // Print a stack trace if we signal out. llvm::sys::PrintStackTraceOnErrorSignal(); llvm::PrettyStackTraceProgram X(argc, argv); - + + LLVMContext Context; llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. // Have the command line options parsed and handle things @@ -73,7 +75,7 @@ std::string err_msg; std::auto_ptr - AutoArchive(Archive::OpenAndLoad(ArchivePath,&err_msg)); + AutoArchive(Archive::OpenAndLoad(ArchivePath, &Context, &err_msg)); Archive* TheArchive = AutoArchive.get(); if (!TheArchive) throw err_msg; Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Wed Jul 1 11:58:40 2009 @@ -70,7 +70,8 @@ LTOCodeGenerator::LTOCodeGenerator() - : _linker("LinkTimeOptimizer", "ld-temp.o"), _target(NULL), + : _context(new LLVMContext()), + _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL), _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false), _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC), _nativeObjectFile(NULL), _gccPath(NULL), _assemblerPath(NULL) Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Wed Jul 1 11:58:40 2009 @@ -16,6 +16,7 @@ #define LTO_CODE_GENERATOR_H #include "llvm/Linker.h" +#include "llvm/LLVMContext.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/SmallVector.h" @@ -53,6 +54,7 @@ typedef llvm::StringMap StringSet; + llvm::LLVMContext* _context; llvm::Linker _linker; llvm::TargetMachine* _target; bool _emitDwarfDebugInfo; Modified: llvm/trunk/tools/lto/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Wed Jul 1 11:58:40 2009 @@ -15,6 +15,7 @@ #include "LTOModule.h" #include "llvm/Constants.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/ADT/OwningPtr.h" @@ -67,7 +68,8 @@ // takes ownership of buffer bool LTOModule::isTargetMatch(MemoryBuffer* buffer, const char* triplePrefix) { - OwningPtr mp(getBitcodeModuleProvider(buffer)); + OwningPtr mp(getBitcodeModuleProvider(buffer, + new LLVMContext())); // on success, mp owns buffer and both are deleted at end of this method if ( !mp ) { delete buffer; @@ -84,12 +86,13 @@ { } -LTOModule* LTOModule::makeLTOModule(const char* path, std::string& errMsg) +LTOModule* LTOModule::makeLTOModule(const char* path, LLVMContext* Context, + std::string& errMsg) { OwningPtr buffer(MemoryBuffer::getFile(path, &errMsg)); if ( !buffer ) return NULL; - return makeLTOModule(buffer.get(), errMsg); + return makeLTOModule(buffer.get(), Context, errMsg); } /// makeBuffer - create a MemoryBuffer from a memory range. @@ -109,12 +112,13 @@ LTOModule* LTOModule::makeLTOModule(const void* mem, size_t length, + LLVMContext* Context, std::string& errMsg) { OwningPtr buffer(makeBuffer(mem, length)); if ( !buffer ) return NULL; - return makeLTOModule(buffer.get(), errMsg); + return makeLTOModule(buffer.get(), Context, errMsg); } /// getFeatureString - Return a string listing the features associated with the @@ -136,10 +140,11 @@ return Features.getString(); } -LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer, std::string& errMsg) +LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer, LLVMContext* Context, + std::string& errMsg) { // parse bitcode buffer - OwningPtr m(ParseBitcodeFile(buffer, &errMsg)); + OwningPtr m(ParseBitcodeFile(buffer, Context, &errMsg)); if ( !m ) return NULL; // find machine architecture for this module Modified: llvm/trunk/tools/lto/LTOModule.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.h?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.h (original) +++ llvm/trunk/tools/lto/LTOModule.h Wed Jul 1 11:58:40 2009 @@ -32,6 +32,7 @@ class GlobalValue; class Value; class Function; + class LLVMContext; } @@ -50,9 +51,12 @@ static bool isBitcodeFileForTarget(const char* path, const char* triplePrefix); - static LTOModule* makeLTOModule(const char* path, std::string& errMsg); + static LTOModule* makeLTOModule(const char* path, + llvm::LLVMContext* Context, + std::string& errMsg); static LTOModule* makeLTOModule(const void* mem, size_t length, - std::string& errMsg); + llvm::LLVMContext* Context, + std::string& errMsg); const char* getTargetTriple(); uint32_t getSymbolCount(); @@ -83,10 +87,11 @@ bool objcClassNameFromExpression(llvm::Constant* c, std::string& name); - static bool isTargetMatch(llvm::MemoryBuffer* memBuffer, + static bool isTargetMatch(llvm::MemoryBuffer* memBuffer, const char* triplePrefix); - static LTOModule* makeLTOModule(llvm::MemoryBuffer* buffer, + static LTOModule* makeLTOModule(llvm::MemoryBuffer* buffer, + llvm::LLVMContext* Context, std::string& errMsg); static llvm::MemoryBuffer* makeBuffer(const void* mem, size_t length); Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Wed Jul 1 11:58:40 2009 @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm-c/lto.h" +#include "llvm-c/Core.h" #include "LTOModule.h" #include "LTOCodeGenerator.h" @@ -85,9 +86,10 @@ // loads an object file from disk // returns NULL on error (check lto_get_error_message() for details) // -lto_module_t lto_module_create(const char* path) +lto_module_t lto_module_create(const char* path, LLVMContextRef Ctxt) { - return LTOModule::makeLTOModule(path, sLastErrorString); + return LTOModule::makeLTOModule(path, llvm::unwrap(Ctxt), + sLastErrorString); } @@ -95,9 +97,11 @@ // loads an object file from memory // returns NULL on error (check lto_get_error_message() for details) // -lto_module_t lto_module_create_from_memory(const void* mem, size_t length) +lto_module_t lto_module_create_from_memory(const void* mem, size_t length, + LLVMContextRef Ctxt) { - return LTOModule::makeLTOModule(mem, length, sLastErrorString); + return LTOModule::makeLTOModule(mem, length, llvm::unwrap(Ctxt), + sLastErrorString); } Modified: llvm/trunk/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=74614&r1=74613&r2=74614&view=diff ============================================================================== --- llvm/trunk/tools/opt/opt.cpp (original) +++ llvm/trunk/tools/opt/opt.cpp Wed Jul 1 11:58:40 2009 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" @@ -310,6 +311,7 @@ // int main(int argc, char **argv) { llvm_shutdown_obj X; // Call llvm_shutdown() on exit. + LLVMContext Context; try { cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n"); @@ -325,7 +327,7 @@ std::auto_ptr M; if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) { - M.reset(ParseBitcodeFile(Buffer, &ErrorMessage)); + M.reset(ParseBitcodeFile(Buffer, &Context, &ErrorMessage)); delete Buffer; } From resistor at mac.com Wed Jul 1 12:01:20 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 17:01:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74616 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200907011701.n61H1KLL015335@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 12:01:19 2009 New Revision: 74616 URL: http://llvm.org/viewvc/llvm-project?rev=74616&view=rev Log: Update for LLVMContext+Module change. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=74616&r1=74615&r2=74616&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Jul 1 12:01:19 2009 @@ -25,6 +25,7 @@ #include "llvm-file-ostream.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" @@ -86,6 +87,7 @@ static int flag_no_implicit_float = 0; // Global state for the LLVM backend. +LLVMContext* Context = 0; Module *TheModule = 0; DebugInfo *TheDebugInfo = 0; TargetMachine *TheTarget = 0; @@ -418,7 +420,8 @@ int pseudo_argc = Args.size()-1; cl::ParseCommandLineOptions(pseudo_argc, (char**)&Args[0]); - TheModule = new Module(""); + Context = new LLVMContext(); + TheModule = new Module("", Context); // If the target wants to override the architecture, e.g. turning // powerpc-darwin-... into powerpc64-darwin-... when -m64 is enabled, do so @@ -522,7 +525,7 @@ memcpy((char*)MB->getBufferStart(), Buffer, Size); std::string ErrMsg; - TheModule = ParseBitcodeFile(MB, &ErrMsg); + TheModule = ParseBitcodeFile(MB, Context, &ErrMsg); delete MB; // FIXME - Do not disable debug info while writing pch. From vkutuzov at accesssoftek.com Wed Jul 1 12:04:10 2009 From: vkutuzov at accesssoftek.com (Viktor Kutuzov) Date: Wed, 1 Jul 2009 10:04:10 -0700 Subject: [llvm-commits] [PATCH] Fix for llvm::FindExecutable (fails to find executable if path is provided) References: <54EF3DC75DF14CA69492E01CACA5A320@andreic6e7fe55> <39D1DD86-F51E-4F13-A744-772E494C4691@apple.com> Message-ID: Hi Chris, > Please use sys::Path::isAbsolute to check to see if it is an absolute I didn't want to check if it is an absolute, I wanted to check if there is any directory part (absolute or relative). Is there anything wrong with relative path? It seems the right way to do this would be adding Path::hasDirname() method and use it there instead. What do you think? Best regards, Viktor ----- Original Message ----- From: "Chris Lattner" To: "Commit Messages and Patches for LLVM" Cc: "Viktor Kutuzov" Sent: Wednesday, July 01, 2009 8:44 AM Subject: Re: [llvm-commits] [PATCH] Fix for llvm::FindExecutable (fails to find executable if path is provided) > > On Jun 30, 2009, at 11:52 PM, Viktor Kutuzov wrote: > >> Hello everyone, >> >> The llvm::FindExecutable fails to find a named executible if full >> path is provided. > > Hi Viktor, > > Please use sys::Path::isAbsolute to check to see if it is an absolute > path, this will work on windows as well as unix. Thanks, > > -Chris > >> >> Please find the patch attached. >> >> Best regards, >> Viktor >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From anton at korobeynikov.info Wed Jul 1 12:12:17 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Wed, 1 Jul 2009 21:12:17 +0400 Subject: [llvm-commits] [llvm] r74613 - in /llvm/trunk: lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp test/CodeGen/PowerPC/available-externally.ll In-Reply-To: <200907011654.n61Gs0KM014956@zion.cs.uiuc.edu> References: <200907011654.n61Gs0KM014956@zion.cs.uiuc.edu> Message-ID: Hi, Chris > ? ? ? ? ? if (((GV->isDeclaration() || GV->hasWeakLinkage() || > - ? ? ? ? ? ? ? ?GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) { > + ? ? ? ? ? ? ? ?GV->hasLinkOnceLinkage() || GV->hasCommonLinkage() || > + ? ? ? ? ? ? ? ?GV->hasAvailableExternallyLinkage()))) { linkonce + common + weak can be simplified to isWeakForLinker as I can see... -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From sabre at nondot.org Wed Jul 1 12:16:30 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Jul 2009 17:16:30 -0000 Subject: [llvm-commits] [compiler-rt] r74617 - /compiler-rt/trunk/www/index.html Message-ID: <200907011716.n61HGVbf015804@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 12:16:20 2009 New Revision: 74617 URL: http://llvm.org/viewvc/llvm-project?rev=74617&view=rev Log: add the "get it and get involved" section. Modified: compiler-rt/trunk/www/index.html Modified: compiler-rt/trunk/www/index.html URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/www/index.html?rev=74617&r1=74616&r2=74617&view=diff ============================================================================== --- compiler-rt/trunk/www/index.html (original) +++ compiler-rt/trunk/www/index.html Wed Jul 1 12:16:20 2009 @@ -4,7 +4,7 @@ - "compiler_rt" Runtime Library + "compiler-rt" Runtime Library @@ -12,34 +12,34 @@
    -

    "compiler_rt" Runtime Library

    +

    "compiler-rt" Runtime Library

    -

    The compiler_rt project is a simple library that provides an implementation +

    The compiler-rt project is a simple library that provides an implementation of the low-level target-specific hooks required by code generation and other runtime components. For example, when compiling for a 32-bit target, converting a double to a 64-bit unsigned integer is compiling into a runtime - call to the "__fixunsdfdi" function. The compiler_rt library provides + call to the "__fixunsdfdi" function. The compiler-rt library provides optimized implementations of this and other low-level routines.

    Goals

    -

    Different targets require different routines. The compiler_rt project aims +

    Different targets require different routines. The compiler-rt project aims to implement these routines in both target-independent C form as well as providing heavily optimized assembly versions of the routines in some - cases. It should be very easy to bring compiler_rt to support a new + cases. It should be very easy to bring compiler-rt to support a new target by adding the new routines needed by that target.

    -

    Where it make sense, the compiler_rt project aims to implement interfaces +

    Where it make sense, the compiler-rt project aims to implement interfaces that are drop-in compatible with the libgcc interfaces.

    Features

    -

    The current feature set of compiler_rt is:

    +

    The current feature set of compiler-rt is:

    • Full support for the libgcc interfaces required by these targets: @@ -61,7 +61,24 @@

      Get it and get involved!

      -

      TODO.

      +

      To check out the code, use:

      + +
        +
      • svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
      • +
      • cd compiler-rt
      • +
      • make
      • +
      + +

      Note that the library will probably only build out of the box on Darwin, + but patches to improve portability are definitely welcome.

      + +

      compiler-rt doesn't have its own mailing list, if you have questions please + email the llvmdev mailing + list. Commits to the compiler-rt SVN module are automatically sent to the + llvm-commits + mailing list.

    From resistor at mac.com Wed Jul 1 12:22:38 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 17:22:38 -0000 Subject: [llvm-commits] [llvm] r74618 - /llvm/trunk/lib/VMCore/Type.cpp Message-ID: <200907011722.n61HMdMJ016006@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 12:22:27 2009 New Revision: 74618 URL: http://llvm.org/viewvc/llvm-project?rev=74618&view=rev Log: I give up on trying to use reader/writer locks for recursive type refinement. Use a recursive mutex instead, which will (in theory) generate more contention, but is really a much more natural fit for what's going on during recursive type refinement. Modified: llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=74618&r1=74617&r2=74618&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Wed Jul 1 12:22:27 2009 @@ -43,8 +43,8 @@ // Type Class Implementation //===----------------------------------------------------------------------===// -// Reader/writer lock used for guarding access to the type maps. -static ManagedStatic > TypeMapLock; +// Lock used for guarding access to the type maps. +static ManagedStatic > TypeMapLock; // Recursive lock used for guarding access to AbstractTypeUsers. // NOTE: The true template parameter means this will no-op when we're not in @@ -1006,23 +1006,13 @@ // First, see if the type is already in the table, for which // a reader lock suffices. - TypeMapLock->reader_acquire(); + sys::SmartScopedLock L(&*TypeMapLock); ITy = IntegerTypes->get(IVT); - TypeMapLock->reader_release(); if (!ITy) { - // OK, not in the table, get a writer lock. - sys::SmartScopedWriter Writer(&*TypeMapLock); - ITy = IntegerTypes->get(IVT); - - // We need to _recheck_ the table in case someone - // put it in between when we released the reader lock - // and when we gained the writer lock! - if (!ITy) { - // Value not found. Derive a new type! - ITy = new IntegerType(NumBits); - IntegerTypes->add(IVT, ITy); - } + // Value not found. Derive a new type! + ITy = new IntegerType(NumBits); + IntegerTypes->add(IVT, ITy); } #ifdef DEBUG_MERGE_TYPES DOUT << "Derived new type: " << *ITy << "\n"; @@ -1089,23 +1079,14 @@ FunctionValType VT(ReturnType, Params, isVarArg); FunctionType *FT = 0; - TypeMapLock->reader_acquire(); + sys::SmartScopedLock L(&*TypeMapLock); FT = FunctionTypes->get(VT); - TypeMapLock->reader_release(); if (!FT) { - sys::SmartScopedWriter Writer(&*TypeMapLock); - - // Have to check again here, because it might have - // been inserted between when we release the reader - // lock and when we acquired the writer lock. - FT = FunctionTypes->get(VT); - if (!FT) { - FT = (FunctionType*) operator new(sizeof(FunctionType) + - sizeof(PATypeHandle)*(Params.size()+1)); - new (FT) FunctionType(ReturnType, Params, isVarArg); - FunctionTypes->add(VT, FT); - } + FT = (FunctionType*) operator new(sizeof(FunctionType) + + sizeof(PATypeHandle)*(Params.size()+1)); + new (FT) FunctionType(ReturnType, Params, isVarArg); + FunctionTypes->add(VT, FT); } #ifdef DEBUG_MERGE_TYPES @@ -1148,19 +1129,12 @@ ArrayValType AVT(ElementType, NumElements); ArrayType *AT = 0; - TypeMapLock->reader_acquire(); + sys::SmartScopedLock L(&*TypeMapLock); AT = ArrayTypes->get(AVT); - TypeMapLock->reader_release(); - + if (!AT) { - sys::SmartScopedWriter Writer(&*TypeMapLock); - - // Recheck. Might have changed between release and acquire. - AT = ArrayTypes->get(AVT); - if (!AT) { - // Value not found. Derive a new type! - ArrayTypes->add(AVT, AT = new ArrayType(ElementType, NumElements)); - } + // Value not found. Derive a new type! + ArrayTypes->add(AVT, AT = new ArrayType(ElementType, NumElements)); } #ifdef DEBUG_MERGE_TYPES DOUT << "Derived new type: " << *AT << "\n"; @@ -1214,17 +1188,11 @@ VectorValType PVT(ElementType, NumElements); VectorType *PT = 0; - TypeMapLock->reader_acquire(); + sys::SmartScopedLock L(&*TypeMapLock); PT = VectorTypes->get(PVT); - TypeMapLock->reader_release(); if (!PT) { - sys::SmartScopedWriter Writer(&*TypeMapLock); - PT = VectorTypes->get(PVT); - // Recheck. Might have changed between release and acquire. - if (!PT) { - VectorTypes->add(PVT, PT = new VectorType(ElementType, NumElements)); - } + VectorTypes->add(PVT, PT = new VectorType(ElementType, NumElements)); } #ifdef DEBUG_MERGE_TYPES DOUT << "Derived new type: " << *PT << "\n"; @@ -1282,21 +1250,15 @@ StructValType STV(ETypes, isPacked); StructType *ST = 0; - TypeMapLock->reader_acquire(); + sys::SmartScopedLock L(&*TypeMapLock); ST = StructTypes->get(STV); - TypeMapLock->reader_release(); if (!ST) { - sys::SmartScopedWriter Writer(&*TypeMapLock); - ST = StructTypes->get(STV); - // Recheck. Might have changed between release and acquire. - if (!ST) { - // Value not found. Derive a new type! - ST = (StructType*) operator new(sizeof(StructType) + - sizeof(PATypeHandle) * ETypes.size()); - new (ST) StructType(ETypes, isPacked); - StructTypes->add(STV, ST); - } + // Value not found. Derive a new type! + ST = (StructType*) operator new(sizeof(StructType) + + sizeof(PATypeHandle) * ETypes.size()); + new (ST) StructType(ETypes, isPacked); + StructTypes->add(STV, ST); } #ifdef DEBUG_MERGE_TYPES DOUT << "Derived new type: " << *ST << "\n"; @@ -1367,18 +1329,12 @@ PointerType *PT = 0; - TypeMapLock->reader_acquire(); + sys::SmartScopedLock L(&*TypeMapLock); PT = PointerTypes->get(PVT); - TypeMapLock->reader_release(); if (!PT) { - sys::SmartScopedWriter Writer(&*TypeMapLock); - PT = PointerTypes->get(PVT); - // Recheck. Might have changed between release and acquire. - if (!PT) { - // Value not found. Derive a new type! - PointerTypes->add(PVT, PT = new PointerType(ValueType, AddressSpace)); - } + // Value not found. Derive a new type! + PointerTypes->add(PVT, PT = new PointerType(ValueType, AddressSpace)); } #ifdef DEBUG_MERGE_TYPES DOUT << "Derived new type: " << *PT << "\n"; @@ -1532,7 +1488,7 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) { // All recursive calls will go through unlockedRefineAbstractTypeTo, // to avoid deadlock problems. - sys::SmartScopedWriter Writer(&*TypeMapLock); + sys::SmartScopedLock L(&*TypeMapLock); unlockedRefineAbstractTypeTo(NewType); } From resistor at mac.com Wed Jul 1 12:24:48 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 10:24:48 -0700 Subject: [llvm-commits] [llvm] r74618 - /llvm/trunk/lib/VMCore/Type.cpp In-Reply-To: <200907011722.n61HMdMJ016006@zion.cs.uiuc.edu> References: <200907011722.n61HMdMJ016006@zion.cs.uiuc.edu> Message-ID: <30FF7597-06AC-41B2-987E-3A747B155D44@mac.com> This fixes PR4486. --Owen On Jul 1, 2009, at 10:22 AM, Owen Anderson wrote: > Author: resistor > Date: Wed Jul 1 12:22:27 2009 > New Revision: 74618 > > URL: http://llvm.org/viewvc/llvm-project?rev=74618&view=rev > Log: > I give up on trying to use reader/writer locks for recursive type > refinement. Use a recursive mutex instead, which will (in theory) > generate more contention, but is really > a much more natural fit for what's going on during recursive type > refinement. > > Modified: > llvm/trunk/lib/VMCore/Type.cpp > > Modified: llvm/trunk/lib/VMCore/Type.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=74618&r1=74617&r2=74618&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Type.cpp (original) > +++ llvm/trunk/lib/VMCore/Type.cpp Wed Jul 1 12:22:27 2009 > @@ -43,8 +43,8 @@ > // Type Class Implementation > // > = > = > = > ----------------------------------------------------------------------= > ==// > > -// Reader/writer lock used for guarding access to the type maps. > -static ManagedStatic > TypeMapLock; > +// Lock used for guarding access to the type maps. > +static ManagedStatic > TypeMapLock; > > // Recursive lock used for guarding access to AbstractTypeUsers. > // NOTE: The true template parameter means this will no-op when > we're not in > @@ -1006,23 +1006,13 @@ > > // First, see if the type is already in the table, for which > // a reader lock suffices. > - TypeMapLock->reader_acquire(); > + sys::SmartScopedLock L(&*TypeMapLock); > ITy = IntegerTypes->get(IVT); > - TypeMapLock->reader_release(); > > if (!ITy) { > - // OK, not in the table, get a writer lock. > - sys::SmartScopedWriter Writer(&*TypeMapLock); > - ITy = IntegerTypes->get(IVT); > - > - // We need to _recheck_ the table in case someone > - // put it in between when we released the reader lock > - // and when we gained the writer lock! > - if (!ITy) { > - // Value not found. Derive a new type! > - ITy = new IntegerType(NumBits); > - IntegerTypes->add(IVT, ITy); > - } > + // Value not found. Derive a new type! > + ITy = new IntegerType(NumBits); > + IntegerTypes->add(IVT, ITy); > } > #ifdef DEBUG_MERGE_TYPES > DOUT << "Derived new type: " << *ITy << "\n"; > @@ -1089,23 +1079,14 @@ > FunctionValType VT(ReturnType, Params, isVarArg); > FunctionType *FT = 0; > > - TypeMapLock->reader_acquire(); > + sys::SmartScopedLock L(&*TypeMapLock); > FT = FunctionTypes->get(VT); > - TypeMapLock->reader_release(); > > if (!FT) { > - sys::SmartScopedWriter Writer(&*TypeMapLock); > - > - // Have to check again here, because it might have > - // been inserted between when we release the reader > - // lock and when we acquired the writer lock. > - FT = FunctionTypes->get(VT); > - if (!FT) { > - FT = (FunctionType*) operator new(sizeof(FunctionType) + > - sizeof(PATypeHandle)* > (Params.size()+1)); > - new (FT) FunctionType(ReturnType, Params, isVarArg); > - FunctionTypes->add(VT, FT); > - } > + FT = (FunctionType*) operator new(sizeof(FunctionType) + > + sizeof(PATypeHandle)* > (Params.size()+1)); > + new (FT) FunctionType(ReturnType, Params, isVarArg); > + FunctionTypes->add(VT, FT); > } > > #ifdef DEBUG_MERGE_TYPES > @@ -1148,19 +1129,12 @@ > ArrayValType AVT(ElementType, NumElements); > ArrayType *AT = 0; > > - TypeMapLock->reader_acquire(); > + sys::SmartScopedLock L(&*TypeMapLock); > AT = ArrayTypes->get(AVT); > - TypeMapLock->reader_release(); > - > + > if (!AT) { > - sys::SmartScopedWriter Writer(&*TypeMapLock); > - > - // Recheck. Might have changed between release and acquire. > - AT = ArrayTypes->get(AVT); > - if (!AT) { > - // Value not found. Derive a new type! > - ArrayTypes->add(AVT, AT = new ArrayType(ElementType, > NumElements)); > - } > + // Value not found. Derive a new type! > + ArrayTypes->add(AVT, AT = new ArrayType(ElementType, > NumElements)); > } > #ifdef DEBUG_MERGE_TYPES > DOUT << "Derived new type: " << *AT << "\n"; > @@ -1214,17 +1188,11 @@ > VectorValType PVT(ElementType, NumElements); > VectorType *PT = 0; > > - TypeMapLock->reader_acquire(); > + sys::SmartScopedLock L(&*TypeMapLock); > PT = VectorTypes->get(PVT); > - TypeMapLock->reader_release(); > > if (!PT) { > - sys::SmartScopedWriter Writer(&*TypeMapLock); > - PT = VectorTypes->get(PVT); > - // Recheck. Might have changed between release and acquire. > - if (!PT) { > - VectorTypes->add(PVT, PT = new VectorType(ElementType, > NumElements)); > - } > + VectorTypes->add(PVT, PT = new VectorType(ElementType, > NumElements)); > } > #ifdef DEBUG_MERGE_TYPES > DOUT << "Derived new type: " << *PT << "\n"; > @@ -1282,21 +1250,15 @@ > StructValType STV(ETypes, isPacked); > StructType *ST = 0; > > - TypeMapLock->reader_acquire(); > + sys::SmartScopedLock L(&*TypeMapLock); > ST = StructTypes->get(STV); > - TypeMapLock->reader_release(); > > if (!ST) { > - sys::SmartScopedWriter Writer(&*TypeMapLock); > - ST = StructTypes->get(STV); > - // Recheck. Might have changed between release and acquire. > - if (!ST) { > - // Value not found. Derive a new type! > - ST = (StructType*) operator new(sizeof(StructType) + > - sizeof(PATypeHandle) * > ETypes.size()); > - new (ST) StructType(ETypes, isPacked); > - StructTypes->add(STV, ST); > - } > + // Value not found. Derive a new type! > + ST = (StructType*) operator new(sizeof(StructType) + > + sizeof(PATypeHandle) * > ETypes.size()); > + new (ST) StructType(ETypes, isPacked); > + StructTypes->add(STV, ST); > } > #ifdef DEBUG_MERGE_TYPES > DOUT << "Derived new type: " << *ST << "\n"; > @@ -1367,18 +1329,12 @@ > > PointerType *PT = 0; > > - TypeMapLock->reader_acquire(); > + sys::SmartScopedLock L(&*TypeMapLock); > PT = PointerTypes->get(PVT); > - TypeMapLock->reader_release(); > > if (!PT) { > - sys::SmartScopedWriter Writer(&*TypeMapLock); > - PT = PointerTypes->get(PVT); > - // Recheck. Might have changed between release and acquire. > - if (!PT) { > - // Value not found. Derive a new type! > - PointerTypes->add(PVT, PT = new PointerType(ValueType, > AddressSpace)); > - } > + // Value not found. Derive a new type! > + PointerTypes->add(PVT, PT = new PointerType(ValueType, > AddressSpace)); > } > #ifdef DEBUG_MERGE_TYPES > DOUT << "Derived new type: " << *PT << "\n"; > @@ -1532,7 +1488,7 @@ > void DerivedType::refineAbstractTypeTo(const Type *NewType) { > // All recursive calls will go through unlockedRefineAbstractTypeTo, > // to avoid deadlock problems. > - sys::SmartScopedWriter Writer(&*TypeMapLock); > + sys::SmartScopedLock L(&*TypeMapLock); > unlockedRefineAbstractTypeTo(NewType); > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Wed Jul 1 12:29:12 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 1 Jul 2009 10:29:12 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <4A4B4E90.4020200@free.fr> References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> <4A4B4E90.4020200@free.fr> Message-ID: <02DBC449-9304-4C0E-B675-03BFC0E5478E@apple.com> On Jul 1, 2009, at 4:54 AMPDT, Duncan Sands wrote: > Hi Dale, > >>>> It's not that big of a deal, but please use SmallVector or >>>> something instead of alloca. SmallVector works when "N" is more >>>> than >>>> 4 by going to the heap so you won't run out of stack space for >>>> large >>>> N, and is more portable. >>> I am not a big lover of alloca, but it was used several places in >>> this >>> code before I started working on it so I don't think portability can >>> be a problem, and the numbers involved cannot be big enough to run >>> out >>> of stack space. >> >> Ok, works for me. Please don't use it in normal llvm code though, >> llvm-gcc is fine. > > it was used in two places in the llvm parts of llvm-gcc before. Since > the llvm style is to use SmallVector, can you please modify all places > to use SmallVector instead of alloca. No, this code is part of gcc, so gcc style should be OK; the llvm* files are a mix of the styles as it is. Besides, I consider worrying about this a complete waste of time (as a corollary, however, I never object to other people's stylistic changes). From mai4 at uiuc.edu Wed Jul 1 12:36:36 2009 From: mai4 at uiuc.edu (Haohui Mai) Date: Wed, 01 Jul 2009 17:36:36 -0000 Subject: [llvm-commits] [poolalloc] r74619 - /poolalloc/trunk/tools/Pa/pa.cpp Message-ID: <200907011736.n61HaaQ8016462@zion.cs.uiuc.edu> Author: mai4 Date: Wed Jul 1 12:36:32 2009 New Revision: 74619 URL: http://llvm.org/viewvc/llvm-project?rev=74619&view=rev Log: Fix DSA to make it compatible with trunk LLVM API Modified: poolalloc/trunk/tools/Pa/pa.cpp Modified: poolalloc/trunk/tools/Pa/pa.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/tools/Pa/pa.cpp?rev=74619&r1=74618&r2=74619&view=diff ============================================================================== --- poolalloc/trunk/tools/Pa/pa.cpp (original) +++ poolalloc/trunk/tools/Pa/pa.cpp Wed Jul 1 12:36:32 2009 @@ -14,6 +14,7 @@ //===--------------------------------------------------------------------===// #include "llvm/Module.h" +#include "llvm/LLVMContext.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/PassManager.h" #include "llvm/Pass.h" @@ -68,6 +69,7 @@ int main(int argc, char **argv) { std::string mt; std::string & msg = mt; + LLVMContext Context; try { cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n"); sys::PrintStackTraceOnErrorSignal(); @@ -77,7 +79,7 @@ std::string ErrorMessage; if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) { - M.reset(ParseBitcodeFile(Buffer, &ErrorMessage)); + M.reset(ParseBitcodeFile(Buffer, &Context, &ErrorMessage)); delete Buffer; } From jyasskin at google.com Wed Jul 1 12:38:44 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Wed, 1 Jul 2009 10:38:44 -0700 Subject: [llvm-commits] Adding a portable strerror*() wrapper, llvm::sys::StrError() In-Reply-To: <7BBC8FF7-0F70-449A-BECD-BC10F92065F9@apple.com> References: <7BBC8FF7-0F70-449A-BECD-BC10F92065F9@apple.com> Message-ID: On Tue, Jun 30, 2009 at 9:30 PM, Chris Lattner wrote: > > On Jun 29, 2009, at 10:52 AM, Jeffrey Yasskin wrote: > >> My oprofile patch calls some functions that report errors through >> errno, and since strerror_r changes its behavior depending on >> GNU_SOURCE and other #defines, I figured it would be nice to have a >> portable wrapper in llvm/System/Errno.h. I included the windows >> version, strerror_s, even though I can't test it. >> >> This won't do quite the right thing on cmake builds--although it will >> run successfully--since cmake doesn't define HAVE_STRERROR*. >> >> I wasn't sure quite what to do with MakeErrStr. I'd be perfectly happy >> with that as the interface in Errno.h, but it does different things on >> Windows and Unix, and I didn't want a public function to be ambiguous >> like that. > > Seems pretty reasonable for me. ?If you think it's ok, please commit. > Please commit any autoconf regenerations as a separate (second) patch > though. Will do, thanks! I found cmake/config-ix.cmake, which appears to be the right place to add lines like check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) so cmake now handles this correctly too. From clattner at apple.com Wed Jul 1 12:47:08 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 10:47:08 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <02DBC449-9304-4C0E-B675-03BFC0E5478E@apple.com> References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> <4A4B4E90.4020200@free.fr> <02DBC449-9304-4C0E-B675-03BFC0E5478E@apple.com> Message-ID: On Jul 1, 2009, at 10:29 AM, Dale Johannesen wrote: >>> >>> Ok, works for me. Please don't use it in normal llvm code though, >>> llvm-gcc is fine. >> >> it was used in two places in the llvm parts of llvm-gcc before. >> Since >> the llvm style is to use SmallVector, can you please modify all >> places >> to use SmallVector instead of alloca. > > No, this code is part of gcc, so gcc style should be OK; the llvm* > files are a mix of the styles as it is. Besides, I consider worrying > about this a complete waste of time (as a corollary, however, I never > object to other people's stylistic changes). Duncan is the code owner of llvm-gcc, so if he strongly prefers it one way or the other, it's his call :-). Duncan? -Chris From brukman+llvm at gmail.com Wed Jul 1 12:52:04 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Wed, 01 Jul 2009 17:52:04 -0000 Subject: [llvm-commits] [llvm] r74620 - /llvm/trunk/include/llvm/Analysis/IVUsers.h Message-ID: <200907011752.n61Hq54R017511@zion.cs.uiuc.edu> Author: brukman Date: Wed Jul 1 12:51:56 2009 New Revision: 74620 URL: http://llvm.org/viewvc/llvm-project?rev=74620&view=rev Log: Use correct format for LLVM header #includes. Modified: llvm/trunk/include/llvm/Analysis/IVUsers.h Modified: llvm/trunk/include/llvm/Analysis/IVUsers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IVUsers.h?rev=74620&r1=74619&r2=74620&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/IVUsers.h (original) +++ llvm/trunk/include/llvm/Analysis/IVUsers.h Wed Jul 1 12:51:56 2009 @@ -17,7 +17,7 @@ #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" -#include +#include "llvm/ADT/SmallVector.h" #include namespace llvm { From dalej at apple.com Wed Jul 1 12:53:12 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 1 Jul 2009 10:53:12 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> <4A4B4E90.4020200@free.fr> <02DBC449-9304-4C0E-B675-03BFC0E5478E@apple.com> Message-ID: On Jul 1, 2009, at 10:47 AMPDT, Chris Lattner wrote: > > On Jul 1, 2009, at 10:29 AM, Dale Johannesen wrote: > >>>> >>>> Ok, works for me. Please don't use it in normal llvm code though, >>>> llvm-gcc is fine. >>> >>> it was used in two places in the llvm parts of llvm-gcc before. >>> Since >>> the llvm style is to use SmallVector, can you please modify all >>> places >>> to use SmallVector instead of alloca. >> >> No, this code is part of gcc, so gcc style should be OK; the llvm* >> files are a mix of the styles as it is. Besides, I consider worrying >> about this a complete waste of time (as a corollary, however, I never >> object to other people's stylistic changes). > > Duncan is the code owner of llvm-gcc, so if he strongly prefers it one > way or the other, it's his call :-). Duncan? Ah, I didn't realize you considered him the owner. I think he made his opinion clear... From jyasskin at google.com Wed Jul 1 13:11:23 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Wed, 01 Jul 2009 18:11:23 -0000 Subject: [llvm-commits] [llvm] r74621 - in /llvm/trunk: autoconf/configure.ac cmake/config-ix.cmake include/llvm/Config/config.h.cmake include/llvm/System/Errno.h lib/System/CMakeLists.txt lib/System/Errno.cpp lib/System/Unix/Unix.h tools/gold/gold-plugin.cpp Message-ID: <200907011811.n61IBOLZ018185@zion.cs.uiuc.edu> Author: jyasskin Date: Wed Jul 1 13:11:20 2009 New Revision: 74621 URL: http://llvm.org/viewvc/llvm-project?rev=74621&view=rev Log: Add a portable strerror*() wrapper, llvm::sys::StrError(). This includes the Windows variant, strerror_s, but I couldn't test that. I'll update configure and config.h.in in a subsequent patch. Added: llvm/trunk/include/llvm/System/Errno.h llvm/trunk/lib/System/Errno.cpp Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/cmake/config-ix.cmake llvm/trunk/include/llvm/Config/config.h.cmake llvm/trunk/lib/System/CMakeLists.txt llvm/trunk/lib/System/Unix/Unix.h llvm/trunk/tools/gold/gold-plugin.cpp Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=74621&r1=74620&r2=74621&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Wed Jul 1 13:11:20 2009 @@ -914,7 +914,8 @@ AC_CHECK_FUNCS([powf fmodf strtof round ]) AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) -AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup strerror strerror_r ]) +AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup ]) +AC_CHECK_FUNCS([strerror strerror_r strerror_s ]) AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp]) AC_C_PRINTF_A Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=74621&r1=74620&r2=74621&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Wed Jul 1 13:11:20 2009 @@ -67,6 +67,9 @@ HAVE_MALLOC_ZONE_STATISTICS) check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) +check_symbol_exists(strerror string.h HAVE_STRERROR) +check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) +check_symbol_exists(strerror_s string.h HAVE_STRERROR_S) check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) if( LLVM_USING_GLIBC ) Modified: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=74621&r1=74620&r2=74621&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/config.h.cmake Wed Jul 1 13:11:20 2009 @@ -364,10 +364,13 @@ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR +#cmakedefine HAVE_STRERROR /* Define to 1 if you have the `strerror_r' function. */ -#undef HAVE_STRERROR_R +#cmakedefine HAVE_STRERROR_R + +/* Define to 1 if you have the `strerror_s' function. */ +#cmakedefine HAVE_STRERROR_S /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H Added: llvm/trunk/include/llvm/System/Errno.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Errno.h?rev=74621&view=auto ============================================================================== --- llvm/trunk/include/llvm/System/Errno.h (added) +++ llvm/trunk/include/llvm/System/Errno.h Wed Jul 1 13:11:20 2009 @@ -0,0 +1,34 @@ +//===- llvm/System/Errno.h - Portable+convenient errno handling -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares some portable and convenient functions to deal with errno. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SYSTEM_ERRNO_H +#define LLVM_SYSTEM_ERRNO_H + +#include + +namespace llvm { +namespace sys { + +/// Returns a string representation of the errno value, using whatever +/// thread-safe variant of strerror() is available. Be sure to call this +/// immediately after the function that set errno, or errno may have been +/// overwritten by an intervening call. +std::string StrError(); + +/// Like the no-argument version above, but uses \p errnum instead of errno. +std::string StrError(int errnum); + +} // namespace sys +} // namespace llvm + +#endif // LLVM_SYSTEM_ERRNO_H Modified: llvm/trunk/lib/System/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/CMakeLists.txt?rev=74621&r1=74620&r2=74621&view=diff ============================================================================== --- llvm/trunk/lib/System/CMakeLists.txt (original) +++ llvm/trunk/lib/System/CMakeLists.txt Wed Jul 1 13:11:20 2009 @@ -3,6 +3,7 @@ Atomic.cpp Disassembler.cpp DynamicLibrary.cpp + Errno.cpp Host.cpp IncludeFile.cpp Memory.cpp Added: llvm/trunk/lib/System/Errno.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Errno.cpp?rev=74621&view=auto ============================================================================== --- llvm/trunk/lib/System/Errno.cpp (added) +++ llvm/trunk/lib/System/Errno.cpp Wed Jul 1 13:11:20 2009 @@ -0,0 +1,71 @@ +//===- Errno.cpp - errno support --------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the errno wrappers. +// +//===----------------------------------------------------------------------===// + +#include "llvm/System/Errno.h" +#include "llvm/Config/config.h" // Get autoconf configuration settings + +#if HAVE_STRING_H +#include + +//===----------------------------------------------------------------------===// +//=== WARNING: Implementation here must contain only TRULY operating system +//=== independent code. +//===----------------------------------------------------------------------===// + +namespace llvm { +namespace sys { + +#if HAVE_ERRNO_H +#include +std::string StrError() { + return StrError(errno); +} +#endif // HAVE_ERRNO_H + +std::string StrError(int errnum) { + const int MaxErrStrLen = 2000; + char buffer[MaxErrStrLen]; + buffer[0] = '\0'; + char* str = buffer; +#ifdef HAVE_STRERROR_R + // strerror_r is thread-safe. + if (errnum) +# if defined(__GLIBC__) && defined(_GNU_SOURCE) + // glibc defines its own incompatible version of strerror_r + // which may not use the buffer supplied. + str = strerror_r(errnum,buffer,MaxErrStrLen-1); +# else + strerror_r(errnum,buffer,MaxErrStrLen-1); +# endif +#elif HAVE_STRERROR_S // Windows. + if (errnum) + strerror_s(buffer, errnum); +#elif HAVE_STRERROR + // Copy the thread un-safe result of strerror into + // the buffer as fast as possible to minimize impact + // of collision of strerror in multiple threads. + if (errnum) + strncpy(buffer,strerror(errnum),MaxErrStrLen-1); + buffer[MaxErrStrLen-1] = '\0'; +#else + // Strange that this system doesn't even have strerror + // but, oh well, just use a generic message + sprintf(buffer, "Error #%d", errnum); +#endif + return str; +} + +} // namespace sys +} // namespace llvm + +#endif // HAVE_STRING_H Modified: llvm/trunk/lib/System/Unix/Unix.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Unix.h?rev=74621&r1=74620&r2=74621&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Unix.h (original) +++ llvm/trunk/lib/System/Unix/Unix.h Wed Jul 1 13:11:20 2009 @@ -20,6 +20,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Config/config.h" // Get autoconf configuration settings +#include "llvm/System/Errno.h" #include #include #include @@ -77,34 +78,9 @@ std::string* ErrMsg, const std::string& prefix, int errnum = -1) { if (!ErrMsg) return true; - char buffer[MAXPATHLEN]; - buffer[0] = 0; - char* str = buffer; if (errnum == -1) errnum = errno; -#ifdef HAVE_STRERROR_R - // strerror_r is thread-safe. - if (errnum) -# if defined(__GLIBC__) && defined(_GNU_SOURCE) - // glibc defines its own incompatible version of strerror_r - // which may not use the buffer supplied. - str = strerror_r(errnum,buffer,MAXPATHLEN-1); -# else - strerror_r(errnum,buffer,MAXPATHLEN-1); -# endif -#elif HAVE_STRERROR - // Copy the thread un-safe result of strerror into - // the buffer as fast as possible to minimize impact - // of collision of strerror in multiple threads. - if (errnum) - strncpy(buffer,strerror(errnum),MAXPATHLEN-1); - buffer[MAXPATHLEN-1] = 0; -#else - // Strange that this system doesn't even have strerror - // but, oh well, just use a generic message - sprintf(buffer, "Error #%d", errnum); -#endif - *ErrMsg = prefix + ": " + str; + *ErrMsg = prefix + ": " + llvm::sys::StrError(errnum); return true; } Modified: llvm/trunk/tools/gold/gold-plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=74621&r1=74620&r2=74621&view=diff ============================================================================== --- llvm/trunk/tools/gold/gold-plugin.cpp (original) +++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Jul 1 13:11:20 2009 @@ -17,6 +17,7 @@ #include "llvm-c/lto.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/System/Errno.h" #include "llvm/System/Path.h" #include "llvm/System/Program.h" @@ -183,7 +184,7 @@ (*message)(LDPL_ERROR, "Failed to seek to archive member of %s at offset %d: %s\n", file->name, - file->offset, strerror(errno)); + file->offset, sys::StrError(errno).c_str()); return LDPS_ERR; } buf = malloc(file->filesize); @@ -198,7 +199,7 @@ "Failed to read archive member of %s at offset %d: %s\n", file->name, file->offset, - strerror(errno)); + sys::StrError(errno).c_str()); free(buf); return LDPS_ERR; } From resistor at mac.com Wed Jul 1 13:14:20 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 18:14:20 -0000 Subject: [llvm-commits] [llvm] r74622 - in /llvm/trunk/unittests: ExecutionEngine/JIT/JITEventListenerTest.cpp VMCore/PassManagerTest.cpp Message-ID: <200907011814.n61IEL4R018291@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 13:14:20 2009 New Revision: 74622 URL: http://llvm.org/viewvc/llvm-project?rev=74622&view=rev Log: Fix unit tests for LLVMContext+Module. Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp llvm/trunk/unittests/VMCore/PassManagerTest.cpp Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp?rev=74622&r1=74621&r2=74622&view=diff ============================================================================== --- llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp (original) +++ llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp Wed Jul 1 13:14:20 2009 @@ -9,6 +9,7 @@ #include "llvm/ExecutionEngine/JITEventListener.h" +#include "llvm/LLVMContext.h" #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" @@ -64,7 +65,7 @@ class JITEventListenerTest : public testing::Test { protected: JITEventListenerTest() - : M(new Module("module")), + : M(new Module("module", new LLVMContext())), EE(ExecutionEngine::createJIT(new ExistingModuleProvider(M))) { } Modified: llvm/trunk/unittests/VMCore/PassManagerTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/PassManagerTest.cpp?rev=74622&r1=74621&r2=74622&view=diff ============================================================================== --- llvm/trunk/unittests/VMCore/PassManagerTest.cpp (original) +++ llvm/trunk/unittests/VMCore/PassManagerTest.cpp Wed Jul 1 13:14:20 2009 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Module.h" +#include "llvm/LLVMContext.h" #include "llvm/PassManager.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Pass.h" @@ -271,7 +272,7 @@ char OnTheFlyTest::ID=0; TEST(PassManager, RunOnce) { - Module M("test-once"); + Module M("test-once", new LLVMContext()); struct ModuleNDNM *mNDNM = new ModuleNDNM(); struct ModuleDNM *mDNM = new ModuleDNM(); struct ModuleNDM *mNDM = new ModuleNDM(); @@ -295,7 +296,7 @@ } TEST(PassManager, ReRun) { - Module M("test-rerun"); + Module M("test-rerun", new LLVMContext()); struct ModuleNDNM *mNDNM = new ModuleNDNM(); struct ModuleDNM *mDNM = new ModuleDNM(); struct ModuleNDM *mNDM = new ModuleNDM(); @@ -386,7 +387,7 @@ Module* makeLLVMModule() { // Module Construction - Module* mod = new Module("test-mem"); + Module* mod = new Module("test-mem", new LLVMContext()); mod->setDataLayout("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" "i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-" "a0:0:64-s0:64:64-f80:128:128"); From stuart at apple.com Wed Jul 1 13:21:26 2009 From: stuart at apple.com (Stuart Hastings) Date: Wed, 1 Jul 2009 11:21:26 -0700 Subject: [llvm-commits] [llvm] r74614 - in /llvm/trunk: examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/Kaleidoscope/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/Debugger/ include/llvm/Transforms/Utils/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Debugger/ lib/Linker/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llc/ tools/lli/ tools/llvm-ar/ tools/llvm-as/ tools/llvm-db/ tools/llvm-dis/ tools/llvm-extr... In-Reply-To: <200907011658.n61GwkLA015181@zion.cs.uiuc.edu> References: <200907011658.n61GwkLA015181@zion.cs.uiuc.edu> Message-ID: <3CC01F2B-F558-4CF7-84FE-ED9231BAA66D@apple.com> Owen, I was running an Apple-Style(tm) build of LLVM-GCC and got this: /Developer/usr/local/include/llvm/Bitcode/ReaderWriter.h: In function 'void dummy_function()': /Developer/usr/local/include/llvm/Bitcode/ReaderWriter.h:42: error: too few arguments to function 'llvm::Module* llvm::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMC\ ontext*, std::string*)' Could this be related to your change^H^H^H^H^H^Himprovement to ReaderWriter.h ? stuart On Jul 1, 2009, at 9:58 AM, Owen Anderson wrote: > Author: resistor > Date: Wed Jul 1 11:58:40 2009 > New Revision: 74614 > > URL: http://llvm.org/viewvc/llvm-project?rev=74614&view=rev > Log: > Add a pointer to the owning LLVMContext to Module. This requires > threading LLVMContext through a lot > of the bitcode reader and ASM parser APIs, as well as supporting it > in all of the tools. > > Patches for Clang and LLVM-GCC to follow. > > Modified: > llvm/trunk/examples/BrainF/BrainF.cpp > llvm/trunk/examples/BrainF/BrainF.h > llvm/trunk/examples/BrainF/BrainFDriver.cpp > llvm/trunk/examples/Fibonacci/fibonacci.cpp > llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp > llvm/trunk/examples/Kaleidoscope/toy.cpp > llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp > llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp > llvm/trunk/include/llvm-c/BitReader.h > llvm/trunk/include/llvm-c/Core.h > llvm/trunk/include/llvm/Assembly/Parser.h > llvm/trunk/include/llvm/Bitcode/Archive.h > llvm/trunk/include/llvm/Bitcode/ReaderWriter.h > llvm/trunk/include/llvm/Debugger/Debugger.h > llvm/trunk/include/llvm/LinkAllVMCore.h > llvm/trunk/include/llvm/Linker.h > llvm/trunk/include/llvm/Module.h > llvm/trunk/include/llvm/Transforms/Utils/Cloning.h > llvm/trunk/lib/Archive/Archive.cpp > llvm/trunk/lib/Archive/ArchiveInternals.h > llvm/trunk/lib/Archive/ArchiveReader.cpp > llvm/trunk/lib/Archive/ArchiveWriter.cpp > llvm/trunk/lib/AsmParser/Parser.cpp > llvm/trunk/lib/Bitcode/Reader/BitReader.cpp > llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp > llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h > llvm/trunk/lib/Debugger/Debugger.cpp > llvm/trunk/lib/Linker/LinkArchives.cpp > llvm/trunk/lib/Linker/LinkItems.cpp > llvm/trunk/lib/Linker/Linker.cpp > llvm/trunk/lib/Transforms/Utils/CloneModule.cpp > llvm/trunk/lib/VMCore/Core.cpp > llvm/trunk/lib/VMCore/Module.cpp > llvm/trunk/tools/bugpoint/BugDriver.cpp > llvm/trunk/tools/bugpoint/BugDriver.h > llvm/trunk/tools/bugpoint/CrashDebugger.cpp > llvm/trunk/tools/bugpoint/Miscompilation.cpp > llvm/trunk/tools/bugpoint/OptimizerDriver.cpp > llvm/trunk/tools/bugpoint/bugpoint.cpp > llvm/trunk/tools/llc/llc.cpp > llvm/trunk/tools/lli/lli.cpp > llvm/trunk/tools/llvm-ar/llvm-ar.cpp > llvm/trunk/tools/llvm-as/llvm-as.cpp > llvm/trunk/tools/llvm-db/CLIDebugger.cpp > llvm/trunk/tools/llvm-db/CLIDebugger.h > llvm/trunk/tools/llvm-db/Commands.cpp > llvm/trunk/tools/llvm-db/llvm-db.cpp > llvm/trunk/tools/llvm-dis/llvm-dis.cpp > llvm/trunk/tools/llvm-extract/llvm-extract.cpp > llvm/trunk/tools/llvm-ld/llvm-ld.cpp > llvm/trunk/tools/llvm-link/llvm-link.cpp > llvm/trunk/tools/llvm-nm/llvm-nm.cpp > llvm/trunk/tools/llvm-prof/llvm-prof.cpp > llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp > llvm/trunk/tools/lto/LTOCodeGenerator.cpp > llvm/trunk/tools/lto/LTOCodeGenerator.h > llvm/trunk/tools/lto/LTOModule.cpp > llvm/trunk/tools/lto/LTOModule.h > llvm/trunk/tools/lto/lto.cpp > llvm/trunk/tools/opt/opt.cpp [snip] > > Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=74614&r1=74613&r2=74614&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original) > +++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Wed Jul 1 > 11:58:40 2009 > @@ -23,6 +23,7 @@ > class MemoryBuffer; > class ModulePass; > class BitstreamWriter; > + class LLVMContext; > class raw_ostream; > > /// getBitcodeModuleProvider - Read the header of the specified > bitcode buffer > @@ -31,12 +32,14 @@ > /// error, this returns null, *does not* take ownership of Buffer, > and fills > /// in *ErrMsg with an error description if ErrMsg is non-null. > ModuleProvider *getBitcodeModuleProvider(MemoryBuffer *Buffer, > + LLVMContext* Context, > std::string *ErrMsg = 0); > > /// ParseBitcodeFile - Read the specified bitcode file, returning > the module. > /// If an error occurs, this returns null and fills in *ErrMsg if > it is > /// non-null. This method *never* takes ownership of Buffer. > - Module *ParseBitcodeFile(MemoryBuffer *Buffer, std::string > *ErrMsg = 0); > + Module *ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* > Context, > + std::string *ErrMsg = 0); > > /// WriteBitcodeToFile - Write the specified module to the > specified output > /// stream. > From resistor at mac.com Wed Jul 1 13:25:30 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 11:25:30 -0700 Subject: [llvm-commits] [llvm] r74614 - in /llvm/trunk: examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/Kaleidoscope/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/Debugger/ include/llvm/Transforms/Utils/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Debugger/ lib/Linker/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llc/ tools/lli/ tools/llvm-ar/ tools/llvm-as/ tools/llvm-db/ tools/llvm-dis/ tools/llvm-extr... In-Reply-To: <3CC01F2B-F558-4CF7-84FE-ED9231BAA66D@apple.com> References: <200907011658.n61GwkLA015181@zion.cs.uiuc.edu> <3CC01F2B-F558-4CF7-84FE-ED9231BAA66D@apple.com> Message-ID: <823D3E5F-5EE4-4AE5-B11A-CCAE126ECD98@mac.com> Seems likely. Did you pull in the subsequent commit to LLVM-GCC as well? --Owen On Jul 1, 2009, at 11:21 AM, Stuart Hastings wrote: > Owen, I was running an Apple-Style(tm) build of LLVM-GCC and got > this: > > /Developer/usr/local/include/llvm/Bitcode/ReaderWriter.h: In function > 'void dummy_function()': > /Developer/usr/local/include/llvm/Bitcode/ReaderWriter.h:42: error: > too few arguments to function 'llvm::Module* > llvm::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMC\ > ontext*, std::string*)' > > Could this be related to your change^H^H^H^H^H^Himprovement to > ReaderWriter.h ? > > stuart > > On Jul 1, 2009, at 9:58 AM, Owen Anderson wrote: > >> Author: resistor >> Date: Wed Jul 1 11:58:40 2009 >> New Revision: 74614 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74614&view=rev >> Log: >> Add a pointer to the owning LLVMContext to Module. This requires >> threading LLVMContext through a lot >> of the bitcode reader and ASM parser APIs, as well as supporting it >> in all of the tools. >> >> Patches for Clang and LLVM-GCC to follow. >> >> Modified: >> llvm/trunk/examples/BrainF/BrainF.cpp >> llvm/trunk/examples/BrainF/BrainF.h >> llvm/trunk/examples/BrainF/BrainFDriver.cpp >> llvm/trunk/examples/Fibonacci/fibonacci.cpp >> llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp >> llvm/trunk/examples/Kaleidoscope/toy.cpp >> llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp >> llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp >> llvm/trunk/include/llvm-c/BitReader.h >> llvm/trunk/include/llvm-c/Core.h >> llvm/trunk/include/llvm/Assembly/Parser.h >> llvm/trunk/include/llvm/Bitcode/Archive.h >> llvm/trunk/include/llvm/Bitcode/ReaderWriter.h >> llvm/trunk/include/llvm/Debugger/Debugger.h >> llvm/trunk/include/llvm/LinkAllVMCore.h >> llvm/trunk/include/llvm/Linker.h >> llvm/trunk/include/llvm/Module.h >> llvm/trunk/include/llvm/Transforms/Utils/Cloning.h >> llvm/trunk/lib/Archive/Archive.cpp >> llvm/trunk/lib/Archive/ArchiveInternals.h >> llvm/trunk/lib/Archive/ArchiveReader.cpp >> llvm/trunk/lib/Archive/ArchiveWriter.cpp >> llvm/trunk/lib/AsmParser/Parser.cpp >> llvm/trunk/lib/Bitcode/Reader/BitReader.cpp >> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp >> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h >> llvm/trunk/lib/Debugger/Debugger.cpp >> llvm/trunk/lib/Linker/LinkArchives.cpp >> llvm/trunk/lib/Linker/LinkItems.cpp >> llvm/trunk/lib/Linker/Linker.cpp >> llvm/trunk/lib/Transforms/Utils/CloneModule.cpp >> llvm/trunk/lib/VMCore/Core.cpp >> llvm/trunk/lib/VMCore/Module.cpp >> llvm/trunk/tools/bugpoint/BugDriver.cpp >> llvm/trunk/tools/bugpoint/BugDriver.h >> llvm/trunk/tools/bugpoint/CrashDebugger.cpp >> llvm/trunk/tools/bugpoint/Miscompilation.cpp >> llvm/trunk/tools/bugpoint/OptimizerDriver.cpp >> llvm/trunk/tools/bugpoint/bugpoint.cpp >> llvm/trunk/tools/llc/llc.cpp >> llvm/trunk/tools/lli/lli.cpp >> llvm/trunk/tools/llvm-ar/llvm-ar.cpp >> llvm/trunk/tools/llvm-as/llvm-as.cpp >> llvm/trunk/tools/llvm-db/CLIDebugger.cpp >> llvm/trunk/tools/llvm-db/CLIDebugger.h >> llvm/trunk/tools/llvm-db/Commands.cpp >> llvm/trunk/tools/llvm-db/llvm-db.cpp >> llvm/trunk/tools/llvm-dis/llvm-dis.cpp >> llvm/trunk/tools/llvm-extract/llvm-extract.cpp >> llvm/trunk/tools/llvm-ld/llvm-ld.cpp >> llvm/trunk/tools/llvm-link/llvm-link.cpp >> llvm/trunk/tools/llvm-nm/llvm-nm.cpp >> llvm/trunk/tools/llvm-prof/llvm-prof.cpp >> llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp >> llvm/trunk/tools/lto/LTOCodeGenerator.cpp >> llvm/trunk/tools/lto/LTOCodeGenerator.h >> llvm/trunk/tools/lto/LTOModule.cpp >> llvm/trunk/tools/lto/LTOModule.h >> llvm/trunk/tools/lto/lto.cpp >> llvm/trunk/tools/opt/opt.cpp > > [snip] >> >> Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=74614&r1=74613&r2=74614&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original) >> +++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Wed Jul 1 >> 11:58:40 2009 >> @@ -23,6 +23,7 @@ >> class MemoryBuffer; >> class ModulePass; >> class BitstreamWriter; >> + class LLVMContext; >> class raw_ostream; >> >> /// getBitcodeModuleProvider - Read the header of the specified >> bitcode buffer >> @@ -31,12 +32,14 @@ >> /// error, this returns null, *does not* take ownership of Buffer, >> and fills >> /// in *ErrMsg with an error description if ErrMsg is non-null. >> ModuleProvider *getBitcodeModuleProvider(MemoryBuffer *Buffer, >> + LLVMContext* Context, >> std::string *ErrMsg = 0); >> >> /// ParseBitcodeFile - Read the specified bitcode file, returning >> the module. >> /// If an error occurs, this returns null and fills in *ErrMsg if >> it is >> /// non-null. This method *never* takes ownership of Buffer. >> - Module *ParseBitcodeFile(MemoryBuffer *Buffer, std::string >> *ErrMsg = 0); >> + Module *ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* >> Context, >> + std::string *ErrMsg = 0); >> >> /// WriteBitcodeToFile - Write the specified module to the >> specified output >> /// stream. >> > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jyasskin at google.com Wed Jul 1 13:30:15 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Wed, 01 Jul 2009 18:30:15 -0000 Subject: [llvm-commits] [llvm] r74623 - in /llvm/trunk: configure include/llvm/Config/config.h.in Message-ID: <200907011830.n61IUINl018870@zion.cs.uiuc.edu> Author: jyasskin Date: Wed Jul 1 13:30:10 2009 New Revision: 74623 URL: http://llvm.org/viewvc/llvm-project?rev=74623&view=rev Log: Update configure and config.h.in from r74621. Modified: llvm/trunk/configure llvm/trunk/include/llvm/Config/config.h.in Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=74623&r1=74622&r2=74623&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Wed Jul 1 13:30:10 2009 @@ -31356,9 +31356,119 @@ +for ac_func in mktemp realpath sbrk setrlimit strdup +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + -for ac_func in mktemp realpath sbrk setrlimit strdup strerror strerror_r +for ac_func in strerror strerror_r strerror_s do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 Modified: llvm/trunk/include/llvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=74623&r1=74622&r2=74623&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.in (original) +++ llvm/trunk/include/llvm/Config/config.h.in Wed Jul 1 13:30:10 2009 @@ -369,6 +369,9 @@ /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R +/* Define to 1 if you have the `strerror_s' function. */ +#undef HAVE_STRERROR_S + /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H From stuart at apple.com Wed Jul 1 13:37:45 2009 From: stuart at apple.com (Stuart Hastings) Date: Wed, 1 Jul 2009 11:37:45 -0700 Subject: [llvm-commits] [llvm] r74614 - in /llvm/trunk: examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/Kaleidoscope/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/Debugger/ include/llvm/Transforms/Utils/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Debugger/ lib/Linker/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llc/ tools/lli/ tools/llvm-ar/ tools/llvm-as/ tools/llvm-db/ tools/llvm-dis/ tools/llvm-extr... In-Reply-To: <823D3E5F-5EE4-4AE5-B11A-CCAE126ECD98@mac.com> References: <200907011658.n61GwkLA015181@zion.cs.uiuc.edu> <3CC01F2B-F558-4CF7-84FE-ED9231BAA66D@apple.com> <823D3E5F-5EE4-4AE5-B11A-CCAE126ECD98@mac.com> Message-ID: <7F873E17-F528-4EEC-BFD6-9F2C5B396F11@apple.com> On Jul 1, 2009, at 11:25 AM, Owen Anderson wrote: > Seems likely. Did you pull in the subsequent commit to LLVM-GCC as > well? I suppose not. I generally check them out together; I got r74618 and r74616 (for llvm and llvm-gcc, respectively). I'll update and try again... stuart > > > --Owen > > On Jul 1, 2009, at 11:21 AM, Stuart Hastings wrote: > >> Owen, I was running an Apple-Style(tm) build of LLVM-GCC and got >> this: >> >> /Developer/usr/local/include/llvm/Bitcode/ReaderWriter.h: In function >> 'void dummy_function()': >> /Developer/usr/local/include/llvm/Bitcode/ReaderWriter.h:42: error: >> too few arguments to function 'llvm::Module* >> llvm::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMC\ >> ontext*, std::string*)' >> >> Could this be related to your change^H^H^H^H^H^Himprovement to >> ReaderWriter.h ? >> >> stuart From dpatel at apple.com Wed Jul 1 13:51:09 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 18:51:09 -0000 Subject: [llvm-commits] [llvm] r74625 - /llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Message-ID: <200907011851.n61IpBEV019586@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 13:51:07 2009 New Revision: 74625 URL: http://llvm.org/viewvc/llvm-project?rev=74625&view=rev Log: llvm.dbg.declare is always used for local variable's debug info. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=74625&r1=74624&r2=74625&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Wed Jul 1 13:51:07 2009 @@ -442,10 +442,7 @@ MachineInstr *DeclareMI = BuildMI(MBB, DL, II).addFrameIndex(FI).addGlobalAddress(GV); DIVariable DV(cast(GV)); - if (!DV.isNull()) { - // This is a local variable - DW->RecordVariableScope(DV, DeclareMI); - } + DW->RecordVariableScope(DV, DeclareMI); } return true; } From isanbard at gmail.com Wed Jul 1 13:51:09 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Jul 2009 18:51:09 -0000 Subject: [llvm-commits] [llvm] r74624 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ lib/Target/XCore/ Message-ID: <200907011851.n61IpEY9019614@zion.cs.uiuc.edu> Author: void Date: Wed Jul 1 13:50:55 2009 New Revision: 74624 URL: http://llvm.org/viewvc/llvm-project?rev=74624&view=rev Log: Update comments to make it clear that the function alignment is the Log2 of the bytes and not bytes. Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.h llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.h llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.h llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Wed Jul 1 13:50:55 2009 @@ -151,11 +151,11 @@ MachineConstantPool *getConstantPool() { return ConstantPool; } const MachineConstantPool *getConstantPool() const { return ConstantPool; } - /// getAlignment - Return the alignment of the function. + /// getAlignment - Return the alignment (log2, not bytes) of the function. /// unsigned getAlignment() const { return Alignment; } - /// setAlignment - Set the alignment of the function. + /// setAlignment - Set the alignment (log2, not bytes) of the function. /// void setAlignment(unsigned A) { Alignment = A; } Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Wed Jul 1 13:50:55 2009 @@ -736,7 +736,7 @@ /// PIC relocation models. virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; - /// getFunctionAlignment - Return the alignment of this function. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *) const = 0; //===--------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -455,7 +455,7 @@ } } -/// getFunctionAlignment - Return the alignment of this function. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned ARMTargetLowering::getFunctionAlignment(const Function *F) const { return getTargetMachine().getSubtarget().isThumb() ? 1 : 2; } Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Wed Jul 1 13:50:55 2009 @@ -197,7 +197,7 @@ return Subtarget; } - /// getFunctionAlignment - Return the alignment of this function. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; private: Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -181,7 +181,7 @@ } } -/// getFunctionAlignment - Return the function alignment. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned AlphaTargetLowering::getFunctionAlignment(const Function *F) const { return 4; } Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Wed Jul 1 13:50:55 2009 @@ -103,7 +103,7 @@ virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; - /// getFunctionAlignment - Return the function alignment. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; private: Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -481,7 +481,7 @@ return ((i != node_names.end()) ? i->second : 0); } -/// getFunctionAlignment - Return the function alignment. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned SPUTargetLowering::getFunctionAlignment(const Function *) const { return 3; } Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h Wed Jul 1 13:50:55 2009 @@ -149,7 +149,7 @@ virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; - /// getFunctionAlignment - Return the function alignment. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; }; } Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -148,7 +148,7 @@ return MVT::i1; } -/// getFunctionAlignment - Return the function alignment. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned IA64TargetLowering::getFunctionAlignment(const Function *) const { return 5; } Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.h (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.h Wed Jul 1 13:50:55 2009 @@ -70,7 +70,7 @@ /// (currently, only "ret void") virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); - /// getFunctionAlignment - Return the function alignment. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; }; } Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -127,7 +127,7 @@ } } -/// getFunctionAlignment - Return the alignment of this function. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned MSP430TargetLowering::getFunctionAlignment(const Function *F) const { return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; } Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h Wed Jul 1 13:50:55 2009 @@ -74,7 +74,7 @@ /// DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; - /// getFunctionAlignment - Return the alignment of this function. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -158,7 +158,7 @@ return MVT::i32; } -/// getFunctionAlignment - Return the function alignment. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned MipsTargetLowering::getFunctionAlignment(const Function *) const { return 2; } Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Wed Jul 1 13:50:55 2009 @@ -84,7 +84,7 @@ /// getSetCCResultType - get the ISD::SETCC result ValueType MVT getSetCCResultType(MVT VT) const; - /// getFunctionAlignment - Return the function alignment. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; private: // Subtarget Info Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Wed Jul 1 13:50:55 2009 @@ -145,7 +145,7 @@ unsigned GetTmpSize() { return TmpSize; } void SetTmpSize(unsigned Size) { TmpSize = Size; } - /// getFunctionAlignment - Return the function alignment. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *) const { // FIXME: The function never seems to be aligned. return 1; Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -432,7 +432,7 @@ return MVT::i32; } -/// getFunctionAlignment - Return the function alignment. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned PPCTargetLowering::getFunctionAlignment(const Function *F) const { if (getTargetMachine().getSubtarget().isDarwin()) return F->hasFnAttr(Attribute::OptimizeForSize) ? 2 : 4; Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Wed Jul 1 13:50:55 2009 @@ -337,7 +337,7 @@ virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; - /// getFunctionAlignment - Return the function alignment. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; private: Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -1048,7 +1048,7 @@ return false; } -/// getFunctionAlignment - Return the function alignment. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned SparcTargetLowering::getFunctionAlignment(const Function *) const { return 4; } Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.h Wed Jul 1 13:50:55 2009 @@ -74,7 +74,7 @@ virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; - /// getFunctionAlignment - Return the function alignment. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; }; } // end namespace llvm Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -1027,7 +1027,7 @@ return Table; } -/// getFunctionAlignment - Return the alignment of this function. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned X86TargetLowering::getFunctionAlignment(const Function *F) const { return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Wed Jul 1 13:50:55 2009 @@ -534,7 +534,7 @@ #endif ); - /// getFunctionAlignment - Return the alignment of this function. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; private: Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Wed Jul 1 13:50:55 2009 @@ -187,7 +187,7 @@ } } -/// getFunctionAlignment - Return the alignment of this function. +/// getFunctionAlignment - Return the Log2 alignment of this function. unsigned XCoreTargetLowering:: getFunctionAlignment(const Function *) const { return 1; Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.h (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Wed Jul 1 13:50:55 2009 @@ -84,7 +84,7 @@ virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty) const; - /// getFunctionAlignment - Return the alignment of this function. + /// getFunctionAlignment - Return the Log2 alignment of this function. virtual unsigned getFunctionAlignment(const Function *F) const; private: From dpatel at apple.com Wed Jul 1 14:08:13 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 19:08:13 -0000 Subject: [llvm-commits] [llvm] r74628 - in /llvm/trunk/include/llvm/CodeGen: MachineInstrBuilder.h MachineOperand.h Message-ID: <200907011908.n61J8Dua020706@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 14:08:07 2009 New Revision: 74628 URL: http://llvm.org/viewvc/llvm-project?rev=74628&view=rev Log: Add machine operand for MDNodes. This will be used to communicate debug info. Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h llvm/trunk/include/llvm/CodeGen/MachineOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=74628&r1=74627&r2=74628&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Wed Jul 1 14:08:07 2009 @@ -107,6 +107,13 @@ return *this; } + const MachineInstrBuilder &addMetadata(MDNode *N, + int64_t Offset = 0, + unsigned char TargetFlags = 0) const { + MI->addOperand(MachineOperand::CreateMDNode(N, Offset, TargetFlags)); + return *this; + } + const MachineInstrBuilder &addExternalSymbol(const char *FnName, int64_t Offset = 0, unsigned char TargetFlags = 0) const { Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=74628&r1=74627&r2=74628&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Wed Jul 1 14:08:07 2009 @@ -23,6 +23,7 @@ class ConstantFP; class MachineBasicBlock; class GlobalValue; +class MDNode; class MachineInstr; class TargetMachine; class MachineRegisterInfo; @@ -41,7 +42,8 @@ MO_ConstantPoolIndex, ///< Address of indexed Constant in Constant Pool MO_JumpTableIndex, ///< Address of indexed Jump Table for switch MO_ExternalSymbol, ///< Name of external global symbol - MO_GlobalAddress ///< Address of a global value + MO_GlobalAddress, ///< Address of a global value + MO_Metadata ///< Metadata info }; private: @@ -107,6 +109,7 @@ int Index; // For MO_*Index - The index itself. const char *SymbolName; // For MO_ExternalSymbol. GlobalValue *GV; // For MO_GlobalAddress. + MDNode *Node; // For MO_Metadata. } Val; int64_t Offset; // An offset from the object. } OffsetedInfo; @@ -423,6 +426,14 @@ Op.setTargetFlags(TargetFlags); return Op; } + static MachineOperand CreateMDNode(MDNode *N, int64_t Offset, + unsigned char TargetFlags = 0) { + MachineOperand Op(MachineOperand::MO_Metadata); + Op.Contents.OffsetedInfo.Val.Node = N; + Op.setOffset(Offset); + Op.setTargetFlags(TargetFlags); + return Op; + } static MachineOperand CreateES(const char *SymName, int64_t Offset = 0, unsigned char TargetFlags = 0) { MachineOperand Op(MachineOperand::MO_ExternalSymbol); From dpatel at apple.com Wed Jul 1 14:21:12 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 19:21:12 -0000 Subject: [llvm-commits] [llvm] r74630 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/AsmWriter.cpp test/Feature/mdnode2.ll Message-ID: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 14:21:12 2009 New Revision: 74630 URL: http://llvm.org/viewvc/llvm-project?rev=74630&view=rev Log: Support stand alone metadata syntax. !0 = constant metadata !{i32 21, i32 22} @llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0} Added: llvm/trunk/test/Feature/mdnode2.ll Modified: llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74630&r1=74629&r2=74630&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul 1 14:21:12 2009 @@ -109,6 +109,7 @@ case lltok::StringConstant: // FIXME: REMOVE IN LLVM 3.0 case lltok::LocalVar: if (ParseNamedType()) return true; break; case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break; + case lltok::Metadata: if (ParseStandaloneMetadata()) return true; break; // The Global variable production with no name can have many different // optional leading prefixes, the production is: @@ -355,6 +356,34 @@ return ParseAlias(Name, NameLoc, Visibility); } +/// ParseStandaloneMetadata: +/// !42 = !{...} +bool LLParser::ParseStandaloneMetadata() { + assert(Lex.getKind() == lltok::Metadata); + Lex.Lex(); + unsigned MetadataID = 0; + if (ParseUInt32(MetadataID)) + return true; + if (MetadataCache.find(MetadataID) != MetadataCache.end()) + return TokError("Metadata id is already used"); + if (ParseToken(lltok::equal, "expected '=' here")) + return true; + + LocTy TyLoc; + bool IsConstant; + PATypeHolder Ty(Type::VoidTy); + if (ParseGlobalType(IsConstant) || + ParseType(Ty, TyLoc)) + return true; + + Constant *Init = 0; + if (ParseGlobalValue(Ty, Init)) + return true; + + MetadataCache[MetadataID] = Init; + return false; +} + /// ParseAlias: /// ::= GlobalVar '=' OptionalVisibility 'alias' OptionalLinkage Aliasee /// Aliasee @@ -1596,6 +1625,17 @@ return false; } + // Standalone metadata reference + // !{ ..., !42, ... } + unsigned MID = 0; + if (!ParseUInt32(MID)) { + std::map::iterator I = MetadataCache.find(MID); + if (I == MetadataCache.end()) + return TokError("Unknown metadata reference"); + ID.ConstantVal = I->second; + return false; + } + // MDString: // ::= '!' STRINGCONSTANT std::string Str; Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=74630&r1=74629&r2=74630&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Wed Jul 1 14:21:12 2009 @@ -43,7 +43,8 @@ std::map > ForwardRefTypes; std::map > ForwardRefTypeIDs; std::vector NumberedTypes; - + /// MetadataCache - This map keeps track of parsed metadata constants. + std::map MetadataCache; struct UpRefRecord { /// Loc - This is the location of the upref. LocTy Loc; @@ -139,6 +140,7 @@ bool ParseGlobal(const std::string &Name, LocTy Loc, unsigned Linkage, bool HasLinkage, unsigned Visibility); bool ParseAlias(const std::string &Name, LocTy Loc, unsigned Visibility); + bool ParseStandaloneMetadata(); // Type Parsing. bool ParseType(PATypeHolder &Result, bool AllowVoid = false); Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=74630&r1=74629&r2=74630&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Jul 1 14:21:12 2009 @@ -35,6 +35,7 @@ #include "llvm/Support/raw_ostream.h" #include #include +#include using namespace llvm; // Make virtual table appear in this compilation unit. @@ -945,25 +946,6 @@ return; } - if (const MDNode *N = dyn_cast(CV)) { - Out << "!{"; - for (MDNode::const_elem_iterator I = N->elem_begin(), E = N->elem_end(); - I != E;) { - if (!*I) { - Out << "null"; - } else { - TypePrinter.print((*I)->getType(), Out); - Out << ' '; - WriteAsOperandInternal(Out, *I, TypePrinter, Machine); - } - - if (++I != E) - Out << ", "; - } - Out << "}"; - return; - } - if (const ConstantExpr *CE = dyn_cast(CV)) { Out << CE->getOpcodeName(); if (CE->isCompare()) @@ -1092,10 +1074,14 @@ TypePrinting TypePrinter; AssemblyAnnotationWriter *AnnotationWriter; std::vector NumberedTypes; + + // Each MDNode is assigned unique MetadataIDNo. + std::map MDNodes; + unsigned MetadataIDNo; public: inline AssemblyWriter(raw_ostream &o, SlotTracker &Mac, const Module *M, AssemblyAnnotationWriter *AAW) - : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) { + : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW), MetadataIDNo(0) { AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M); } @@ -1124,6 +1110,7 @@ void printModule(const Module *M); void printTypeSymbolTable(const TypeSymbolTable &ST); void printGlobal(const GlobalVariable *GV); + void printMDNode(const MDNode *Node, bool StandAlone); void printAlias(const GlobalAlias *GV); void printFunction(const Function *F); void printArgument(const Argument *FA, Attributes Attrs); @@ -1264,6 +1251,28 @@ } void AssemblyWriter::printGlobal(const GlobalVariable *GV) { + if (GV->hasInitializer()) + // If GV is initialized using Metadata then separate out metadata + // operands used by the initializer. Note, MDNodes are not cyclic. + if (MDNode *N = dyn_cast(GV->getInitializer())) { + SmallVector WorkList; + // Collect MDNodes used by the initializer. + for (MDNode::const_elem_iterator I = N->elem_begin(), E = N->elem_end(); + I != E; ++I) { + const Value *TV = *I; + if (TV) + if (const MDNode *NN = dyn_cast(TV)) + WorkList.push_back(NN); + } + + // Print MDNodes used by the initializer. + while (!WorkList.empty()) { + const MDNode *N = WorkList.back(); WorkList.pop_back(); + printMDNode(N, true); + Out << '\n'; + } + } + if (GV->hasName()) { PrintLLVMName(Out, GV); Out << " = "; @@ -1283,7 +1292,10 @@ if (GV->hasInitializer()) { Out << ' '; - writeOperand(GV->getInitializer(), false); + if (MDNode *N = dyn_cast(GV->getInitializer())) + printMDNode(N, false); + else + writeOperand(GV->getInitializer(), false); } if (GV->hasSection()) @@ -1295,6 +1307,42 @@ Out << '\n'; } +void AssemblyWriter::printMDNode(const MDNode *Node, + bool StandAlone) { + std::map::iterator MI = MDNodes.find(Node); + // If this node is already printed then just refer it using its Metadata + // id number. + if (MI != MDNodes.end()) { + Out << "metadata !" << MI->second; + return; + } + + if (StandAlone) { + // Print standalone MDNode. + // !42 = !{ ... } + Out << "!" << MetadataIDNo << " = "; + Out << "constant metadata "; + } + Out << "!{"; + for (MDNode::const_elem_iterator I = Node->elem_begin(), E = Node->elem_end(); + I != E;) { + const Value *TV = *I; + if (!TV) + Out << "null"; + else if (const MDNode *N = dyn_cast(TV)) + printMDNode(N, StandAlone); + else if (!*I) + Out << "null"; + else + writeOperand(*I, true); + if (++I != E) + Out << ", "; + } + Out << "}"; + + MDNodes[Node] = MetadataIDNo++; +} + void AssemblyWriter::printAlias(const GlobalAlias *GA) { // Don't crash when dumping partially built GA if (!GA->hasName()) Added: llvm/trunk/test/Feature/mdnode2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/mdnode2.ll?rev=74630&view=auto ============================================================================== --- llvm/trunk/test/Feature/mdnode2.ll (added) +++ llvm/trunk/test/Feature/mdnode2.ll Wed Jul 1 14:21:12 2009 @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llvm-dis > %t.ll +; RUN: grep "!0 = constant metadata !{i32 21, i32 22}" %t.ll +; RUN: grep "!1 = constant metadata !{i32 23, i32 24}" %t.ll +; RUN: grep "@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !1, metadata !0}" %t.ll +!0 = constant metadata !{i32 21, i32 22} +!1 = constant metadata !{i32 23, i32 24} + at llvm.blah = constant metadata !{i32 1000, i16 200, metadata !1, metadata !0} From dpatel at apple.com Wed Jul 1 14:39:39 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 19:39:39 -0000 Subject: [llvm-commits] [llvm] r74632 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200907011939.n61JddZL021728@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 14:39:39 2009 New Revision: 74632 URL: http://llvm.org/viewvc/llvm-project?rev=74632&view=rev Log: Do not print stranded metadata. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=74632&r1=74631&r2=74632&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Jul 1 14:39:39 2009 @@ -1313,7 +1313,8 @@ // If this node is already printed then just refer it using its Metadata // id number. if (MI != MDNodes.end()) { - Out << "metadata !" << MI->second; + if (!StandAlone) + Out << "metadata !" << MI->second; return; } From dpatel at apple.com Wed Jul 1 14:41:00 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 19:41:00 -0000 Subject: [llvm-commits] [llvm] r74633 - /llvm/trunk/test/Feature/mdnode3.ll Message-ID: <200907011941.n61Jf00s021777@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 14:40:59 2009 New Revision: 74633 URL: http://llvm.org/viewvc/llvm-project?rev=74633&view=rev Log: new test case Added: llvm/trunk/test/Feature/mdnode3.ll Added: llvm/trunk/test/Feature/mdnode3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/mdnode3.ll?rev=74633&view=auto ============================================================================== --- llvm/trunk/test/Feature/mdnode3.ll (added) +++ llvm/trunk/test/Feature/mdnode3.ll Wed Jul 1 14:40:59 2009 @@ -0,0 +1,3 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as -f -o /dev/null +!0 = constant metadata !{i32 21, i32 22} + at llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0, metadata !0} From mai4 at uiuc.edu Wed Jul 1 15:26:52 2009 From: mai4 at uiuc.edu (Haohui Mai) Date: Wed, 01 Jul 2009 20:26:52 -0000 Subject: [llvm-commits] [poolalloc] r74635 - /poolalloc/trunk/lib/DSA/Basic.cpp Message-ID: <200907012026.n61KQr7k023249@zion.cs.uiuc.edu> Author: mai4 Date: Wed Jul 1 15:26:50 2009 New Revision: 74635 URL: http://llvm.org/viewvc/llvm-project?rev=74635&view=rev Log: Make the dummy DSA pass handle arguments too. Modified: poolalloc/trunk/lib/DSA/Basic.cpp Modified: poolalloc/trunk/lib/DSA/Basic.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Basic.cpp?rev=74635&r1=74634&r2=74635&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Basic.cpp (original) +++ poolalloc/trunk/lib/DSA/Basic.cpp Wed Jul 1 15:26:50 2009 @@ -58,6 +58,18 @@ if (!F->isDeclaration()) { DSGraph* G = new DSGraph(GlobalECs, getTargetData(), GlobalsGraph); DSNode * Node = new DSNode(PointerType::getUnqual(Type::Int8Ty), G); + + if (!F->hasInternalLinkage()) + Node->setExternalMarker(); + + // Create scalar nodes for all pointer arguments... + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); + I != E; ++I) { + if (isa(I->getType())) { + G->getNodeForValue(&*I).mergeWith(Node); + } + } + for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) { G->getNodeForValue(&*I).mergeWith(Node); } From stuart at apple.com Wed Jul 1 15:55:07 2009 From: stuart at apple.com (Stuart Hastings) Date: Wed, 1 Jul 2009 13:55:07 -0700 Subject: [llvm-commits] [llvm] r74614 - in /llvm/trunk: examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/Kaleidoscope/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/Debugger/ include/llvm/Transforms/Utils/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Debugger/ lib/Linker/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llc/ tools/lli/ tools/llvm-ar/ tools/llvm-as/ tools/llvm-db/ tools/llvm-dis/ tools/llvm-extr... In-Reply-To: <7F873E17-F528-4EEC-BFD6-9F2C5B396F11@apple.com> References: <200907011658.n61GwkLA015181@zion.cs.uiuc.edu> <3CC01F2B-F558-4CF7-84FE-ED9231BAA66D@apple.com> <823D3E5F-5EE4-4AE5-B11A-CCAE126ECD98@mac.com> <7F873E17-F528-4EEC-BFD6-9F2C5B396F11@apple.com> Message-ID: On Jul 1, 2009, at 11:37 AM, Stuart Hastings wrote: > > On Jul 1, 2009, at 11:25 AM, Owen Anderson wrote: > >> Seems likely. Did you pull in the subsequent commit to LLVM-GCC as >> well? > > I suppose not. I generally check them out together; I got r74618 > and r74616 (for llvm and llvm-gcc, respectively). > > I'll update and try again... Hm. r74623 (llvm and llvm-gcc) has the same diagnostic. Is this because my current partition has 10A362? In ReaderWriter.h, I see 36329 lattner /// ParseBitcodeFile - Read the specified bitcode file, returning the module. 36554 lattner /// If an error occurs, this returns null and fills in *ErrMsg if it is 36554 lattner /// non-null. This method *never* takes ownership of Buffer. 74614 resistor Module *ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* Context, 74614 resistor std::string *ErrMsg = 0); In llvm-linker-hack.cpp, I see #include "llvm/Bitcode/ReaderWriter.h" ... llvm::ParseBitcodeFile(NULL); If I fix that, changing it to llvm::ParseBitcodeFile(NULL, NULL, NULL); it gets further, stopping with this diagnostic: Undefined symbols: "llvm::LLVMContext::LLVMContext()", referenced from: _llvm_initialize_backend in libbackend.a(llvm-backend.o) Owen, would you please look into this? Thank you in advance, stuart >> --Owen >> >> On Jul 1, 2009, at 11:21 AM, Stuart Hastings wrote: >> >>> Owen, I was running an Apple-Style(tm) build of LLVM-GCC and got >>> this: >>> >>> /Developer/usr/local/include/llvm/Bitcode/ReaderWriter.h: In >>> function >>> 'void dummy_function()': >>> /Developer/usr/local/include/llvm/Bitcode/ReaderWriter.h:42: error: >>> too few arguments to function 'llvm::Module* >>> llvm::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMC\ >>> ontext*, std::string*)' >>> >>> Could this be related to your change^H^H^H^H^H^Himprovement to >>> ReaderWriter.h ? >>> >>> stuart From dpatel at apple.com Wed Jul 1 15:59:22 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 20:59:22 -0000 Subject: [llvm-commits] [llvm] r74638 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200907012059.n61KxMZb024252@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 15:59:15 2009 New Revision: 74638 URL: http://llvm.org/viewvc/llvm-project?rev=74638&view=rev Log: Fix metadata unittests Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=74638&r1=74637&r2=74638&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Jul 1 15:59:15 2009 @@ -1103,6 +1103,7 @@ void writeOperand(const Value *Op, bool PrintType); void writeParamOperand(const Value *Operand, Attributes Attrs); + void printMDNode(const MDNode *Node, bool StandAlone); const Module* getModule() { return TheModule; } @@ -1110,7 +1111,6 @@ void printModule(const Module *M); void printTypeSymbolTable(const TypeSymbolTable &ST); void printGlobal(const GlobalVariable *GV); - void printMDNode(const MDNode *Node, bool StandAlone); void printAlias(const GlobalAlias *GV); void printFunction(const Function *F); void printArgument(const Argument *FA, Attributes Attrs); @@ -1314,7 +1314,7 @@ // id number. if (MI != MDNodes.end()) { if (!StandAlone) - Out << "metadata !" << MI->second; + Out << "!" << MI->second; return; } @@ -1324,14 +1324,18 @@ Out << "!" << MetadataIDNo << " = "; Out << "constant metadata "; } + Out << "!{"; for (MDNode::const_elem_iterator I = Node->elem_begin(), E = Node->elem_end(); I != E;) { const Value *TV = *I; if (!TV) Out << "null"; - else if (const MDNode *N = dyn_cast(TV)) + else if (const MDNode *N = dyn_cast(TV)) { + TypePrinter.print(N->getType(), Out); + Out << ' '; printMDNode(N, StandAlone); + } else if (!*I) Out << "null"; else @@ -1901,6 +1905,14 @@ SlotTracker SlotTable(GV->getParent()); AssemblyWriter W(OS, SlotTable, GV->getParent(), AAW); W.write(GV); + } else if (const MDNode *N = dyn_cast(this)) { + TypePrinting TypePrinter; + TypePrinter.print(N->getType(), OS); + OS << ' '; + // FIXME: Do we need a slot tracker for metadata ? + SlotTracker SlotTable((const Function *)NULL); + AssemblyWriter W(OS, SlotTable, NULL, AAW); + W.printMDNode(N, false); } else if (const Constant *C = dyn_cast(this)) { TypePrinting TypePrinter; TypePrinter.print(C->getType(), OS); From brukman at gmail.com Wed Jul 1 16:01:19 2009 From: brukman at gmail.com (Misha Brukman) Date: Wed, 1 Jul 2009 17:01:19 -0400 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> <4A4B4E90.4020200@free.fr> <02DBC449-9304-4C0E-B675-03BFC0E5478E@apple.com> Message-ID: 2009/7/1 Dale Johannesen > On Jul 1, 2009, at 10:47 AMPDT, Chris Lattner wrote: > > Duncan is the code owner of llvm-gcc, so if he strongly prefers it one > > way or the other, it's his call :-). Duncan? > > Ah, I didn't realize you considered him the owner. http://llvm.org/docs/DeveloperPolicy.html#owners -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/a1d7d70e/attachment.html From resistor at mac.com Wed Jul 1 16:22:36 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 21:22:36 -0000 Subject: [llvm-commits] [llvm] r74640 - in /llvm/trunk: examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/Kaleidoscope/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/Debugger/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Debugger/ lib/Linker/ lib/VMCore/ tools/bugpoint/ tools/llc/ tools/lli/ tools/llvm-ar/ tools/llvm-as/ tools/llvm-db/ tools/llvm-dis/ tools/llvm-extract/ tools/llvm-ld/ tools/llvm-link/ tools/llvm-nm/ t... Message-ID: <200907012122.n61LMcRr025036@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 16:22:36 2009 New Revision: 74640 URL: http://llvm.org/viewvc/llvm-project?rev=74640&view=rev Log: Hold the LLVMContext by reference rather than by pointer. Modified: llvm/trunk/examples/BrainF/BrainF.cpp llvm/trunk/examples/BrainF/BrainF.h llvm/trunk/examples/BrainF/BrainFDriver.cpp llvm/trunk/examples/Fibonacci/fibonacci.cpp llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp llvm/trunk/examples/Kaleidoscope/toy.cpp llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp llvm/trunk/include/llvm-c/lto.h llvm/trunk/include/llvm/Assembly/Parser.h llvm/trunk/include/llvm/Bitcode/Archive.h llvm/trunk/include/llvm/Bitcode/ReaderWriter.h llvm/trunk/include/llvm/Debugger/Debugger.h llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/include/llvm/LinkAllVMCore.h llvm/trunk/include/llvm/Linker.h llvm/trunk/include/llvm/Module.h llvm/trunk/lib/Archive/Archive.cpp llvm/trunk/lib/Archive/ArchiveInternals.h llvm/trunk/lib/Archive/ArchiveReader.cpp llvm/trunk/lib/Archive/ArchiveWriter.cpp llvm/trunk/lib/AsmParser/Parser.cpp llvm/trunk/lib/Bitcode/Reader/BitReader.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h llvm/trunk/lib/Debugger/Debugger.cpp llvm/trunk/lib/Linker/Linker.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/Module.cpp llvm/trunk/tools/bugpoint/BugDriver.cpp llvm/trunk/tools/bugpoint/BugDriver.h llvm/trunk/tools/bugpoint/bugpoint.cpp llvm/trunk/tools/llc/llc.cpp llvm/trunk/tools/lli/lli.cpp llvm/trunk/tools/llvm-ar/llvm-ar.cpp llvm/trunk/tools/llvm-as/llvm-as.cpp llvm/trunk/tools/llvm-db/CLIDebugger.cpp llvm/trunk/tools/llvm-db/CLIDebugger.h llvm/trunk/tools/llvm-db/llvm-db.cpp llvm/trunk/tools/llvm-dis/llvm-dis.cpp llvm/trunk/tools/llvm-extract/llvm-extract.cpp llvm/trunk/tools/llvm-ld/llvm-ld.cpp llvm/trunk/tools/llvm-link/llvm-link.cpp llvm/trunk/tools/llvm-nm/llvm-nm.cpp llvm/trunk/tools/llvm-prof/llvm-prof.cpp llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/lto/LTOCodeGenerator.h llvm/trunk/tools/lto/LTOModule.cpp llvm/trunk/tools/lto/LTOModule.h llvm/trunk/tools/lto/lto.cpp llvm/trunk/tools/opt/opt.cpp llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp llvm/trunk/unittests/VMCore/PassManagerTest.cpp Modified: llvm/trunk/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.cpp (original) +++ llvm/trunk/examples/BrainF/BrainF.cpp Wed Jul 1 16:22:36 2009 @@ -37,7 +37,7 @@ const char *BrainF::testreg = "test"; Module *BrainF::parse(std::istream *in1, int mem, CompileFlags cf, - LLVMContext* Context) { + const LLVMContext& Context) { in = in1; memtotal = mem; comflag = cf; @@ -48,7 +48,7 @@ return module; } -void BrainF::header(LLVMContext* C) { +void BrainF::header(const LLVMContext& C) { module = new Module("BrainF", C); //Function prototypes Modified: llvm/trunk/examples/BrainF/BrainF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.h (original) +++ llvm/trunk/examples/BrainF/BrainF.h Wed Jul 1 16:22:36 2009 @@ -39,7 +39,8 @@ /// containing the resulting code. /// On error, it calls abort. /// The caller must delete the returned module. - Module *parse(std::istream *in1, int mem, CompileFlags cf, LLVMContext* C); + Module *parse(std::istream *in1, int mem, CompileFlags cf, + const LLVMContext& C); protected: /// The different symbols in the BrainF language @@ -65,7 +66,7 @@ static const char *testreg; /// Put the brainf function preamble and other fixed pieces of code - void header(LLVMContext* C); + void header(const LLVMContext& C); /// The main loop for parsing. It calls itself recursively /// to handle the depth of nesting of "[]". Modified: llvm/trunk/examples/BrainF/BrainFDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainFDriver.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainFDriver.cpp (original) +++ llvm/trunk/examples/BrainF/BrainFDriver.cpp Wed Jul 1 16:22:36 2009 @@ -126,7 +126,7 @@ //Read the BrainF program BrainF bf; - Module *mod = bf.parse(in, 65536, cf, &Context); //64 KiB + Module *mod = bf.parse(in, 65536, cf, Context); //64 KiB if (in != &std::cin) {delete in;} addMainFunction(mod); Modified: llvm/trunk/examples/Fibonacci/fibonacci.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Fibonacci/fibonacci.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/examples/Fibonacci/fibonacci.cpp (original) +++ llvm/trunk/examples/Fibonacci/fibonacci.cpp Wed Jul 1 16:22:36 2009 @@ -94,7 +94,7 @@ LLVMContext Context; // Create some module to put our function into it. - Module *M = new Module("test", &Context); + Module *M = new Module("test", Context); // We are about to create the "fib" function: Function *FibF = CreateFibFunction(M); Modified: llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp (original) +++ llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp Wed Jul 1 16:22:36 2009 @@ -55,7 +55,7 @@ LLVMContext Context; // Create some module to put our function into it. - Module *M = new Module("test", &Context); + Module *M = new Module("test", Context); // Create the add1 function entry and insert this entry into module M. The // function will have a return type of "int" and take an argument of "int". Modified: llvm/trunk/examples/Kaleidoscope/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/toy.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/toy.cpp (original) +++ llvm/trunk/examples/Kaleidoscope/toy.cpp Wed Jul 1 16:22:36 2009 @@ -1099,7 +1099,7 @@ getNextToken(); // Make the module, which holds all the code. - TheModule = new Module("my cool jit", &Context); + TheModule = new Module("my cool jit", Context); // Create the JIT. TheExecutionEngine = ExecutionEngine::create(TheModule); Modified: llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp (original) +++ llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp Wed Jul 1 16:22:36 2009 @@ -27,7 +27,7 @@ // Create the "module" or "program" or "translation unit" to hold the // function - Module *M = new Module("test", &Context); + Module *M = new Module("test", Context); // Create the main function: first create the type 'int ()' FunctionType *FT = FunctionType::get(Type::Int32Ty, /*not vararg*/false); Modified: llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp (original) +++ llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp Wed Jul 1 16:22:36 2009 @@ -236,7 +236,7 @@ LLVMContext Context; // Create some module to put our function into it. - Module *M = new Module("test", &Context); + Module *M = new Module("test", Context); Function* add1F = createAdd1( M ); Function* fibF = CreateFibFunction( M ); Modified: llvm/trunk/include/llvm-c/lto.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/lto.h (original) +++ llvm/trunk/include/llvm-c/lto.h Wed Jul 1 16:22:36 2009 @@ -58,6 +58,7 @@ /** opaque reference to a code generator */ typedef struct LTOCodeGenerator* lto_code_gen_t; +typedef struct LTOContext* lto_context_t; #ifdef __cplusplus extern "C" { @@ -76,7 +77,6 @@ extern const char* lto_get_error_message(void); - /** * Checks if a file is a loadable object file. */ Modified: llvm/trunk/include/llvm/Assembly/Parser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Parser.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Parser.h (original) +++ llvm/trunk/include/llvm/Assembly/Parser.h Wed Jul 1 16:22:36 2009 @@ -32,7 +32,7 @@ Module *ParseAssemblyFile( const std::string &Filename, ///< The name of the file to parse ParseError &Error, ///< If not null, an object to return errors in. - LLVMContext* Context ///< Context in which to allocate globals info. + const LLVMContext& Context ///< Context in which to allocate globals info. ); /// The function is a secondary interface to the LLVM Assembly Parser. It parses @@ -45,7 +45,7 @@ const char *AsmString, ///< The string containing assembly Module *M, ///< A module to add the assembly too. ParseError &Error, ///< If not null, an object to return errors in. - LLVMContext* Context + const LLVMContext& Context ); //===------------------------------------------------------------------------=== Modified: llvm/trunk/include/llvm/Bitcode/Archive.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Archive.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Archive.h (original) +++ llvm/trunk/include/llvm/Bitcode/Archive.h Wed Jul 1 16:22:36 2009 @@ -280,7 +280,7 @@ /// @brief Create an empty Archive. static Archive* CreateEmpty( const sys::Path& Filename,///< Name of the archive to (eventually) create. - LLVMContext* C ///< Context to use for global information + const LLVMContext& C ///< Context to use for global information ); /// Open an existing archive and load its contents in preparation for @@ -291,7 +291,7 @@ /// @brief Open and load an archive file static Archive* OpenAndLoad( const sys::Path& filePath, ///< The file path to open and load - LLVMContext* C, ///< The context to use for global information + const LLVMContext& C, ///< The context to use for global information std::string* ErrorMessage ///< An optional error string ); @@ -313,7 +313,7 @@ /// @brief Open an existing archive and load its symbols. static Archive* OpenAndLoadSymbols( const sys::Path& Filename, ///< Name of the archive file to open - LLVMContext* C, ///< The context to use for global info + const LLVMContext& C, ///< The context to use for global info std::string* ErrorMessage=0 ///< An optional error string ); @@ -453,7 +453,7 @@ protected: /// @brief Construct an Archive for \p filename and optionally map it /// into memory. - explicit Archive(const sys::Path& filename, LLVMContext* C); + explicit Archive(const sys::Path& filename, const LLVMContext& C); /// @param data The symbol table data to be parsed /// @param len The length of the symbol table data @@ -534,7 +534,7 @@ unsigned firstFileOffset; ///< Offset to first normal file. ModuleMap modules; ///< The modules loaded via symbol lookup. ArchiveMember* foreignST; ///< This holds the foreign symbol table. - LLVMContext* Context; ///< This holds global data. + const LLVMContext& Context; ///< This holds global data. /// @} /// @name Hidden /// @{ Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original) +++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Wed Jul 1 16:22:36 2009 @@ -32,13 +32,13 @@ /// error, this returns null, *does not* take ownership of Buffer, and fills /// in *ErrMsg with an error description if ErrMsg is non-null. ModuleProvider *getBitcodeModuleProvider(MemoryBuffer *Buffer, - LLVMContext* Context, + const LLVMContext& Context, std::string *ErrMsg = 0); /// ParseBitcodeFile - Read the specified bitcode file, returning the module. /// If an error occurs, this returns null and fills in *ErrMsg if it is /// non-null. This method *never* takes ownership of Buffer. - Module *ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* Context, + Module *ParseBitcodeFile(MemoryBuffer *Buffer, const LLVMContext& Context, std::string *ErrMsg = 0); /// WriteBitcodeToFile - Write the specified module to the specified output Modified: llvm/trunk/include/llvm/Debugger/Debugger.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Debugger/Debugger.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm/Debugger/Debugger.h (original) +++ llvm/trunk/include/llvm/Debugger/Debugger.h Wed Jul 1 16:22:36 2009 @@ -96,7 +96,7 @@ /// the PATH for the specified program, loading it when found. If the /// specified program cannot be found, an exception is thrown to indicate /// the error. - void loadProgram(const std::string &Path, LLVMContext* Context); + void loadProgram(const std::string &Path, const LLVMContext& Context); /// unloadProgram - If a program is running, kill it, then unload all traces /// of the current program. If no program is loaded, this method silently Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Wed Jul 1 16:22:36 2009 @@ -198,7 +198,7 @@ }; /// FOR BACKWARDS COMPATIBILITY - Returns a global context. -LLVMContext* getGlobalContext(); +extern const LLVMContext& getGlobalContext(); } Modified: llvm/trunk/include/llvm/LinkAllVMCore.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllVMCore.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllVMCore.h (original) +++ llvm/trunk/include/llvm/LinkAllVMCore.h Wed Jul 1 16:22:36 2009 @@ -16,6 +16,7 @@ #ifndef LLVM_LINKALLVMCORE_H #define LLVM_LINKALLVMCORE_H +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" @@ -44,7 +45,7 @@ // to know that getenv() never returns -1, this will do the job. if (std::getenv("bar") != (char*) -1) return; - llvm::Module* M = new llvm::Module("", 0); + llvm::Module* M = new llvm::Module("", llvm::getGlobalContext()); (void)new llvm::UnreachableInst(); (void) llvm::createVerifierPass(); (void) new llvm::Mangler(*M,""); Modified: llvm/trunk/include/llvm/Linker.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm/Linker.h (original) +++ llvm/trunk/include/llvm/Linker.h Wed Jul 1 16:22:36 2009 @@ -67,7 +67,7 @@ Linker( const std::string& progname, ///< name of tool running linker const std::string& modulename, ///< name of linker's end-result module - LLVMContext* C, ///< Context for global info + const LLVMContext& C, ///< Context for global info unsigned Flags = 0 ///< ControlFlags (one or more |'d together) ); @@ -285,7 +285,7 @@ /// @name Data /// @{ private: - LLVMContext* Context; ///< The context for global information + const LLVMContext& Context; ///< The context for global information Module* Composite; ///< The composite module linked together std::vector LibPaths; ///< The library search paths unsigned Flags; ///< Flags to control optional behavior. Modified: llvm/trunk/include/llvm/Module.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Module.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/include/llvm/Module.h (original) +++ llvm/trunk/include/llvm/Module.h Wed Jul 1 16:22:36 2009 @@ -110,7 +110,7 @@ /// @name Member Variables /// @{ private: - LLVMContext* Context; ///< The LLVMContext from which types and + const LLVMContext& Context; ///< The LLVMContext from which types and ///< constants are allocated. GlobalListType GlobalList; ///< The Global Variables in the module FunctionListType FunctionList; ///< The Functions in the module @@ -131,7 +131,7 @@ public: /// The Module constructor. Note that there is no default constructor. You /// must provide a name for the module upon construction. - explicit Module(const std::string &ModuleID, LLVMContext* C); + explicit Module(const std::string &ModuleID, const LLVMContext& C); /// The module destructor. This will dropAllReferences. ~Module(); @@ -162,7 +162,7 @@ /// Get the global data context. /// @returns LLVMContext - a container for LLVM's global information - LLVMContext* getContext() const { return Context; } + const LLVMContext& getContext() const { return Context; } /// Get any module-scope inline assembly blocks. /// @returns a string containing the module-scope inline assembly blocks. Modified: llvm/trunk/lib/Archive/Archive.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/Archive.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Archive/Archive.cpp (original) +++ llvm/trunk/lib/Archive/Archive.cpp Wed Jul 1 16:22:36 2009 @@ -138,7 +138,7 @@ // Archive constructor - this is the only constructor that gets used for the // Archive class. Everything else (default,copy) is deprecated. This just // initializes and maps the file into memory, if requested. -Archive::Archive(const sys::Path& filename, LLVMContext* C) +Archive::Archive(const sys::Path& filename, const LLVMContext& C) : archPath(filename), members(), mapfile(0), base(0), symTab(), strtab(), symTabSize(0), firstFileOffset(0), modules(), foreignST(0), Context(C) { } @@ -208,7 +208,7 @@ // Get just the externally visible defined symbols from the bitcode bool llvm::GetBitcodeSymbols(const sys::Path& fName, - LLVMContext* Context, + const LLVMContext& Context, std::vector& symbols, std::string* ErrMsg) { std::auto_ptr Buffer( @@ -240,7 +240,7 @@ ModuleProvider* llvm::GetBitcodeSymbols(const unsigned char *BufPtr, unsigned Length, const std::string& ModuleID, - LLVMContext* Context, + const LLVMContext& Context, std::vector& symbols, std::string* ErrMsg) { // Get the module provider Modified: llvm/trunk/lib/Archive/ArchiveInternals.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveInternals.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveInternals.h (original) +++ llvm/trunk/lib/Archive/ArchiveInternals.h Wed Jul 1 16:22:36 2009 @@ -73,13 +73,13 @@ // Get just the externally visible defined symbols from the bitcode bool GetBitcodeSymbols(const sys::Path& fName, - LLVMContext* Context, + const LLVMContext& Context, std::vector& symbols, std::string* ErrMsg); ModuleProvider* GetBitcodeSymbols(const unsigned char*Buffer,unsigned Length, const std::string& ModuleID, - LLVMContext* Context, + const LLVMContext& Context, std::vector& symbols, std::string* ErrMsg); } Modified: llvm/trunk/lib/Archive/ArchiveReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveReader.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveReader.cpp (original) +++ llvm/trunk/lib/Archive/ArchiveReader.cpp Wed Jul 1 16:22:36 2009 @@ -327,7 +327,7 @@ // Open and completely load the archive file. Archive* -Archive::OpenAndLoad(const sys::Path& file, LLVMContext* C, +Archive::OpenAndLoad(const sys::Path& file, const LLVMContext& C, std::string* ErrorMessage) { std::auto_ptr result ( new Archive(file, C)); if (result->mapToMemory(ErrorMessage)) @@ -441,7 +441,8 @@ } // Open the archive and load just the symbol tables -Archive* Archive::OpenAndLoadSymbols(const sys::Path& file, LLVMContext* C, +Archive* Archive::OpenAndLoadSymbols(const sys::Path& file, + const LLVMContext& C, std::string* ErrorMessage) { std::auto_ptr result ( new Archive(file, C) ); if (result->mapToMemory(ErrorMessage)) Modified: llvm/trunk/lib/Archive/ArchiveWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveWriter.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveWriter.cpp (original) +++ llvm/trunk/lib/Archive/ArchiveWriter.cpp Wed Jul 1 16:22:36 2009 @@ -64,7 +64,7 @@ } // Create an empty archive. -Archive* Archive::CreateEmpty(const sys::Path& FilePath, LLVMContext* C) { +Archive* Archive::CreateEmpty(const sys::Path& FilePath, const LLVMContext& C) { Archive* result = new Archive(FilePath, C); return result; } Modified: llvm/trunk/lib/AsmParser/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Parser.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Parser.cpp (original) +++ llvm/trunk/lib/AsmParser/Parser.cpp Wed Jul 1 16:22:36 2009 @@ -21,7 +21,7 @@ using namespace llvm; Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err, - LLVMContext* Context) { + const LLVMContext& Context) { Err.setFilename(Filename); std::string ErrorStr; @@ -39,7 +39,7 @@ } Module *llvm::ParseAssemblyString(const char *AsmString, Module *M, - ParseError &Err, LLVMContext* Context) { + ParseError &Err, const LLVMContext& Context) { Err.setFilename(""); OwningPtr Modified: llvm/trunk/lib/Bitcode/Reader/BitReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitReader.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Wed Jul 1 16:22:36 2009 @@ -22,7 +22,7 @@ LLVMModuleRef *OutModule, char **OutMessage) { std::string Message; - *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), unwrap(ContextRef), + *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), *unwrap(ContextRef), &Message)); if (!*OutModule) { if (OutMessage) @@ -42,7 +42,7 @@ char **OutMessage) { std::string Message; - *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), unwrap(ContextRef), + *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), *unwrap(ContextRef), &Message)); if (!*OutMP) { if (OutMessage) Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Jul 1 16:22:36 2009 @@ -2090,7 +2090,7 @@ /// getBitcodeModuleProvider - lazy function-at-a-time loading from a file. /// ModuleProvider *llvm::getBitcodeModuleProvider(MemoryBuffer *Buffer, - LLVMContext* Context, + const LLVMContext& Context, std::string *ErrMsg) { BitcodeReader *R = new BitcodeReader(Buffer, Context); if (R->ParseBitcode()) { @@ -2107,7 +2107,7 @@ /// ParseBitcodeFile - Read the specified bitcode file, returning the module. /// If an error occurs, return null and fill in *ErrMsg if non-null. -Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* Context, +Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, const LLVMContext& Context, std::string *ErrMsg){ BitcodeReader *R; R = static_cast(getBitcodeModuleProvider(Buffer, Context, Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Wed Jul 1 16:22:36 2009 @@ -86,7 +86,7 @@ }; class BitcodeReader : public ModuleProvider { - LLVMContext* Context; + const LLVMContext& Context; MemoryBuffer *Buffer; BitstreamReader StreamFile; BitstreamCursor Stream; @@ -125,7 +125,7 @@ /// stream) and what linkage the original function had. DenseMap > DeferredFunctionInfo; public: - explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext* C) + explicit BitcodeReader(MemoryBuffer *buffer, const LLVMContext& C) : Context(C), Buffer(buffer), ErrorString(0) { HasReversedFunctionsWithBodies = false; } Modified: llvm/trunk/lib/Debugger/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Debugger/Debugger.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Debugger/Debugger.cpp (original) +++ llvm/trunk/lib/Debugger/Debugger.cpp Wed Jul 1 16:22:36 2009 @@ -46,7 +46,8 @@ } static Module * -getMaterializedModuleProvider(const std::string &Filename, LLVMContext* C) { +getMaterializedModuleProvider(const std::string &Filename, + const LLVMContext& C) { std::auto_ptr Buffer; Buffer.reset(MemoryBuffer::getFileOrSTDIN(Filename.c_str())); if (Buffer.get()) @@ -58,7 +59,7 @@ /// the PATH for the specified program, loading it when found. If the /// specified program cannot be found, an exception is thrown to indicate the /// error. -void Debugger::loadProgram(const std::string &Filename, LLVMContext* C) { +void Debugger::loadProgram(const std::string &Filename, const LLVMContext& C) { if ((Program = getMaterializedModuleProvider(Filename, C)) || (Program = getMaterializedModuleProvider(Filename+".bc", C))) return; // Successfully loaded the program. Modified: llvm/trunk/lib/Linker/Linker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/Linker.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/Linker/Linker.cpp (original) +++ llvm/trunk/lib/Linker/Linker.cpp Wed Jul 1 16:22:36 2009 @@ -20,7 +20,7 @@ using namespace llvm; Linker::Linker(const std::string& progname, const std::string& modname, - LLVMContext* C, unsigned flags): + const LLVMContext& C, unsigned flags): Context(C), Composite(new Module(modname, C)), LibPaths(), Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Wed Jul 1 16:22:36 2009 @@ -53,7 +53,7 @@ /*===-- Operations on modules ---------------------------------------------===*/ LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID, LLVMContextRef C) { - return wrap(new Module(ModuleID, unwrap(C))); + return wrap(new Module(ModuleID, *unwrap(C))); } void LLVMDisposeModule(LLVMModuleRef M) { Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Wed Jul 1 16:22:36 2009 @@ -22,8 +22,8 @@ static ManagedStatic GlobalContext; -LLVMContext* getGlobalContext() { - return &*GlobalContext; +const LLVMContext& llvm::getGlobalContext() { + return *GlobalContext; } LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl()) { } Modified: llvm/trunk/lib/VMCore/Module.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Module.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Module.cpp (original) +++ llvm/trunk/lib/VMCore/Module.cpp Wed Jul 1 16:22:36 2009 @@ -55,7 +55,7 @@ // Primitive Module methods. // -Module::Module(const std::string &MID, LLVMContext* C) +Module::Module(const std::string &MID, const LLVMContext& C) : Context(C), ModuleID(MID), DataLayout("") { ValSymTab = new ValueSymbolTable(); TypeSymTab = new TypeSymbolTable(); Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/BugDriver.cpp (original) +++ llvm/trunk/tools/bugpoint/BugDriver.cpp Wed Jul 1 16:22:36 2009 @@ -64,7 +64,8 @@ } BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs, - unsigned timeout, unsigned memlimit, LLVMContext* ctxt) + unsigned timeout, unsigned memlimit, + const LLVMContext& ctxt) : Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile), Program(0), Interpreter(0), SafeInterpreter(0), gcc(0), run_as_child(as_child), run_find_bugs(find_bugs), Timeout(timeout), @@ -74,7 +75,8 @@ /// ParseInputFile - Given a bitcode or assembly input filename, parse and /// return it, or return null if not possible. /// -Module *llvm::ParseInputFile(const std::string &Filename, LLVMContext* Ctxt) { +Module *llvm::ParseInputFile(const std::string &Filename, + const LLVMContext& Ctxt) { std::auto_ptr Buffer(MemoryBuffer::getFileOrSTDIN(Filename)); Module *Result = 0; if (Buffer.get()) Modified: llvm/trunk/tools/bugpoint/BugDriver.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/BugDriver.h (original) +++ llvm/trunk/tools/bugpoint/BugDriver.h Wed Jul 1 16:22:36 2009 @@ -43,7 +43,7 @@ extern bool BugpointIsInterrupted; class BugDriver { - LLVMContext* Context; + const LLVMContext& Context; const std::string ToolName; // Name of bugpoint std::string ReferenceOutputFile; // Name of `good' output file Module *Program; // The raw program, linked together @@ -62,11 +62,11 @@ public: BugDriver(const char *toolname, bool as_child, bool find_bugs, - unsigned timeout, unsigned memlimit, LLVMContext* ctxt); + unsigned timeout, unsigned memlimit, const LLVMContext& ctxt); const std::string &getToolName() const { return ToolName; } - LLVMContext* getContext() { return Context; } + const LLVMContext& getContext() { return Context; } // Set up methods... these methods are used to copy information about the // command line arguments into instance variables of BugDriver. @@ -294,7 +294,8 @@ /// ParseInputFile - Given a bitcode or assembly input filename, parse and /// return it, or return null if not possible. /// -Module *ParseInputFile(const std::string &InputFilename, LLVMContext* ctxt); +Module *ParseInputFile(const std::string &InputFilename, + const LLVMContext& ctxt); /// getPassesString - Turn a list of passes into a string which indicates the Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original) +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Wed Jul 1 16:22:36 2009 @@ -76,7 +76,7 @@ sys::SetInterruptFunction(BugpointInterruptFunction); LLVMContext Context; - BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit, &Context); + BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit, Context); if (D.addSources(InputFilenames)) return 1; D.addPasses(PassList.begin(), PassList.end()); Modified: llvm/trunk/tools/llc/llc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llc/llc.cpp (original) +++ llvm/trunk/tools/llc/llc.cpp Wed Jul 1 16:22:36 2009 @@ -227,7 +227,7 @@ std::auto_ptr Buffer( MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)); if (Buffer.get()) - M.reset(ParseBitcodeFile(Buffer.get(), &Context, &ErrorMessage)); + M.reset(ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage)); if (M.get() == 0) { std::cerr << argv[0] << ": bitcode didn't read correctly.\n"; std::cerr << "Reason: " << ErrorMessage << "\n"; Modified: llvm/trunk/tools/lli/lli.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/lli/lli.cpp (original) +++ llvm/trunk/tools/lli/lli.cpp Wed Jul 1 16:22:36 2009 @@ -107,7 +107,7 @@ std::string ErrorMsg; ModuleProvider *MP = NULL; if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)){ - MP = getBitcodeModuleProvider(Buffer, &Context, &ErrorMsg); + MP = getBitcodeModuleProvider(Buffer, Context, &ErrorMsg); if (!MP) delete Buffer; } Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original) +++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Wed Jul 1 16:22:36 2009 @@ -719,11 +719,11 @@ // Produce a warning if we should and we're creating the archive if (!Create) std::cerr << argv[0] << ": creating " << ArchivePath.toString() << "\n"; - TheArchive = Archive::CreateEmpty(ArchivePath, &Context); + TheArchive = Archive::CreateEmpty(ArchivePath, Context); TheArchive->writeToDisk(); } else { std::string Error; - TheArchive = Archive::OpenAndLoad(ArchivePath, &Context, &Error); + TheArchive = Archive::OpenAndLoad(ArchivePath, Context, &Error); if (TheArchive == 0) { std::cerr << argv[0] << ": error loading '" << ArchivePath << "': " << Error << "!\n"; Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-as/llvm-as.cpp (original) +++ llvm/trunk/tools/llvm-as/llvm-as.cpp Wed Jul 1 16:22:36 2009 @@ -65,7 +65,7 @@ try { // Parse the file now... ParseError Err; - std::auto_ptr M(ParseAssemblyFile(InputFilename, Err, &Context)); + std::auto_ptr M(ParseAssemblyFile(InputFilename, Err, Context)); if (M.get() == 0) { Err.PrintError(argv[0], errs()); return 1; Modified: llvm/trunk/tools/llvm-db/CLIDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/CLIDebugger.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/CLIDebugger.cpp (original) +++ llvm/trunk/tools/llvm-db/CLIDebugger.cpp Wed Jul 1 16:22:36 2009 @@ -22,7 +22,7 @@ /// CLIDebugger constructor - This initializes the debugger to its default /// state, and initializes the command table. /// -CLIDebugger::CLIDebugger(LLVMContext* ctxt) +CLIDebugger::CLIDebugger(const LLVMContext& ctxt) : Context(ctxt), TheProgramInfo(0), TheRuntimeInfo(0), Prompt("(llvm-db) "), ListSize(10) { // Initialize instance variables Modified: llvm/trunk/tools/llvm-db/CLIDebugger.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/CLIDebugger.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/CLIDebugger.h (original) +++ llvm/trunk/tools/llvm-db/CLIDebugger.h Wed Jul 1 16:22:36 2009 @@ -29,7 +29,7 @@ /// CLIDebugger - This class implements the command line interface for the /// LLVM debugger. class CLIDebugger { - LLVMContext* Context; + const LLVMContext& Context; /// Dbg - The low-level LLVM debugger object that we use to do our dirty /// work. @@ -82,7 +82,7 @@ const SourceLanguage *CurrentLanguage; public: - CLIDebugger(LLVMContext* ctxt); + CLIDebugger(const LLVMContext& ctxt); /// getDebugger - Return the current LLVM debugger implementation being /// used. Modified: llvm/trunk/tools/llvm-db/llvm-db.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/llvm-db.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/llvm-db.cpp (original) +++ llvm/trunk/tools/llvm-db/llvm-db.cpp Wed Jul 1 16:22:36 2009 @@ -70,7 +70,7 @@ InputArgs.push_back(InputFile); // Create the CLI debugger... - CLIDebugger D(&Context); + CLIDebugger D(Context); // Initialize the debugger with the command line options we read... Debugger &Dbg = D.getDebugger(); Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original) +++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Wed Jul 1 16:22:36 2009 @@ -63,7 +63,7 @@ if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) { - M.reset(ParseBitcodeFile(Buffer, &Context, &ErrorMessage)); + M.reset(ParseBitcodeFile(Buffer, Context, &ErrorMessage)); delete Buffer; } Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original) +++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Wed Jul 1 16:22:36 2009 @@ -73,7 +73,7 @@ cerr << argv[0] << ": Error reading file '" + InputFilename + "'\n"; return 1; } else { - M.reset(ParseBitcodeFile(Buffer, &Context)); + M.reset(ParseBitcodeFile(Buffer, Context)); } delete Buffer; Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/llvm-ld.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/llvm-ld.cpp (original) +++ llvm/trunk/tools/llvm-ld/llvm-ld.cpp Wed Jul 1 16:22:36 2009 @@ -517,7 +517,7 @@ cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); // Construct a Linker (now that Verbose is set) - Linker TheLinker(progname, OutputFilename, &Context, Verbose); + Linker TheLinker(progname, OutputFilename, Context, Verbose); // Keep track of the native link items (versus the bitcode items) Linker::ItemList NativeLinkItems; Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/llvm-link/llvm-link.cpp (original) +++ llvm/trunk/tools/llvm-link/llvm-link.cpp Wed Jul 1 16:22:36 2009 @@ -49,7 +49,7 @@ // searches the link path for the specified file to try to find it... // static inline std::auto_ptr LoadFile(const std::string &FN, - LLVMContext* Context) { + const LLVMContext& Context) { sys::Path Filename; if (!Filename.set(FN)) { cerr << "Invalid file name: '" << FN << "'\n"; @@ -93,7 +93,7 @@ unsigned BaseArg = 0; std::string ErrorMessage; - std::auto_ptr Composite(LoadFile(InputFilenames[BaseArg], &Context)); + std::auto_ptr Composite(LoadFile(InputFilenames[BaseArg], Context)); if (Composite.get() == 0) { cerr << argv[0] << ": error loading file '" << InputFilenames[BaseArg] << "'\n"; @@ -101,7 +101,7 @@ } for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) { - std::auto_ptr M(LoadFile(InputFilenames[i], &Context)); + std::auto_ptr M(LoadFile(InputFilenames[i], Context)); if (M.get() == 0) { cerr << argv[0] << ": error loading file '" < - AutoArchive(Archive::OpenAndLoad(ArchivePath, &Context, &err_msg)); + AutoArchive(Archive::OpenAndLoad(ArchivePath, Context, &err_msg)); Archive* TheArchive = AutoArchive.get(); if (!TheArchive) throw err_msg; Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Wed Jul 1 16:22:36 2009 @@ -69,8 +69,8 @@ } -LTOCodeGenerator::LTOCodeGenerator() - : _context(new LLVMContext()), +LTOCodeGenerator::LTOCodeGenerator(const LLVMContext& Context) + : _context(Context), _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL), _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false), _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC), Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Wed Jul 1 16:22:36 2009 @@ -31,7 +31,7 @@ public: static const char* getVersionString(); - LTOCodeGenerator(); + LTOCodeGenerator(const llvm::LLVMContext& Context); ~LTOCodeGenerator(); bool addModule(class LTOModule*, std::string& errMsg); @@ -54,7 +54,7 @@ typedef llvm::StringMap StringSet; - llvm::LLVMContext* _context; + const llvm::LLVMContext& _context; llvm::Linker _linker; llvm::TargetMachine* _target; bool _emitDwarfDebugInfo; Modified: llvm/trunk/tools/lto/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Wed Jul 1 16:22:36 2009 @@ -69,7 +69,7 @@ bool LTOModule::isTargetMatch(MemoryBuffer* buffer, const char* triplePrefix) { OwningPtr mp(getBitcodeModuleProvider(buffer, - new LLVMContext())); + *new LLVMContext())); // on success, mp owns buffer and both are deleted at end of this method if ( !mp ) { delete buffer; @@ -86,7 +86,8 @@ { } -LTOModule* LTOModule::makeLTOModule(const char* path, LLVMContext* Context, +LTOModule* LTOModule::makeLTOModule(const char* path, + const LLVMContext& Context, std::string& errMsg) { OwningPtr buffer(MemoryBuffer::getFile(path, &errMsg)); @@ -112,7 +113,7 @@ LTOModule* LTOModule::makeLTOModule(const void* mem, size_t length, - LLVMContext* Context, + const LLVMContext& Context, std::string& errMsg) { OwningPtr buffer(makeBuffer(mem, length)); @@ -140,7 +141,8 @@ return Features.getString(); } -LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer, LLVMContext* Context, +LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer, + const LLVMContext& Context, std::string& errMsg) { // parse bitcode buffer Modified: llvm/trunk/tools/lto/LTOModule.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.h?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.h (original) +++ llvm/trunk/tools/lto/LTOModule.h Wed Jul 1 16:22:36 2009 @@ -52,10 +52,10 @@ const char* triplePrefix); static LTOModule* makeLTOModule(const char* path, - llvm::LLVMContext* Context, + const llvm::LLVMContext& Context, std::string& errMsg); static LTOModule* makeLTOModule(const void* mem, size_t length, - llvm::LLVMContext* Context, + const llvm::LLVMContext& Context, std::string& errMsg); const char* getTargetTriple(); @@ -91,7 +91,7 @@ const char* triplePrefix); static LTOModule* makeLTOModule(llvm::MemoryBuffer* buffer, - llvm::LLVMContext* Context, + const llvm::LLVMContext& Context, std::string& errMsg); static llvm::MemoryBuffer* makeBuffer(const void* mem, size_t length); Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Wed Jul 1 16:22:36 2009 @@ -88,7 +88,7 @@ // lto_module_t lto_module_create(const char* path, LLVMContextRef Ctxt) { - return LTOModule::makeLTOModule(path, llvm::unwrap(Ctxt), + return LTOModule::makeLTOModule(path, *llvm::unwrap(Ctxt), sLastErrorString); } @@ -100,7 +100,7 @@ lto_module_t lto_module_create_from_memory(const void* mem, size_t length, LLVMContextRef Ctxt) { - return LTOModule::makeLTOModule(mem, length, llvm::unwrap(Ctxt), + return LTOModule::makeLTOModule(mem, length, *llvm::unwrap(Ctxt), sLastErrorString); } @@ -158,9 +158,9 @@ // instantiates a code generator // returns NULL if there is an error // -lto_code_gen_t lto_codegen_create() +lto_code_gen_t lto_codegen_create(LLVMContextRef ContextRef) { - return new LTOCodeGenerator(); + return new LTOCodeGenerator(*llvm::unwrap(ContextRef)); } @@ -265,4 +265,4 @@ lto_codegen_debug_options(lto_code_gen_t cg, const char * opt) { cg->setCodeGenDebugOptions(opt); -} +} \ No newline at end of file Modified: llvm/trunk/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/tools/opt/opt.cpp (original) +++ llvm/trunk/tools/opt/opt.cpp Wed Jul 1 16:22:36 2009 @@ -327,7 +327,7 @@ std::auto_ptr M; if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) { - M.reset(ParseBitcodeFile(Buffer, &Context, &ErrorMessage)); + M.reset(ParseBitcodeFile(Buffer, Context, &ErrorMessage)); delete Buffer; } Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp (original) +++ llvm/trunk/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp Wed Jul 1 16:22:36 2009 @@ -65,7 +65,7 @@ class JITEventListenerTest : public testing::Test { protected: JITEventListenerTest() - : M(new Module("module", new LLVMContext())), + : M(new Module("module", *new LLVMContext())), EE(ExecutionEngine::createJIT(new ExistingModuleProvider(M))) { } Modified: llvm/trunk/unittests/VMCore/PassManagerTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/PassManagerTest.cpp?rev=74640&r1=74639&r2=74640&view=diff ============================================================================== --- llvm/trunk/unittests/VMCore/PassManagerTest.cpp (original) +++ llvm/trunk/unittests/VMCore/PassManagerTest.cpp Wed Jul 1 16:22:36 2009 @@ -272,7 +272,7 @@ char OnTheFlyTest::ID=0; TEST(PassManager, RunOnce) { - Module M("test-once", new LLVMContext()); + Module M("test-once", *new LLVMContext()); struct ModuleNDNM *mNDNM = new ModuleNDNM(); struct ModuleDNM *mDNM = new ModuleDNM(); struct ModuleNDM *mNDM = new ModuleNDM(); @@ -296,7 +296,7 @@ } TEST(PassManager, ReRun) { - Module M("test-rerun", new LLVMContext()); + Module M("test-rerun", *new LLVMContext()); struct ModuleNDNM *mNDNM = new ModuleNDNM(); struct ModuleDNM *mDNM = new ModuleDNM(); struct ModuleNDM *mNDM = new ModuleNDM(); @@ -387,7 +387,7 @@ Module* makeLLVMModule() { // Module Construction - Module* mod = new Module("test-mem", new LLVMContext()); + Module* mod = new Module("test-mem", *new LLVMContext()); mod->setDataLayout("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" "i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-" "a0:0:64-s0:64:64-f80:128:128"); From bob.wilson at apple.com Wed Jul 1 16:22:45 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 01 Jul 2009 21:22:45 -0000 Subject: [llvm-commits] [llvm] r74641 - /llvm/trunk/lib/Target/ARM/ARMAddressingModes.h Message-ID: <200907012122.n61LMj1U025053@zion.cs.uiuc.edu> Author: bwilson Date: Wed Jul 1 16:22:45 2009 New Revision: 74641 URL: http://llvm.org/viewvc/llvm-project?rev=74641&view=rev Log: Fix up a comment: besides the >80col lines, the operation for this addressing mode is encoded in the second operand, not the third. Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAddressingModes.h?rev=74641&r1=74640&r2=74641&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMAddressingModes.h (original) +++ llvm/trunk/lib/Target/ARM/ARMAddressingModes.h Wed Jul 1 16:22:45 2009 @@ -459,13 +459,13 @@ // // addrmode5 := reg +/- imm8*4 // - // The first operand is always a Reg. The third field encodes the operation - // in bit 8, the immediate in bits 0-7. + // The first operand is always a Reg. The second operand encodes the + // operation in bit 8 and the immediate in bits 0-7. // - // This can also be used for FP load/store multiple ops. The third field encodes - // writeback mode in bit 8, the number of registers (or 2 times the number of - // registers for DPR ops) in bits 0-7. In addition, bit 9-11 encodes one of the - // following two sub-modes: + // This is also used for FP load/store multiple ops. The second operand + // encodes the writeback mode in bit 8 and the number of registers (or 2 + // times the number of registers for DPR ops) in bits 0-7. In addition, + // bits 9-11 encode one of the following two sub-modes: // // IA - Increment after // DB - Decrement before From resistor at mac.com Wed Jul 1 16:24:00 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 21:24:00 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74643 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-linker-hack.cpp Message-ID: <200907012124.n61LO0P1025120@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 16:24:00 2009 New Revision: 74643 URL: http://llvm.org/viewvc/llvm-project?rev=74643&view=rev Log: Hold the LLVMContext by reference rather than by pointer. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=74643&r1=74642&r2=74643&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Jul 1 16:24:00 2009 @@ -87,7 +87,6 @@ static int flag_no_implicit_float = 0; // Global state for the LLVM backend. -LLVMContext* Context = 0; Module *TheModule = 0; DebugInfo *TheDebugInfo = 0; TargetMachine *TheTarget = 0; @@ -420,8 +419,7 @@ int pseudo_argc = Args.size()-1; cl::ParseCommandLineOptions(pseudo_argc, (char**)&Args[0]); - Context = new LLVMContext(); - TheModule = new Module("", Context); + TheModule = new Module("", getGlobalContext()); // If the target wants to override the architecture, e.g. turning // powerpc-darwin-... into powerpc64-darwin-... when -m64 is enabled, do so @@ -525,7 +523,7 @@ memcpy((char*)MB->getBufferStart(), Buffer, Size); std::string ErrMsg; - TheModule = ParseBitcodeFile(MB, Context, &ErrMsg); + TheModule = ParseBitcodeFile(MB, getGlobalContext(), &ErrMsg); delete MB; // FIXME - Do not disable debug info while writing pch. Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=74643&r1=74642&r2=74643&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Wed Jul 1 16:24:00 2009 @@ -20,6 +20,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/Analysis/Verifier.h" @@ -91,6 +92,8 @@ llvm::createLoopDeletionPass(); llvm::createFunctionAttrsPass(); llvm::createPrintModulePass(0); + + llvm::getGlobalContext(); llvm::PrettyStackTraceProgram::PrettyStackTraceProgram(0, 0); llvm::DIFactory::DIFactory(*MP->getModule()); From dpatel at apple.com Wed Jul 1 16:26:41 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 21:26:41 -0000 Subject: [llvm-commits] [llvm] r74644 - /llvm/trunk/include/llvm/CodeGen/MachineOperand.h Message-ID: <200907012126.n61LQfqA025223@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 16:26:41 2009 New Revision: 74644 URL: http://llvm.org/viewvc/llvm-project?rev=74644&view=rev Log: Add getMDNode() to access metadata node. Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=74644&r1=74643&r2=74644&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Wed Jul 1 16:26:41 2009 @@ -300,6 +300,10 @@ return Contents.OffsetedInfo.Val.GV; } + MDNode *getMDNode() const { + return Contents.OffsetedInfo.Val.Node; + } + int64_t getOffset() const { assert((isGlobal() || isSymbol() || isCPI()) && "Wrong MachineOperand accessor"); From dalej at apple.com Wed Jul 1 16:26:30 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 1 Jul 2009 14:26:30 -0700 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: References: Message-ID: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> On Jun 27, 2009, at 8:15 AMPDT, Tilmann Scheller wrote: > Hello, > > attached is a series of patches which implement the SVR4 ABI for > PowerPC. Patches were made against revision 74382 and need to be > applied in order. A patch which adds SVR4 support to llvm-gcc will > follow soon. OK, I've looked these over. They do not break any of the compatibility tests on Darwin, and I'm pretty sure none of the code changes will break Darwin. I haven't looked over the SVR4-specific bits too carefully, but didn't see anything obviously wrong. PPCCallingConv.td and PPCRegisterInfo.td say they have no newline at EOF, please fix those. One thing I'm concerned about is that you're replacing the existing "ELF" ABI with the "SVR4" ABI. They seem to be different in a few areas, like callee-saved register usage. Are you sure it is OK to destroy the older one? It looks to me like somebody familiar with a spec had set up the register usage to be correct for their "ELF" target. Nicolas Geoffray seems to have done most of what I'm talking about, so I think he should comment. I think these might need to coexist as subdivisions of "elf", as on x86-32. > The current state of LLVM on 32-bit PowerPC Linux: > compat.exp passes all tests (those are the ABI tests from the GCC > test suite) > C-only nightly tester results: 1638 TEST-PASS / 96 TEST-FAIL > llvm-gcc bootstraps at -O0 with a stage 2/3 comparison failure of > varasm.o > > These patches were not tested on Darwin PPC, so it would be really > great if someone with a Darwin PPC nightly tester (Evan? :) ) could > make a run with the patches applied. Just to make sure that I did not > introduce any major regressions :) > > Feedback welcome! > > Greetings, > > Tilmann -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Small-cleanups-in-the-PowerPC-backend.patch Type: text/x-patch Size: 12107 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/a000b04e/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Add-NumFixedArgs-attribute-to-CallSDNode-which-indic.patch Type: text/x-patch Size: 19567 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/a000b04e/attachment-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-Implement-the-SVR4-ABI-for-PowerPC.patch Type: text/x-patch Size: 66356 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/a000b04e/attachment-0002.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-Refactor-ABI-code-in-the-PowerPC-backend.patch Type: text/x-patch Size: 81794 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/a000b04e/attachment-0003.bin -------------- next part -------------- > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From daniel at zuster.org Wed Jul 1 16:36:28 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 21:36:28 -0000 Subject: [llvm-commits] [llvm] r74645 - /llvm/trunk/lib/Support/SystemUtils.cpp Message-ID: <200907012136.n61LaSHl025618@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 16:36:28 2009 New Revision: 74645 URL: http://llvm.org/viewvc/llvm-project?rev=74645&view=rev Log: Tweak FindExecutable so that relative executable paths work as well. Modified: llvm/trunk/lib/Support/SystemUtils.cpp Modified: llvm/trunk/lib/Support/SystemUtils.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SystemUtils.cpp?rev=74645&r1=74644&r2=74645&view=diff ============================================================================== --- llvm/trunk/lib/Support/SystemUtils.cpp (original) +++ llvm/trunk/lib/Support/SystemUtils.cpp Wed Jul 1 16:36:28 2009 @@ -43,9 +43,10 @@ #undef FindExecutable // needed on windows :( sys::Path llvm::FindExecutable(const std::string &ExeName, const std::string &ProgramPath) { - // First check if the given name is a fully qualified path to an executable + // First check if the given name is already a valid path to an executable. sys::Path Result(ExeName); - if (Result.isAbsolute() && Result.canExecute()) + Result.makeAbsolute(); + if (Result.canExecute()) return Result; // Otherwise check the directory that the calling program is in. We can do From daniel at zuster.org Wed Jul 1 16:36:50 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 1 Jul 2009 14:36:50 -0700 Subject: [llvm-commits] [PATCH] Fix for llvm::FindExecutable (fails to find executable if path is provided) In-Reply-To: References: <54EF3DC75DF14CA69492E01CACA5A320@andreic6e7fe55> <39D1DD86-F51E-4F13-A744-772E494C4691@apple.com> Message-ID: <6a8523d60907011436l67bb511eu73aca1408d01471e@mail.gmail.com> I applied this this morning but forgot to send an email about it, I applied it here: http://llvm.org/viewvc/llvm-project?view=rev&revision=74608 Your comment below makes sense, however, so I tweaked it again here: http://llvm.org/viewvc/llvm-project?view=rev&revision=74645 so that relative paths work. Does this look reasonable to you? Also, does it work? :) - Daniel On Wed, Jul 1, 2009 at 10:04 AM, Viktor Kutuzov wrote: > Hi Chris, > >> Please use sys::Path::isAbsolute to check to see if it is an absolute > > I didn't want to check if it is an absolute, I wanted to check if there is any directory part (absolute or relative). > Is there anything wrong with relative path? > It seems the right way to do this would be adding Path::hasDirname() method and use it there instead. > > What do you think? > > Best regards, > Viktor > > ----- Original Message ----- > From: "Chris Lattner" > To: "Commit Messages and Patches for LLVM" > Cc: "Viktor Kutuzov" > Sent: Wednesday, July 01, 2009 8:44 AM > Subject: Re: [llvm-commits] [PATCH] Fix for llvm::FindExecutable (fails to find executable if path is provided) > > >> >> On Jun 30, 2009, at 11:52 PM, Viktor Kutuzov wrote: >> >>> Hello everyone, >>> >>> The llvm::FindExecutable fails to find a named executible if full >>> path is provided. >> >> Hi Viktor, >> >> Please use sys::Path::isAbsolute to check to see if it is an absolute >> path, this will work on windows as well as unix. ?Thanks, >> >> -Chris >> >>> >>> Please find the patch attached. >>> >>> Best regards, >>> Viktor >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From gohman at apple.com Wed Jul 1 16:38:46 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Jul 2009 21:38:46 -0000 Subject: [llvm-commits] [llvm] r74646 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/bitcast-scalar-to-vector.ll Message-ID: <200907012138.n61LclrQ025725@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 1 16:38:46 2009 New Revision: 74646 URL: http://llvm.org/viewvc/llvm-project?rev=74646&view=rev Log: Fix an instcombine abort on a scalar-to-vector bitcast. This fixes PR4487. Added: llvm/trunk/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=74646&r1=74645&r2=74646&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Jul 1 16:38:46 2009 @@ -1085,8 +1085,22 @@ break; } case Instruction::BitCast: - if (!I->getOperand(0)->getType()->isInteger()) + if (!I->getOperand(0)->getType()->isIntOrIntVector()) return false; // vector->int or fp->int? + + if (const VectorType *DstVTy = dyn_cast(I->getType())) { + if (const VectorType *SrcVTy = + dyn_cast(I->getOperand(0)->getType())) { + if (DstVTy->getNumElements() != SrcVTy->getNumElements()) + // Don't touch a bitcast between vectors of different element counts. + return false; + } else + // Don't touch a scalar-to-vector bitcast. + return false; + } else if (isa(I->getOperand(0)->getType())) + // Don't touch a vector-to-scalar bitcast. + return false; + if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, RHSKnownZero, RHSKnownOne, Depth+1)) return I; Added: llvm/trunk/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll?rev=74646&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll Wed Jul 1 16:38:46 2009 @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0} +; PR4487 + +; Bitcasts between vectors and scalars are valid, despite being ill-advised. + +define i32 @test(i64 %a) { +bb20: + %t1 = bitcast i64 %a to <2 x i32> + %t2 = bitcast i64 %a to <2 x i32> + %t3 = xor <2 x i32> %t1, %t2 + %t4 = extractelement <2 x i32> %t3, i32 0 + ret i32 %t4 +} + From a at bolka.at Wed Jul 1 16:45:24 2009 From: a at bolka.at (Andreas Bolka) Date: Wed, 01 Jul 2009 21:45:24 -0000 Subject: [llvm-commits] [llvm] r74647 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp Message-ID: <200907012145.n61LjO5i025939@zion.cs.uiuc.edu> Author: abolka Date: Wed Jul 1 16:45:23 2009 New Revision: 74647 URL: http://llvm.org/viewvc/llvm-project?rev=74647&view=rev Log: Use AA to check objects before LDA. Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h?rev=74647&r1=74646&r2=74647&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Wed Jul 1 16:45:23 2009 @@ -26,12 +26,14 @@ namespace llvm { + class AliasAnalysis; class AnalysisUsage; class ScalarEvolution; class Value; class LoopDependenceAnalysis : public LoopPass { Loop *L; + AliasAnalysis *AA; ScalarEvolution *SE; public: Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=74647&r1=74646&r2=74647&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Wed Jul 1 16:45:23 2009 @@ -18,11 +18,13 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "lda" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/LoopDependenceAnalysis.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Instructions.h" #include "llvm/Support/Debug.h" +#include "llvm/Target/TargetData.h" using namespace llvm; LoopPass *llvm::createLoopDependenceAnalysisPass() { @@ -91,25 +93,20 @@ Value *dstPtr = GetPointerOperand(dst); const Value *srcObj = srcPtr->getUnderlyingObject(); const Value *dstObj = dstPtr->getUnderlyingObject(); - const Type *srcTy = srcObj->getType(); - const Type *dstTy = dstObj->getType(); + AliasAnalysis::AliasResult alias = AA->alias( + srcObj, AA->getTargetData().getTypeStoreSize(srcObj->getType()), + dstObj, AA->getTargetData().getTypeStoreSize(dstObj->getType())); - // For now, we only work on (pointers to) global or stack-allocated array - // values, as we know that their underlying memory areas will not overlap. - // MAYBE: relax this and test for aliasing? - if (!((isa(srcObj) || isa(srcObj)) && - (isa(dstObj) || isa(dstObj)) && - isa(srcTy) && - isa(dstTy) && - isa(cast(srcTy)->getElementType()) && - isa(cast(dstTy)->getElementType()))) + // If we don't know whether or not the two objects alias, assume dependence. + if (alias == AliasAnalysis::MayAlias) return true; - // If the arrays are different, the underlying memory areas do not overlap - // and the memory accesses are therefore independent. - if (srcObj != dstObj) + // If the objects noalias, they are distinct, accesses are independent. + if (alias == AliasAnalysis::NoAlias) return false; + // TODO: the underlying objects MustAlias, test for dependence + // We couldn't establish a more precise result, so we have to conservatively // assume full dependence. return true; @@ -121,12 +118,14 @@ bool LoopDependenceAnalysis::runOnLoop(Loop *L, LPPassManager &) { this->L = L; + AA = &getAnalysis(); SE = &getAnalysis(); return false; } void LoopDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); + AU.addRequiredTransitive(); AU.addRequiredTransitive(); } From resistor at mac.com Wed Jul 1 16:57:45 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 21:57:45 -0000 Subject: [llvm-commits] [llvm] r74648 - in /llvm/trunk: include/llvm/LLVMContext.h lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/LLVMContext.cpp Message-ID: <200907012157.n61LvjPr026303@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 16:57:44 2009 New Revision: 74648 URL: http://llvm.org/viewvc/llvm-project?rev=74648&view=rev Log: Convert LLParser to use LLVMContext for creating constants. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74648&r1=74647&r2=74648&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Wed Jul 1 16:57:44 2009 @@ -54,147 +54,151 @@ ~LLVMContext(); // ConstantInt accessors - ConstantInt* getConstantIntTrue(); - ConstantInt* getConstantIntFalse(); + ConstantInt* getConstantIntTrue() const; + ConstantInt* getConstantIntFalse() const; ConstantInt* getConstantInt(const IntegerType* Ty, uint64_t V, - bool isSigned = false); - ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V); - ConstantInt* getConstantInt(const APInt& V); - Constant* getConstantInt(const Type* Ty, const APInt& V); - ConstantInt* getAllOnesConstantInt(const Type* Ty); + bool isSigned = false) const; + ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V) const; + ConstantInt* getConstantInt(const APInt& V) const; + Constant* getConstantInt(const Type* Ty, const APInt& V) const; + ConstantInt* getAllOnesConstantInt(const Type* Ty) const; // ConstantPointerNull accessors - ConstantPointerNull* getConstantPointerNull(const PointerType* T); + ConstantPointerNull* getConstantPointerNull(const PointerType* T) const; // ConstantStruct accessors Constant* getConstantStruct(const StructType* T, - const std::vector& V); + const std::vector& V) const; Constant* getConstantStruct(const std::vector& V, - bool Packed = false); + bool Packed = false) const; Constant* getConstantStruct(Constant* const *Vals, unsigned NumVals, - bool Packed = false); + bool Packed = false) const; // ConstantAggregateZero accessors - ConstantAggregateZero* getConstantAggregateZero(const Type* Ty); + ConstantAggregateZero* getConstantAggregateZero(const Type* Ty) const; // ConstantArray accessors Constant* getConstantArray(const ArrayType* T, - const std::vector& V); + const std::vector& V) const; Constant* getConstantArray(const ArrayType* T, Constant* const* Vals, - unsigned NumVals); + unsigned NumVals) const; Constant* getConstantArray(const std::string& Initializer, - bool AddNull = false); + bool AddNull = false) const; // ConstantExpr accessors - Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2); - Constant* getConstantExprTrunc(Constant* C, const Type* Ty); - Constant* getConstantExprSExt(Constant* C, const Type* Ty); - Constant* getConstantExprZExt(Constant* C, const Type* Ty); - Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty); - Constant* getConstantExprFPExtend(Constant* C, const Type* Ty); - Constant* getConstantExprUIToFP(Constant* C, const Type* Ty); - Constant* getConstantExprSIToFP(Constant* C, const Type* Ty); - Constant* getConstantExprFPToUI(Constant* C, const Type* Ty); - Constant* getConstantExprFPToSI(Constant* C, const Type* Ty); - Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty); - Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty); - Constant* getConstantExprBitCast(Constant* C, const Type* Ty); - Constant* getConstantExprCast(unsigned ops, Constant* C, const Type* Ty); - Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty); - Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty); - Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty); - Constant* getConstantExprPointerCast(Constant* C, const Type* Ty); + Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2) const; + Constant* getConstantExprTrunc(Constant* C, const Type* Ty) const; + Constant* getConstantExprSExt(Constant* C, const Type* Ty) const; + Constant* getConstantExprZExt(Constant* C, const Type* Ty) const; + Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty) const; + Constant* getConstantExprFPExtend(Constant* C, const Type* Ty) const; + Constant* getConstantExprUIToFP(Constant* C, const Type* Ty) const; + Constant* getConstantExprSIToFP(Constant* C, const Type* Ty) const; + Constant* getConstantExprFPToUI(Constant* C, const Type* Ty) const; + Constant* getConstantExprFPToSI(Constant* C, const Type* Ty) const; + Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty) const; + Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty) const; + Constant* getConstantExprBitCast(Constant* C, const Type* Ty) const; + Constant* getConstantExprCast(unsigned ops, Constant* C, + const Type* Ty) const; + Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty) const; + Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty) const; + Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty) const; + Constant* getConstantExprPointerCast(Constant* C, const Type* Ty) const; Constant* getConstantExprIntegerCast(Constant* C, const Type* Ty, - bool isSigned); - Constant* getConstantExprFPCast(Constant* C, const Type* Ty); - Constant* getConstantExprSelect(Constant* C, Constant* V1, Constant* V2); - Constant* getConstantExprAlignOf(const Type* Ty); + bool isSigned) const; + Constant* getConstantExprFPCast(Constant* C, const Type* Ty) const; + Constant* getConstantExprSelect(Constant* C, Constant* V1, + Constant* V2) const; + Constant* getConstantExprAlignOf(const Type* Ty) const; Constant* getConstantExprCompare(unsigned short pred, - Constant* C1, Constant* C2); - Constant* getConstantExprNeg(Constant* C); - Constant* getConstantExprFNeg(Constant* C); - Constant* getConstantExprNot(Constant* C); - Constant* getConstantExprAdd(Constant* C1, Constant* C2); - Constant* getConstantExprFAdd(Constant* C1, Constant* C2); - Constant* getConstantExprSub(Constant* C1, Constant* C2); - Constant* getConstantExprFSub(Constant* C1, Constant* C2); - Constant* getConstantExprMul(Constant* C1, Constant* C2); - Constant* getConstantExprFMul(Constant* C1, Constant* C2); - Constant* getConstantExprUDiv(Constant* C1, Constant* C2); - Constant* getConstantExprSDiv(Constant* C1, Constant* C2); - Constant* getConstantExprFDiv(Constant* C1, Constant* C2); - Constant* getConstantExprURem(Constant* C1, Constant* C2); - Constant* getConstantExprSRem(Constant* C1, Constant* C2); - Constant* getConstantExprFRem(Constant* C1, Constant* C2); - Constant* getConstantExprAnd(Constant* C1, Constant* C2); - Constant* getConstantExprOr(Constant* C1, Constant* C2); - Constant* getConstantExprXor(Constant* C1, Constant* C2); + Constant* C1, Constant* C2) const; + Constant* getConstantExprNeg(Constant* C) const; + Constant* getConstantExprFNeg(Constant* C) const; + Constant* getConstantExprNot(Constant* C) const; + Constant* getConstantExprAdd(Constant* C1, Constant* C2) const; + Constant* getConstantExprFAdd(Constant* C1, Constant* C2) const; + Constant* getConstantExprSub(Constant* C1, Constant* C2) const; + Constant* getConstantExprFSub(Constant* C1, Constant* C2) const; + Constant* getConstantExprMul(Constant* C1, Constant* C2) const; + Constant* getConstantExprFMul(Constant* C1, Constant* C2) const; + Constant* getConstantExprUDiv(Constant* C1, Constant* C2) const; + Constant* getConstantExprSDiv(Constant* C1, Constant* C2) const; + Constant* getConstantExprFDiv(Constant* C1, Constant* C2) const; + Constant* getConstantExprURem(Constant* C1, Constant* C2) const; + Constant* getConstantExprSRem(Constant* C1, Constant* C2) const; + Constant* getConstantExprFRem(Constant* C1, Constant* C2) const; + Constant* getConstantExprAnd(Constant* C1, Constant* C2) const; + Constant* getConstantExprOr(Constant* C1, Constant* C2) const; + Constant* getConstantExprXor(Constant* C1, Constant* C2) const; Constant* getConstantExprICmp(unsigned short pred, Constant* LHS, - Constant* RHS); + Constant* RHS) const; Constant* getConstantExprFCmp(unsigned short pred, Constant* LHS, - Constant* RHS); + Constant* RHS) const; Constant* getConstantExprVICmp(unsigned short pred, Constant* LHS, - Constant* RHS); + Constant* RHS) const; Constant* getConstantExprVFCmp(unsigned short pred, Constant* LHS, - Constant* RHS); - Constant* getConstantExprShl(Constant* C1, Constant* C2); - Constant* getConstantExprLShr(Constant* C1, Constant* C2); - Constant* getConstantExprAShr(Constant* C1, Constant* C2); + Constant* RHS) const; + Constant* getConstantExprShl(Constant* C1, Constant* C2) const; + Constant* getConstantExprLShr(Constant* C1, Constant* C2) const; + Constant* getConstantExprAShr(Constant* C1, Constant* C2) const; Constant* getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList, - unsigned NumIdx); + unsigned NumIdx) const; Constant* getConstantExprGetElementPtr(Constant* C, Value* const* IdxList, - unsigned NumIdx); - Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx); + unsigned NumIdx) const; + Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx) const; Constant* getConstantExprInsertElement(Constant* Vec, Constant* Elt, - Constant* Idx); + Constant* Idx) const; Constant* getConstantExprShuffleVector(Constant* V1, Constant* V2, - Constant* Mask); + Constant* Mask) const; Constant* getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList, - unsigned NumIdx); + unsigned NumIdx) const; Constant* getConstantExprInsertValue(Constant* Agg, Constant* Val, const unsigned* IdxList, - unsigned NumIdx); - Constant* getZeroValueForNegation(const Type* Ty); + unsigned NumIdx) const; + Constant* getZeroValueForNegation(const Type* Ty) const; // ConstantFP accessors - ConstantFP* getConstantFP(const APFloat& V); - Constant* getConstantFP(const Type* Ty, double V); - ConstantFP* getConstantFPNegativeZero(const Type* Ty); + ConstantFP* getConstantFP(const APFloat& V) const; + Constant* getConstantFP(const Type* Ty, double V) const; + ConstantFP* getConstantFPNegativeZero(const Type* Ty) const; // ConstantVector accessors Constant* getConstantVector(const VectorType* T, - const std::vector& V); - Constant* getConstantVector(const std::vector& V); - Constant* getConstantVector(Constant* const* Vals, unsigned NumVals); - ConstantVector* getConstantVectorAllOnes(const VectorType* Ty); + const std::vector& V) const; + Constant* getConstantVector(const std::vector& V) const; + Constant* getConstantVector(Constant* const* Vals, unsigned NumVals) const; + ConstantVector* getConstantVectorAllOnes(const VectorType* Ty) const; // FunctionType accessors FunctionType* getFunctionType(const Type* Result, const std::vector& Params, - bool isVarArg); + bool isVarArg) const; // IntegerType accessors - const IntegerType* getIntegerType(unsigned NumBits); + const IntegerType* getIntegerType(unsigned NumBits) const; // OpaqueType accessors - OpaqueType* getOpaqueType(); + OpaqueType* getOpaqueType() const; // StructType accessors StructType* getStructType(const std::vector& Params, - bool isPacked = false); + bool isPacked = false) const; // ArrayType accessors - ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements); + ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements) const; // PointerType accessors - PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace); - PointerType* getPointerTypeUnqualified(const Type* ElementType); + PointerType* getPointerType(const Type* ElementType, + unsigned AddressSpace) const; + PointerType* getPointerTypeUnqualified(const Type* ElementType) const; // VectorType accessors - VectorType* getVectorType(const Type* ElementType, unsigned NumElements); - VectorType* getVectorTypeInteger(const VectorType* VTy); - VectorType* getVectorTypeExtendedElement(const VectorType* VTy); - VectorType* getVectorTypeTruncatedElement(const VectorType* VTy); + VectorType* getVectorType(const Type* ElementType, + unsigned NumElements) const; + VectorType* getVectorTypeInteger(const VectorType* VTy) const; + VectorType* getVectorTypeExtendedElement(const VectorType* VTy) const; + VectorType* getVectorTypeTruncatedElement(const VectorType* VTy) const; }; /// FOR BACKWARDS COMPATIBILITY - Returns a global context. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74648&r1=74647&r2=74648&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul 1 16:57:44 2009 @@ -18,6 +18,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" +#include "llvm/LLVMContext.h" #include "llvm/MDNode.h" #include "llvm/Module.h" #include "llvm/ValueSymbolTable.h" @@ -1653,11 +1654,11 @@ ID.Kind = ValID::t_APFloat; break; case lltok::kw_true: - ID.ConstantVal = ConstantInt::getTrue(); + ID.ConstantVal = Context.getConstantIntTrue(); ID.Kind = ValID::t_Constant; break; case lltok::kw_false: - ID.ConstantVal = ConstantInt::getFalse(); + ID.ConstantVal = Context.getConstantIntFalse(); ID.Kind = ValID::t_Constant; break; case lltok::kw_null: ID.Kind = ValID::t_Null; break; @@ -2037,7 +2038,7 @@ if (!isa(Ty)) return Error(ID.Loc, "integer constant must have integer type"); ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits()); - V = ConstantInt::get(ID.APSIntVal); + V = Context.getConstantInt(ID.APSIntVal); return false; case ValID::t_APFloat: if (!Ty->isFloatingPoint() || Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=74648&r1=74647&r2=74648&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Wed Jul 1 16:57:44 2009 @@ -15,6 +15,7 @@ #define LLVM_ASMPARSER_LLPARSER_H #include "LLLexer.h" +#include "llvm/Module.h" #include "llvm/Type.h" #include @@ -29,13 +30,14 @@ class GlobalValue; class MDString; class MDNode; + class LLVMContext; struct ValID; class LLParser { public: typedef LLLexer::LocTy LocTy; private: - + const LLVMContext& Context; LLLexer Lex; Module *M; @@ -72,7 +74,8 @@ std::map > ForwardRefValIDs; std::vector NumberedVals; public: - LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : Lex(F, Err), M(m) {} + LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : + Context(M->getContext()), Lex(F, Err), M(m) {} bool Run(); private: Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74648&r1=74647&r2=74648&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Wed Jul 1 16:57:44 2009 @@ -22,7 +22,7 @@ static ManagedStatic GlobalContext; -const LLVMContext& llvm::getGlobalContext() { +LLVMContext& llvm::getGlobalContext() { return *GlobalContext; } @@ -30,420 +30,438 @@ LLVMContext::~LLVMContext() { delete pImpl; } // ConstantInt accessors. -ConstantInt* LLVMContext::getConstantIntTrue() { +ConstantInt* LLVMContext::getConstantIntTrue() const { return ConstantInt::getTrue(); } -ConstantInt* LLVMContext::getConstantIntFalse() { +ConstantInt* LLVMContext::getConstantIntFalse() const { return ConstantInt::getFalse(); } ConstantInt* LLVMContext::getConstantInt(const IntegerType* Ty, uint64_t V, - bool isSigned) { + bool isSigned) const { return ConstantInt::get(Ty, V, isSigned); } ConstantInt* LLVMContext::getConstantIntSigned(const IntegerType* Ty, - int64_t V) { + int64_t V) const { return ConstantInt::getSigned(Ty, V); } -ConstantInt* LLVMContext::getConstantInt(const APInt& V) { +ConstantInt* LLVMContext::getConstantInt(const APInt& V) const { return ConstantInt::get(V); } -Constant* LLVMContext::getConstantInt(const Type* Ty, const APInt& V) { +Constant* LLVMContext::getConstantInt(const Type* Ty, const APInt& V) const { return ConstantInt::get(Ty, V); } -ConstantInt* LLVMContext::getAllOnesConstantInt(const Type* Ty) { +ConstantInt* LLVMContext::getAllOnesConstantInt(const Type* Ty) const { return ConstantInt::getAllOnesValue(Ty); } // ConstantPointerNull accessors. -ConstantPointerNull* LLVMContext::getConstantPointerNull(const PointerType* T) { +ConstantPointerNull* +LLVMContext::getConstantPointerNull(const PointerType* T) const { return ConstantPointerNull::get(T); } // ConstantStruct accessors. Constant* LLVMContext::getConstantStruct(const StructType* T, - const std::vector& V) { + const std::vector& V) const { return ConstantStruct::get(T, V); } Constant* LLVMContext::getConstantStruct(const std::vector& V, - bool Packed) { + bool Packed) const { return ConstantStruct::get(V, Packed); } Constant* LLVMContext::getConstantStruct(Constant* const *Vals, - unsigned NumVals, bool Packed) { + unsigned NumVals, bool Packed) const { return ConstantStruct::get(Vals, NumVals, Packed); } // ConstantAggregateZero accessors. -ConstantAggregateZero* LLVMContext::getConstantAggregateZero(const Type* Ty) { +ConstantAggregateZero* +LLVMContext::getConstantAggregateZero(const Type* Ty) const { return ConstantAggregateZero::get(Ty); } // ConstantArray accessors. Constant* LLVMContext::getConstantArray(const ArrayType* T, - const std::vector& V) { + const std::vector& V) const { return ConstantArray::get(T, V); } Constant* LLVMContext::getConstantArray(const ArrayType* T, Constant* const* Vals, - unsigned NumVals) { + unsigned NumVals) const { return ConstantArray::get(T, Vals, NumVals); } Constant* LLVMContext::getConstantArray(const std::string& Initializer, - bool AddNull) { + bool AddNull) const { return ConstantArray::get(Initializer, AddNull); } // ConstantExpr accessors. Constant* LLVMContext::getConstantExpr(unsigned Opcode, Constant* C1, - Constant* C2) { + Constant* C2) const { return ConstantExpr::get(Opcode, C1, C2); } -Constant* LLVMContext::getConstantExprTrunc(Constant* C, const Type* Ty) { +Constant* LLVMContext::getConstantExprTrunc(Constant* C, const Type* Ty) const { return ConstantExpr::getTrunc(C, Ty); } -Constant* LLVMContext::getConstantExprSExt(Constant* C, const Type* Ty) { +Constant* LLVMContext::getConstantExprSExt(Constant* C, const Type* Ty) const { return ConstantExpr::getSExt(C, Ty); } -Constant* LLVMContext::getConstantExprZExt(Constant* C, const Type* Ty) { +Constant* LLVMContext::getConstantExprZExt(Constant* C, const Type* Ty) const { return ConstantExpr::getZExt(C, Ty); } -Constant* LLVMContext::getConstantExprFPTrunc(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprFPTrunc(Constant* C, const Type* Ty) const { return ConstantExpr::getFPTrunc(C, Ty); } -Constant* LLVMContext::getConstantExprFPExtend(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprFPExtend(Constant* C, const Type* Ty) const { return ConstantExpr::getFPExtend(C, Ty); } -Constant* LLVMContext::getConstantExprUIToFP(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprUIToFP(Constant* C, const Type* Ty) const { return ConstantExpr::getUIToFP(C, Ty); } -Constant* LLVMContext::getConstantExprSIToFP(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprSIToFP(Constant* C, const Type* Ty) const { return ConstantExpr::getSIToFP(C, Ty); } -Constant* LLVMContext::getConstantExprFPToUI(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprFPToUI(Constant* C, const Type* Ty) const { return ConstantExpr::getFPToUI(C, Ty); } -Constant* LLVMContext::getConstantExprFPToSI(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprFPToSI(Constant* C, const Type* Ty) const { return ConstantExpr::getFPToSI(C, Ty); } -Constant* LLVMContext::getConstantExprPtrToInt(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprPtrToInt(Constant* C, const Type* Ty) const { return ConstantExpr::getPtrToInt(C, Ty); } -Constant* LLVMContext::getConstantExprIntToPtr(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprIntToPtr(Constant* C, const Type* Ty) const { return ConstantExpr::getIntToPtr(C, Ty); } -Constant* LLVMContext::getConstantExprBitCast(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprBitCast(Constant* C, const Type* Ty) const { return ConstantExpr::getBitCast(C, Ty); } Constant* LLVMContext::getConstantExprCast(unsigned ops, Constant* C, - const Type* Ty) { + const Type* Ty) const { return ConstantExpr::getCast(ops, C, Ty); } Constant* LLVMContext::getConstantExprZExtOrBitCast(Constant* C, - const Type* Ty) { + const Type* Ty) const { return ConstantExpr::getZExtOrBitCast(C, Ty); } Constant* LLVMContext::getConstantExprSExtOrBitCast(Constant* C, - const Type* Ty) { + const Type* Ty) const { return ConstantExpr::getSExtOrBitCast(C, Ty); } Constant* LLVMContext::getConstantExprTruncOrBitCast(Constant* C, - const Type* Ty) { + const Type* Ty) const { return ConstantExpr::getTruncOrBitCast(C, Ty); } -Constant* LLVMContext::getConstantExprPointerCast(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprPointerCast(Constant* C, const Type* Ty) const { return ConstantExpr::getPointerCast(C, Ty); } Constant* LLVMContext::getConstantExprIntegerCast(Constant* C, const Type* Ty, - bool isSigned) { + bool isSigned) const { return ConstantExpr::getIntegerCast(C, Ty, isSigned); } -Constant* LLVMContext::getConstantExprFPCast(Constant* C, const Type* Ty) { +Constant* +LLVMContext::getConstantExprFPCast(Constant* C, const Type* Ty) const { return ConstantExpr::getFPCast(C, Ty); } Constant* LLVMContext::getConstantExprSelect(Constant* C, Constant* V1, - Constant* V2) { + Constant* V2) const { return ConstantExpr::getSelect(C, V1, V2); } -Constant* LLVMContext::getConstantExprAlignOf(const Type* Ty) { +Constant* LLVMContext::getConstantExprAlignOf(const Type* Ty) const { return ConstantExpr::getAlignOf(Ty); } Constant* LLVMContext::getConstantExprCompare(unsigned short pred, - Constant* C1, Constant* C2) { + Constant* C1, Constant* C2) const { return ConstantExpr::getCompare(pred, C1, C2); } -Constant* LLVMContext::getConstantExprNeg(Constant* C) { +Constant* LLVMContext::getConstantExprNeg(Constant* C) const { return ConstantExpr::getNeg(C); } -Constant* LLVMContext::getConstantExprFNeg(Constant* C) { +Constant* LLVMContext::getConstantExprFNeg(Constant* C) const { return ConstantExpr::getFNeg(C); } -Constant* LLVMContext::getConstantExprNot(Constant* C) { +Constant* LLVMContext::getConstantExprNot(Constant* C) const { return ConstantExpr::getNot(C); } -Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) const { return ConstantExpr::getAdd(C1, C2); } -Constant* LLVMContext::getConstantExprFAdd(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprFAdd(Constant* C1, Constant* C2) const { return ConstantExpr::getFAdd(C1, C2); } -Constant* LLVMContext::getConstantExprSub(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprSub(Constant* C1, Constant* C2) const { return ConstantExpr::getSub(C1, C2); } -Constant* LLVMContext::getConstantExprFSub(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprFSub(Constant* C1, Constant* C2) const { return ConstantExpr::getFSub(C1, C2); } -Constant* LLVMContext::getConstantExprMul(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprMul(Constant* C1, Constant* C2) const { return ConstantExpr::getMul(C1, C2); } -Constant* LLVMContext::getConstantExprFMul(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprFMul(Constant* C1, Constant* C2) const { return ConstantExpr::getFMul(C1, C2); } -Constant* LLVMContext::getConstantExprUDiv(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprUDiv(Constant* C1, Constant* C2) const { return ConstantExpr::getUDiv(C1, C2); } -Constant* LLVMContext::getConstantExprSDiv(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprSDiv(Constant* C1, Constant* C2) const { return ConstantExpr::getSDiv(C1, C2); } -Constant* LLVMContext::getConstantExprFDiv(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprFDiv(Constant* C1, Constant* C2) const { return ConstantExpr::getFDiv(C1, C2); } -Constant* LLVMContext::getConstantExprURem(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprURem(Constant* C1, Constant* C2) const { return ConstantExpr::getURem(C1, C2); } -Constant* LLVMContext::getConstantExprSRem(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprSRem(Constant* C1, Constant* C2) const { return ConstantExpr::getSRem(C1, C2); } -Constant* LLVMContext::getConstantExprFRem(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprFRem(Constant* C1, Constant* C2) const { return ConstantExpr::getFRem(C1, C2); } -Constant* LLVMContext::getConstantExprAnd(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprAnd(Constant* C1, Constant* C2) const { return ConstantExpr::getAnd(C1, C2); } -Constant* LLVMContext::getConstantExprOr(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprOr(Constant* C1, Constant* C2) const { return ConstantExpr::getOr(C1, C2); } -Constant* LLVMContext::getConstantExprXor(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprXor(Constant* C1, Constant* C2) const { return ConstantExpr::getXor(C1, C2); } Constant* LLVMContext::getConstantExprICmp(unsigned short pred, Constant* LHS, - Constant* RHS) { + Constant* RHS) const { return ConstantExpr::getICmp(pred, LHS, RHS); } Constant* LLVMContext::getConstantExprFCmp(unsigned short pred, Constant* LHS, - Constant* RHS) { + Constant* RHS) const { return ConstantExpr::getFCmp(pred, LHS, RHS); } Constant* LLVMContext::getConstantExprVICmp(unsigned short pred, Constant* LHS, - Constant* RHS) { + Constant* RHS) const { return ConstantExpr::getVICmp(pred, LHS, RHS); } Constant* LLVMContext::getConstantExprVFCmp(unsigned short pred, Constant* LHS, - Constant* RHS) { + Constant* RHS) const { return ConstantExpr::getVFCmp(pred, LHS, RHS); } -Constant* LLVMContext::getConstantExprShl(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprShl(Constant* C1, Constant* C2) const { return ConstantExpr::getShl(C1, C2); } -Constant* LLVMContext::getConstantExprLShr(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprLShr(Constant* C1, Constant* C2) const { return ConstantExpr::getLShr(C1, C2); } -Constant* LLVMContext::getConstantExprAShr(Constant* C1, Constant* C2) { +Constant* LLVMContext::getConstantExprAShr(Constant* C1, Constant* C2) const { return ConstantExpr::getAShr(C1, C2); } Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList, - unsigned NumIdx) { + unsigned NumIdx) const { return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); } Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, Value* const* IdxList, - unsigned NumIdx) { + unsigned NumIdx) const { return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); } Constant* LLVMContext::getConstantExprExtractElement(Constant* Vec, - Constant* Idx) { + Constant* Idx) const { return ConstantExpr::getExtractElement(Vec, Idx); } Constant* LLVMContext::getConstantExprInsertElement(Constant* Vec, Constant* Elt, - Constant* Idx) { + Constant* Idx) const { return ConstantExpr::getInsertElement(Vec, Elt, Idx); } Constant* LLVMContext::getConstantExprShuffleVector(Constant* V1, Constant* V2, - Constant* Mask) { + Constant* Mask) const { return ConstantExpr::getShuffleVector(V1, V2, Mask); } Constant* LLVMContext::getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList, - unsigned NumIdx) { + unsigned NumIdx) const { return ConstantExpr::getExtractValue(Agg, IdxList, NumIdx); } Constant* LLVMContext::getConstantExprInsertValue(Constant* Agg, Constant* Val, const unsigned* IdxList, - unsigned NumIdx) { + unsigned NumIdx) const { return ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx); } -Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) { +Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) const { return ConstantExpr::getZeroValueForNegationExpr(Ty); } // ConstantFP accessors. -ConstantFP* LLVMContext::getConstantFP(const APFloat& V) { +ConstantFP* LLVMContext::getConstantFP(const APFloat& V) const { return ConstantFP::get(V); } -Constant* LLVMContext::getConstantFP(const Type* Ty, double V) { +Constant* LLVMContext::getConstantFP(const Type* Ty, double V) const { return ConstantFP::get(Ty, V); } -ConstantFP* LLVMContext::getConstantFPNegativeZero(const Type* Ty) { +ConstantFP* LLVMContext::getConstantFPNegativeZero(const Type* Ty) const { return ConstantFP::getNegativeZero(Ty); } // ConstantVector accessors. Constant* LLVMContext::getConstantVector(const VectorType* T, - const std::vector& V) { + const std::vector& V) const { return ConstantVector::get(T, V); } -Constant* LLVMContext::getConstantVector(const std::vector& V) { +Constant* +LLVMContext::getConstantVector(const std::vector& V) const { return ConstantVector::get(V); } Constant* LLVMContext::getConstantVector(Constant* const* Vals, - unsigned NumVals) { + unsigned NumVals) const { return ConstantVector::get(Vals, NumVals); } -ConstantVector* LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) { +ConstantVector* +LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) const { return ConstantVector::getAllOnesValue(Ty); } // FunctionType accessors FunctionType* LLVMContext::getFunctionType(const Type* Result, const std::vector& Params, - bool isVarArg) { + bool isVarArg) const { return FunctionType::get(Result, Params, isVarArg); } // IntegerType accessors -const IntegerType* LLVMContext::getIntegerType(unsigned NumBits) { +const IntegerType* LLVMContext::getIntegerType(unsigned NumBits) const { return IntegerType::get(NumBits); } // OpaqueType accessors -OpaqueType* LLVMContext::getOpaqueType() { +OpaqueType* LLVMContext::getOpaqueType() const { return OpaqueType::get(); } // StructType accessors StructType* LLVMContext::getStructType(const std::vector& Params, - bool isPacked) { + bool isPacked) const { return StructType::get(Params, isPacked); } // ArrayType accessors ArrayType* LLVMContext::getArrayType(const Type* ElementType, - uint64_t NumElements) { + uint64_t NumElements) const { return ArrayType::get(ElementType, NumElements); } // PointerType accessors PointerType* LLVMContext::getPointerType(const Type* ElementType, - unsigned AddressSpace) { + unsigned AddressSpace) const { return PointerType::get(ElementType, AddressSpace); } -PointerType* LLVMContext::getPointerTypeUnqualified(const Type* ElementType) { +PointerType* +LLVMContext::getPointerTypeUnqualified(const Type* ElementType) const { return PointerType::getUnqual(ElementType); } // VectorType accessors VectorType* LLVMContext::getVectorType(const Type* ElementType, - unsigned NumElements) { + unsigned NumElements) const { return VectorType::get(ElementType, NumElements); } -VectorType* LLVMContext::getVectorTypeInteger(const VectorType* VTy) { +VectorType* LLVMContext::getVectorTypeInteger(const VectorType* VTy) const { return VectorType::getInteger(VTy); } -VectorType* LLVMContext::getVectorTypeExtendedElement(const VectorType* VTy) { +VectorType* +LLVMContext::getVectorTypeExtendedElement(const VectorType* VTy) const { return VectorType::getExtendedElementVectorType(VTy); } -VectorType* LLVMContext::getVectorTypeTruncatedElement(const VectorType* VTy) { +VectorType* +LLVMContext::getVectorTypeTruncatedElement(const VectorType* VTy) const { return VectorType::getTruncatedElementVectorType(VTy); } From resistor at mac.com Wed Jul 1 16:58:15 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 21:58:15 -0000 Subject: [llvm-commits] [llvm] r74649 - /llvm/trunk/lib/VMCore/LLVMContext.cpp Message-ID: <200907012158.n61LwFGd026329@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 16:58:14 2009 New Revision: 74649 URL: http://llvm.org/viewvc/llvm-project?rev=74649&view=rev Log: Fix typo. Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74649&r1=74648&r2=74649&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Wed Jul 1 16:58:14 2009 @@ -22,7 +22,7 @@ static ManagedStatic GlobalContext; -LLVMContext& llvm::getGlobalContext() { +const LLVMContext& llvm::getGlobalContext() { return *GlobalContext; } From bob.wilson at apple.com Wed Jul 1 16:59:43 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 01 Jul 2009 21:59:43 -0000 Subject: [llvm-commits] [llvm] r74650 - /llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp Message-ID: <200907012159.n61LxhMM026384@zion.cs.uiuc.edu> Author: bwilson Date: Wed Jul 1 16:59:43 2009 New Revision: 74650 URL: http://llvm.org/viewvc/llvm-project?rev=74650&view=rev Log: Fix a comment typo. Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp?rev=74650&r1=74649&r2=74650&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp Wed Jul 1 16:59:43 2009 @@ -934,7 +934,7 @@ } // Estimate if we might need to scavenge a register at some point in order - // to materialize a stack offset. If so, either spill one additiona + // to materialize a stack offset. If so, either spill one additional // callee-saved register or reserve a special spill slot to facilitate // register scavenging. if (RS && !ExtraCSSpill && !AFI->isThumbFunction()) { From dpatel at apple.com Wed Jul 1 17:10:24 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 22:10:24 -0000 Subject: [llvm-commits] [llvm] r74652 - /llvm/trunk/lib/Analysis/DebugInfo.cpp Message-ID: <200907012210.n61MAOtT026727@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 17:10:23 2009 New Revision: 74652 URL: http://llvm.org/viewvc/llvm-project?rev=74652&view=rev Log: Keep DIDescriptor methods together. No functionality change. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=74652&r1=74651&r2=74652&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Jul 1 17:10:23 2009 @@ -321,6 +321,133 @@ } //===----------------------------------------------------------------------===// +// DIDescriptor: dump routines for all descriptors. +//===----------------------------------------------------------------------===// + + +/// dump - Print descriptor. +void DIDescriptor::dump() const { + cerr << "[" << dwarf::TagString(getTag()) << "] "; + cerr << std::hex << "[GV:" << DbgGV << "]" << std::dec; +} + +/// dump - Print compile unit. +void DICompileUnit::dump() const { + if (getLanguage()) + cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; + + std::string Res1, Res2; + cerr << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]"; +} + +/// dump - Print type. +void DIType::dump() const { + if (isNull()) return; + + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + + unsigned Tag = getTag(); + cerr << " [" << dwarf::TagString(Tag) << "] "; + + // TODO : Print context + getCompileUnit().dump(); + cerr << " [" + << getLineNumber() << ", " + << getSizeInBits() << ", " + << getAlignInBits() << ", " + << getOffsetInBits() + << "] "; + + if (isPrivate()) + cerr << " [private] "; + else if (isProtected()) + cerr << " [protected] "; + + if (isForwardDecl()) + cerr << " [fwd] "; + + if (isBasicType(Tag)) + DIBasicType(DbgGV).dump(); + else if (isDerivedType(Tag)) + DIDerivedType(DbgGV).dump(); + else if (isCompositeType(Tag)) + DICompositeType(DbgGV).dump(); + else { + cerr << "Invalid DIType\n"; + return; + } + + cerr << "\n"; +} + +/// dump - Print basic type. +void DIBasicType::dump() const { + cerr << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] "; +} + +/// dump - Print derived type. +void DIDerivedType::dump() const { + cerr << "\n\t Derived From: "; getTypeDerivedFrom().dump(); +} + +/// dump - Print composite type. +void DICompositeType::dump() const { + DIArray A = getTypeArray(); + if (A.isNull()) + return; + cerr << " [" << A.getNumElements() << " elements]"; +} + +/// dump - Print global. +void DIGlobal::dump() const { + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + + unsigned Tag = getTag(); + cerr << " [" << dwarf::TagString(Tag) << "] "; + + // TODO : Print context + getCompileUnit().dump(); + cerr << " [" << getLineNumber() << "] "; + + if (isLocalToUnit()) + cerr << " [local] "; + + if (isDefinition()) + cerr << " [def] "; + + if (isGlobalVariable(Tag)) + DIGlobalVariable(DbgGV).dump(); + + cerr << "\n"; +} + +/// dump - Print subprogram. +void DISubprogram::dump() const { + DIGlobal::dump(); +} + +/// dump - Print global variable. +void DIGlobalVariable::dump() const { + cerr << " ["; getGlobal()->dump(); cerr << "] "; +} + +/// dump - Print variable. +void DIVariable::dump() const { + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + + getCompileUnit().dump(); + cerr << " [" << getLineNumber() << "] "; + getType().dump(); + cerr << "\n"; +} + +//===----------------------------------------------------------------------===// // DIFactory: Basic Helpers //===----------------------------------------------------------------------===// @@ -924,126 +1051,3 @@ } } } - -/// dump - Print descriptor. -void DIDescriptor::dump() const { - cerr << "[" << dwarf::TagString(getTag()) << "] "; - cerr << std::hex << "[GV:" << DbgGV << "]" << std::dec; -} - -/// dump - Print compile unit. -void DICompileUnit::dump() const { - if (getLanguage()) - cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; - - std::string Res1, Res2; - cerr << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]"; -} - -/// dump - Print type. -void DIType::dump() const { - if (isNull()) return; - - std::string Res; - if (!getName(Res).empty()) - cerr << " [" << Res << "] "; - - unsigned Tag = getTag(); - cerr << " [" << dwarf::TagString(Tag) << "] "; - - // TODO : Print context - getCompileUnit().dump(); - cerr << " [" - << getLineNumber() << ", " - << getSizeInBits() << ", " - << getAlignInBits() << ", " - << getOffsetInBits() - << "] "; - - if (isPrivate()) - cerr << " [private] "; - else if (isProtected()) - cerr << " [protected] "; - - if (isForwardDecl()) - cerr << " [fwd] "; - - if (isBasicType(Tag)) - DIBasicType(DbgGV).dump(); - else if (isDerivedType(Tag)) - DIDerivedType(DbgGV).dump(); - else if (isCompositeType(Tag)) - DICompositeType(DbgGV).dump(); - else { - cerr << "Invalid DIType\n"; - return; - } - - cerr << "\n"; -} - -/// dump - Print basic type. -void DIBasicType::dump() const { - cerr << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] "; -} - -/// dump - Print derived type. -void DIDerivedType::dump() const { - cerr << "\n\t Derived From: "; getTypeDerivedFrom().dump(); -} - -/// dump - Print composite type. -void DICompositeType::dump() const { - DIArray A = getTypeArray(); - if (A.isNull()) - return; - cerr << " [" << A.getNumElements() << " elements]"; -} - -/// dump - Print global. -void DIGlobal::dump() const { - std::string Res; - if (!getName(Res).empty()) - cerr << " [" << Res << "] "; - - unsigned Tag = getTag(); - cerr << " [" << dwarf::TagString(Tag) << "] "; - - // TODO : Print context - getCompileUnit().dump(); - cerr << " [" << getLineNumber() << "] "; - - if (isLocalToUnit()) - cerr << " [local] "; - - if (isDefinition()) - cerr << " [def] "; - - if (isGlobalVariable(Tag)) - DIGlobalVariable(DbgGV).dump(); - - cerr << "\n"; -} - -/// dump - Print subprogram. -void DISubprogram::dump() const { - DIGlobal::dump(); -} - -/// dump - Print global variable. -void DIGlobalVariable::dump() const { - cerr << " ["; getGlobal()->dump(); cerr << "] "; -} - -/// dump - Print variable. -void DIVariable::dump() const { - std::string Res; - if (!getName(Res).empty()) - cerr << " [" << Res << "] "; - - getCompileUnit().dump(); - cerr << " [" << getLineNumber() << "] "; - getType().dump(); - cerr << "\n"; -} - From isanbard at gmail.com Wed Jul 1 17:33:27 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Jul 2009 22:33:27 -0000 Subject: [llvm-commits] [llvm] r74653 - in /llvm/trunk: include/llvm/LLVMContext.h lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/LLVMContext.cpp Message-ID: <200907012233.n61MXRgr027515@zion.cs.uiuc.edu> Author: void Date: Wed Jul 1 17:33:26 2009 New Revision: 74653 URL: http://llvm.org/viewvc/llvm-project?rev=74653&view=rev Log: --- Reverse-merging (from foreign repository) r74648 into '.': U include/llvm/LLVMContext.h U lib/VMCore/LLVMContext.cpp U lib/AsmParser/LLParser.cpp U lib/AsmParser/LLParser.h Temporarily reverting r74648. It was causing massive failures in release mode. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74653&r1=74652&r2=74653&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Wed Jul 1 17:33:26 2009 @@ -54,151 +54,147 @@ ~LLVMContext(); // ConstantInt accessors - ConstantInt* getConstantIntTrue() const; - ConstantInt* getConstantIntFalse() const; + ConstantInt* getConstantIntTrue(); + ConstantInt* getConstantIntFalse(); ConstantInt* getConstantInt(const IntegerType* Ty, uint64_t V, - bool isSigned = false) const; - ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V) const; - ConstantInt* getConstantInt(const APInt& V) const; - Constant* getConstantInt(const Type* Ty, const APInt& V) const; - ConstantInt* getAllOnesConstantInt(const Type* Ty) const; + bool isSigned = false); + ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V); + ConstantInt* getConstantInt(const APInt& V); + Constant* getConstantInt(const Type* Ty, const APInt& V); + ConstantInt* getAllOnesConstantInt(const Type* Ty); // ConstantPointerNull accessors - ConstantPointerNull* getConstantPointerNull(const PointerType* T) const; + ConstantPointerNull* getConstantPointerNull(const PointerType* T); // ConstantStruct accessors Constant* getConstantStruct(const StructType* T, - const std::vector& V) const; + const std::vector& V); Constant* getConstantStruct(const std::vector& V, - bool Packed = false) const; + bool Packed = false); Constant* getConstantStruct(Constant* const *Vals, unsigned NumVals, - bool Packed = false) const; + bool Packed = false); // ConstantAggregateZero accessors - ConstantAggregateZero* getConstantAggregateZero(const Type* Ty) const; + ConstantAggregateZero* getConstantAggregateZero(const Type* Ty); // ConstantArray accessors Constant* getConstantArray(const ArrayType* T, - const std::vector& V) const; + const std::vector& V); Constant* getConstantArray(const ArrayType* T, Constant* const* Vals, - unsigned NumVals) const; + unsigned NumVals); Constant* getConstantArray(const std::string& Initializer, - bool AddNull = false) const; + bool AddNull = false); // ConstantExpr accessors - Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2) const; - Constant* getConstantExprTrunc(Constant* C, const Type* Ty) const; - Constant* getConstantExprSExt(Constant* C, const Type* Ty) const; - Constant* getConstantExprZExt(Constant* C, const Type* Ty) const; - Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty) const; - Constant* getConstantExprFPExtend(Constant* C, const Type* Ty) const; - Constant* getConstantExprUIToFP(Constant* C, const Type* Ty) const; - Constant* getConstantExprSIToFP(Constant* C, const Type* Ty) const; - Constant* getConstantExprFPToUI(Constant* C, const Type* Ty) const; - Constant* getConstantExprFPToSI(Constant* C, const Type* Ty) const; - Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty) const; - Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty) const; - Constant* getConstantExprBitCast(Constant* C, const Type* Ty) const; - Constant* getConstantExprCast(unsigned ops, Constant* C, - const Type* Ty) const; - Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty) const; - Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty) const; - Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty) const; - Constant* getConstantExprPointerCast(Constant* C, const Type* Ty) const; + Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2); + Constant* getConstantExprTrunc(Constant* C, const Type* Ty); + Constant* getConstantExprSExt(Constant* C, const Type* Ty); + Constant* getConstantExprZExt(Constant* C, const Type* Ty); + Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty); + Constant* getConstantExprFPExtend(Constant* C, const Type* Ty); + Constant* getConstantExprUIToFP(Constant* C, const Type* Ty); + Constant* getConstantExprSIToFP(Constant* C, const Type* Ty); + Constant* getConstantExprFPToUI(Constant* C, const Type* Ty); + Constant* getConstantExprFPToSI(Constant* C, const Type* Ty); + Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty); + Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty); + Constant* getConstantExprBitCast(Constant* C, const Type* Ty); + Constant* getConstantExprCast(unsigned ops, Constant* C, const Type* Ty); + Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty); + Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty); + Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty); + Constant* getConstantExprPointerCast(Constant* C, const Type* Ty); Constant* getConstantExprIntegerCast(Constant* C, const Type* Ty, - bool isSigned) const; - Constant* getConstantExprFPCast(Constant* C, const Type* Ty) const; - Constant* getConstantExprSelect(Constant* C, Constant* V1, - Constant* V2) const; - Constant* getConstantExprAlignOf(const Type* Ty) const; + bool isSigned); + Constant* getConstantExprFPCast(Constant* C, const Type* Ty); + Constant* getConstantExprSelect(Constant* C, Constant* V1, Constant* V2); + Constant* getConstantExprAlignOf(const Type* Ty); Constant* getConstantExprCompare(unsigned short pred, - Constant* C1, Constant* C2) const; - Constant* getConstantExprNeg(Constant* C) const; - Constant* getConstantExprFNeg(Constant* C) const; - Constant* getConstantExprNot(Constant* C) const; - Constant* getConstantExprAdd(Constant* C1, Constant* C2) const; - Constant* getConstantExprFAdd(Constant* C1, Constant* C2) const; - Constant* getConstantExprSub(Constant* C1, Constant* C2) const; - Constant* getConstantExprFSub(Constant* C1, Constant* C2) const; - Constant* getConstantExprMul(Constant* C1, Constant* C2) const; - Constant* getConstantExprFMul(Constant* C1, Constant* C2) const; - Constant* getConstantExprUDiv(Constant* C1, Constant* C2) const; - Constant* getConstantExprSDiv(Constant* C1, Constant* C2) const; - Constant* getConstantExprFDiv(Constant* C1, Constant* C2) const; - Constant* getConstantExprURem(Constant* C1, Constant* C2) const; - Constant* getConstantExprSRem(Constant* C1, Constant* C2) const; - Constant* getConstantExprFRem(Constant* C1, Constant* C2) const; - Constant* getConstantExprAnd(Constant* C1, Constant* C2) const; - Constant* getConstantExprOr(Constant* C1, Constant* C2) const; - Constant* getConstantExprXor(Constant* C1, Constant* C2) const; + Constant* C1, Constant* C2); + Constant* getConstantExprNeg(Constant* C); + Constant* getConstantExprFNeg(Constant* C); + Constant* getConstantExprNot(Constant* C); + Constant* getConstantExprAdd(Constant* C1, Constant* C2); + Constant* getConstantExprFAdd(Constant* C1, Constant* C2); + Constant* getConstantExprSub(Constant* C1, Constant* C2); + Constant* getConstantExprFSub(Constant* C1, Constant* C2); + Constant* getConstantExprMul(Constant* C1, Constant* C2); + Constant* getConstantExprFMul(Constant* C1, Constant* C2); + Constant* getConstantExprUDiv(Constant* C1, Constant* C2); + Constant* getConstantExprSDiv(Constant* C1, Constant* C2); + Constant* getConstantExprFDiv(Constant* C1, Constant* C2); + Constant* getConstantExprURem(Constant* C1, Constant* C2); + Constant* getConstantExprSRem(Constant* C1, Constant* C2); + Constant* getConstantExprFRem(Constant* C1, Constant* C2); + Constant* getConstantExprAnd(Constant* C1, Constant* C2); + Constant* getConstantExprOr(Constant* C1, Constant* C2); + Constant* getConstantExprXor(Constant* C1, Constant* C2); Constant* getConstantExprICmp(unsigned short pred, Constant* LHS, - Constant* RHS) const; + Constant* RHS); Constant* getConstantExprFCmp(unsigned short pred, Constant* LHS, - Constant* RHS) const; + Constant* RHS); Constant* getConstantExprVICmp(unsigned short pred, Constant* LHS, - Constant* RHS) const; + Constant* RHS); Constant* getConstantExprVFCmp(unsigned short pred, Constant* LHS, - Constant* RHS) const; - Constant* getConstantExprShl(Constant* C1, Constant* C2) const; - Constant* getConstantExprLShr(Constant* C1, Constant* C2) const; - Constant* getConstantExprAShr(Constant* C1, Constant* C2) const; + Constant* RHS); + Constant* getConstantExprShl(Constant* C1, Constant* C2); + Constant* getConstantExprLShr(Constant* C1, Constant* C2); + Constant* getConstantExprAShr(Constant* C1, Constant* C2); Constant* getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList, - unsigned NumIdx) const; + unsigned NumIdx); Constant* getConstantExprGetElementPtr(Constant* C, Value* const* IdxList, - unsigned NumIdx) const; - Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx) const; + unsigned NumIdx); + Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx); Constant* getConstantExprInsertElement(Constant* Vec, Constant* Elt, - Constant* Idx) const; + Constant* Idx); Constant* getConstantExprShuffleVector(Constant* V1, Constant* V2, - Constant* Mask) const; + Constant* Mask); Constant* getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList, - unsigned NumIdx) const; + unsigned NumIdx); Constant* getConstantExprInsertValue(Constant* Agg, Constant* Val, const unsigned* IdxList, - unsigned NumIdx) const; - Constant* getZeroValueForNegation(const Type* Ty) const; + unsigned NumIdx); + Constant* getZeroValueForNegation(const Type* Ty); // ConstantFP accessors - ConstantFP* getConstantFP(const APFloat& V) const; - Constant* getConstantFP(const Type* Ty, double V) const; - ConstantFP* getConstantFPNegativeZero(const Type* Ty) const; + ConstantFP* getConstantFP(const APFloat& V); + Constant* getConstantFP(const Type* Ty, double V); + ConstantFP* getConstantFPNegativeZero(const Type* Ty); // ConstantVector accessors Constant* getConstantVector(const VectorType* T, - const std::vector& V) const; - Constant* getConstantVector(const std::vector& V) const; - Constant* getConstantVector(Constant* const* Vals, unsigned NumVals) const; - ConstantVector* getConstantVectorAllOnes(const VectorType* Ty) const; + const std::vector& V); + Constant* getConstantVector(const std::vector& V); + Constant* getConstantVector(Constant* const* Vals, unsigned NumVals); + ConstantVector* getConstantVectorAllOnes(const VectorType* Ty); // FunctionType accessors FunctionType* getFunctionType(const Type* Result, const std::vector& Params, - bool isVarArg) const; + bool isVarArg); // IntegerType accessors - const IntegerType* getIntegerType(unsigned NumBits) const; + const IntegerType* getIntegerType(unsigned NumBits); // OpaqueType accessors - OpaqueType* getOpaqueType() const; + OpaqueType* getOpaqueType(); // StructType accessors StructType* getStructType(const std::vector& Params, - bool isPacked = false) const; + bool isPacked = false); // ArrayType accessors - ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements) const; + ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements); // PointerType accessors - PointerType* getPointerType(const Type* ElementType, - unsigned AddressSpace) const; - PointerType* getPointerTypeUnqualified(const Type* ElementType) const; + PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace); + PointerType* getPointerTypeUnqualified(const Type* ElementType); // VectorType accessors - VectorType* getVectorType(const Type* ElementType, - unsigned NumElements) const; - VectorType* getVectorTypeInteger(const VectorType* VTy) const; - VectorType* getVectorTypeExtendedElement(const VectorType* VTy) const; - VectorType* getVectorTypeTruncatedElement(const VectorType* VTy) const; + VectorType* getVectorType(const Type* ElementType, unsigned NumElements); + VectorType* getVectorTypeInteger(const VectorType* VTy); + VectorType* getVectorTypeExtendedElement(const VectorType* VTy); + VectorType* getVectorTypeTruncatedElement(const VectorType* VTy); }; /// FOR BACKWARDS COMPATIBILITY - Returns a global context. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74653&r1=74652&r2=74653&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul 1 17:33:26 2009 @@ -18,7 +18,6 @@ #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" -#include "llvm/LLVMContext.h" #include "llvm/MDNode.h" #include "llvm/Module.h" #include "llvm/ValueSymbolTable.h" @@ -1654,11 +1653,11 @@ ID.Kind = ValID::t_APFloat; break; case lltok::kw_true: - ID.ConstantVal = Context.getConstantIntTrue(); + ID.ConstantVal = ConstantInt::getTrue(); ID.Kind = ValID::t_Constant; break; case lltok::kw_false: - ID.ConstantVal = Context.getConstantIntFalse(); + ID.ConstantVal = ConstantInt::getFalse(); ID.Kind = ValID::t_Constant; break; case lltok::kw_null: ID.Kind = ValID::t_Null; break; @@ -2038,7 +2037,7 @@ if (!isa(Ty)) return Error(ID.Loc, "integer constant must have integer type"); ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits()); - V = Context.getConstantInt(ID.APSIntVal); + V = ConstantInt::get(ID.APSIntVal); return false; case ValID::t_APFloat: if (!Ty->isFloatingPoint() || Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=74653&r1=74652&r2=74653&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Wed Jul 1 17:33:26 2009 @@ -15,7 +15,6 @@ #define LLVM_ASMPARSER_LLPARSER_H #include "LLLexer.h" -#include "llvm/Module.h" #include "llvm/Type.h" #include @@ -30,14 +29,13 @@ class GlobalValue; class MDString; class MDNode; - class LLVMContext; struct ValID; class LLParser { public: typedef LLLexer::LocTy LocTy; private: - const LLVMContext& Context; + LLLexer Lex; Module *M; @@ -74,8 +72,7 @@ std::map > ForwardRefValIDs; std::vector NumberedVals; public: - LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : - Context(M->getContext()), Lex(F, Err), M(m) {} + LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : Lex(F, Err), M(m) {} bool Run(); private: Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74653&r1=74652&r2=74653&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Wed Jul 1 17:33:26 2009 @@ -30,438 +30,420 @@ LLVMContext::~LLVMContext() { delete pImpl; } // ConstantInt accessors. -ConstantInt* LLVMContext::getConstantIntTrue() const { +ConstantInt* LLVMContext::getConstantIntTrue() { return ConstantInt::getTrue(); } -ConstantInt* LLVMContext::getConstantIntFalse() const { +ConstantInt* LLVMContext::getConstantIntFalse() { return ConstantInt::getFalse(); } ConstantInt* LLVMContext::getConstantInt(const IntegerType* Ty, uint64_t V, - bool isSigned) const { + bool isSigned) { return ConstantInt::get(Ty, V, isSigned); } ConstantInt* LLVMContext::getConstantIntSigned(const IntegerType* Ty, - int64_t V) const { + int64_t V) { return ConstantInt::getSigned(Ty, V); } -ConstantInt* LLVMContext::getConstantInt(const APInt& V) const { +ConstantInt* LLVMContext::getConstantInt(const APInt& V) { return ConstantInt::get(V); } -Constant* LLVMContext::getConstantInt(const Type* Ty, const APInt& V) const { +Constant* LLVMContext::getConstantInt(const Type* Ty, const APInt& V) { return ConstantInt::get(Ty, V); } -ConstantInt* LLVMContext::getAllOnesConstantInt(const Type* Ty) const { +ConstantInt* LLVMContext::getAllOnesConstantInt(const Type* Ty) { return ConstantInt::getAllOnesValue(Ty); } // ConstantPointerNull accessors. -ConstantPointerNull* -LLVMContext::getConstantPointerNull(const PointerType* T) const { +ConstantPointerNull* LLVMContext::getConstantPointerNull(const PointerType* T) { return ConstantPointerNull::get(T); } // ConstantStruct accessors. Constant* LLVMContext::getConstantStruct(const StructType* T, - const std::vector& V) const { + const std::vector& V) { return ConstantStruct::get(T, V); } Constant* LLVMContext::getConstantStruct(const std::vector& V, - bool Packed) const { + bool Packed) { return ConstantStruct::get(V, Packed); } Constant* LLVMContext::getConstantStruct(Constant* const *Vals, - unsigned NumVals, bool Packed) const { + unsigned NumVals, bool Packed) { return ConstantStruct::get(Vals, NumVals, Packed); } // ConstantAggregateZero accessors. -ConstantAggregateZero* -LLVMContext::getConstantAggregateZero(const Type* Ty) const { +ConstantAggregateZero* LLVMContext::getConstantAggregateZero(const Type* Ty) { return ConstantAggregateZero::get(Ty); } // ConstantArray accessors. Constant* LLVMContext::getConstantArray(const ArrayType* T, - const std::vector& V) const { + const std::vector& V) { return ConstantArray::get(T, V); } Constant* LLVMContext::getConstantArray(const ArrayType* T, Constant* const* Vals, - unsigned NumVals) const { + unsigned NumVals) { return ConstantArray::get(T, Vals, NumVals); } Constant* LLVMContext::getConstantArray(const std::string& Initializer, - bool AddNull) const { + bool AddNull) { return ConstantArray::get(Initializer, AddNull); } // ConstantExpr accessors. Constant* LLVMContext::getConstantExpr(unsigned Opcode, Constant* C1, - Constant* C2) const { + Constant* C2) { return ConstantExpr::get(Opcode, C1, C2); } -Constant* LLVMContext::getConstantExprTrunc(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprTrunc(Constant* C, const Type* Ty) { return ConstantExpr::getTrunc(C, Ty); } -Constant* LLVMContext::getConstantExprSExt(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprSExt(Constant* C, const Type* Ty) { return ConstantExpr::getSExt(C, Ty); } -Constant* LLVMContext::getConstantExprZExt(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprZExt(Constant* C, const Type* Ty) { return ConstantExpr::getZExt(C, Ty); } -Constant* -LLVMContext::getConstantExprFPTrunc(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprFPTrunc(Constant* C, const Type* Ty) { return ConstantExpr::getFPTrunc(C, Ty); } -Constant* -LLVMContext::getConstantExprFPExtend(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprFPExtend(Constant* C, const Type* Ty) { return ConstantExpr::getFPExtend(C, Ty); } -Constant* -LLVMContext::getConstantExprUIToFP(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprUIToFP(Constant* C, const Type* Ty) { return ConstantExpr::getUIToFP(C, Ty); } -Constant* -LLVMContext::getConstantExprSIToFP(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprSIToFP(Constant* C, const Type* Ty) { return ConstantExpr::getSIToFP(C, Ty); } -Constant* -LLVMContext::getConstantExprFPToUI(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprFPToUI(Constant* C, const Type* Ty) { return ConstantExpr::getFPToUI(C, Ty); } -Constant* -LLVMContext::getConstantExprFPToSI(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprFPToSI(Constant* C, const Type* Ty) { return ConstantExpr::getFPToSI(C, Ty); } -Constant* -LLVMContext::getConstantExprPtrToInt(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprPtrToInt(Constant* C, const Type* Ty) { return ConstantExpr::getPtrToInt(C, Ty); } -Constant* -LLVMContext::getConstantExprIntToPtr(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprIntToPtr(Constant* C, const Type* Ty) { return ConstantExpr::getIntToPtr(C, Ty); } -Constant* -LLVMContext::getConstantExprBitCast(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprBitCast(Constant* C, const Type* Ty) { return ConstantExpr::getBitCast(C, Ty); } Constant* LLVMContext::getConstantExprCast(unsigned ops, Constant* C, - const Type* Ty) const { + const Type* Ty) { return ConstantExpr::getCast(ops, C, Ty); } Constant* LLVMContext::getConstantExprZExtOrBitCast(Constant* C, - const Type* Ty) const { + const Type* Ty) { return ConstantExpr::getZExtOrBitCast(C, Ty); } Constant* LLVMContext::getConstantExprSExtOrBitCast(Constant* C, - const Type* Ty) const { + const Type* Ty) { return ConstantExpr::getSExtOrBitCast(C, Ty); } Constant* LLVMContext::getConstantExprTruncOrBitCast(Constant* C, - const Type* Ty) const { + const Type* Ty) { return ConstantExpr::getTruncOrBitCast(C, Ty); } -Constant* -LLVMContext::getConstantExprPointerCast(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprPointerCast(Constant* C, const Type* Ty) { return ConstantExpr::getPointerCast(C, Ty); } Constant* LLVMContext::getConstantExprIntegerCast(Constant* C, const Type* Ty, - bool isSigned) const { + bool isSigned) { return ConstantExpr::getIntegerCast(C, Ty, isSigned); } -Constant* -LLVMContext::getConstantExprFPCast(Constant* C, const Type* Ty) const { +Constant* LLVMContext::getConstantExprFPCast(Constant* C, const Type* Ty) { return ConstantExpr::getFPCast(C, Ty); } Constant* LLVMContext::getConstantExprSelect(Constant* C, Constant* V1, - Constant* V2) const { + Constant* V2) { return ConstantExpr::getSelect(C, V1, V2); } -Constant* LLVMContext::getConstantExprAlignOf(const Type* Ty) const { +Constant* LLVMContext::getConstantExprAlignOf(const Type* Ty) { return ConstantExpr::getAlignOf(Ty); } Constant* LLVMContext::getConstantExprCompare(unsigned short pred, - Constant* C1, Constant* C2) const { + Constant* C1, Constant* C2) { return ConstantExpr::getCompare(pred, C1, C2); } -Constant* LLVMContext::getConstantExprNeg(Constant* C) const { +Constant* LLVMContext::getConstantExprNeg(Constant* C) { return ConstantExpr::getNeg(C); } -Constant* LLVMContext::getConstantExprFNeg(Constant* C) const { +Constant* LLVMContext::getConstantExprFNeg(Constant* C) { return ConstantExpr::getFNeg(C); } -Constant* LLVMContext::getConstantExprNot(Constant* C) const { +Constant* LLVMContext::getConstantExprNot(Constant* C) { return ConstantExpr::getNot(C); } -Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) { return ConstantExpr::getAdd(C1, C2); } -Constant* LLVMContext::getConstantExprFAdd(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprFAdd(Constant* C1, Constant* C2) { return ConstantExpr::getFAdd(C1, C2); } -Constant* LLVMContext::getConstantExprSub(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprSub(Constant* C1, Constant* C2) { return ConstantExpr::getSub(C1, C2); } -Constant* LLVMContext::getConstantExprFSub(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprFSub(Constant* C1, Constant* C2) { return ConstantExpr::getFSub(C1, C2); } -Constant* LLVMContext::getConstantExprMul(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprMul(Constant* C1, Constant* C2) { return ConstantExpr::getMul(C1, C2); } -Constant* LLVMContext::getConstantExprFMul(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprFMul(Constant* C1, Constant* C2) { return ConstantExpr::getFMul(C1, C2); } -Constant* LLVMContext::getConstantExprUDiv(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprUDiv(Constant* C1, Constant* C2) { return ConstantExpr::getUDiv(C1, C2); } -Constant* LLVMContext::getConstantExprSDiv(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprSDiv(Constant* C1, Constant* C2) { return ConstantExpr::getSDiv(C1, C2); } -Constant* LLVMContext::getConstantExprFDiv(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprFDiv(Constant* C1, Constant* C2) { return ConstantExpr::getFDiv(C1, C2); } -Constant* LLVMContext::getConstantExprURem(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprURem(Constant* C1, Constant* C2) { return ConstantExpr::getURem(C1, C2); } -Constant* LLVMContext::getConstantExprSRem(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprSRem(Constant* C1, Constant* C2) { return ConstantExpr::getSRem(C1, C2); } -Constant* LLVMContext::getConstantExprFRem(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprFRem(Constant* C1, Constant* C2) { return ConstantExpr::getFRem(C1, C2); } -Constant* LLVMContext::getConstantExprAnd(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprAnd(Constant* C1, Constant* C2) { return ConstantExpr::getAnd(C1, C2); } -Constant* LLVMContext::getConstantExprOr(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprOr(Constant* C1, Constant* C2) { return ConstantExpr::getOr(C1, C2); } -Constant* LLVMContext::getConstantExprXor(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprXor(Constant* C1, Constant* C2) { return ConstantExpr::getXor(C1, C2); } Constant* LLVMContext::getConstantExprICmp(unsigned short pred, Constant* LHS, - Constant* RHS) const { + Constant* RHS) { return ConstantExpr::getICmp(pred, LHS, RHS); } Constant* LLVMContext::getConstantExprFCmp(unsigned short pred, Constant* LHS, - Constant* RHS) const { + Constant* RHS) { return ConstantExpr::getFCmp(pred, LHS, RHS); } Constant* LLVMContext::getConstantExprVICmp(unsigned short pred, Constant* LHS, - Constant* RHS) const { + Constant* RHS) { return ConstantExpr::getVICmp(pred, LHS, RHS); } Constant* LLVMContext::getConstantExprVFCmp(unsigned short pred, Constant* LHS, - Constant* RHS) const { + Constant* RHS) { return ConstantExpr::getVFCmp(pred, LHS, RHS); } -Constant* LLVMContext::getConstantExprShl(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprShl(Constant* C1, Constant* C2) { return ConstantExpr::getShl(C1, C2); } -Constant* LLVMContext::getConstantExprLShr(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprLShr(Constant* C1, Constant* C2) { return ConstantExpr::getLShr(C1, C2); } -Constant* LLVMContext::getConstantExprAShr(Constant* C1, Constant* C2) const { +Constant* LLVMContext::getConstantExprAShr(Constant* C1, Constant* C2) { return ConstantExpr::getAShr(C1, C2); } Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList, - unsigned NumIdx) const { + unsigned NumIdx) { return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); } Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, Value* const* IdxList, - unsigned NumIdx) const { + unsigned NumIdx) { return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); } Constant* LLVMContext::getConstantExprExtractElement(Constant* Vec, - Constant* Idx) const { + Constant* Idx) { return ConstantExpr::getExtractElement(Vec, Idx); } Constant* LLVMContext::getConstantExprInsertElement(Constant* Vec, Constant* Elt, - Constant* Idx) const { + Constant* Idx) { return ConstantExpr::getInsertElement(Vec, Elt, Idx); } Constant* LLVMContext::getConstantExprShuffleVector(Constant* V1, Constant* V2, - Constant* Mask) const { + Constant* Mask) { return ConstantExpr::getShuffleVector(V1, V2, Mask); } Constant* LLVMContext::getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList, - unsigned NumIdx) const { + unsigned NumIdx) { return ConstantExpr::getExtractValue(Agg, IdxList, NumIdx); } Constant* LLVMContext::getConstantExprInsertValue(Constant* Agg, Constant* Val, const unsigned* IdxList, - unsigned NumIdx) const { + unsigned NumIdx) { return ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx); } -Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) const { +Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) { return ConstantExpr::getZeroValueForNegationExpr(Ty); } // ConstantFP accessors. -ConstantFP* LLVMContext::getConstantFP(const APFloat& V) const { +ConstantFP* LLVMContext::getConstantFP(const APFloat& V) { return ConstantFP::get(V); } -Constant* LLVMContext::getConstantFP(const Type* Ty, double V) const { +Constant* LLVMContext::getConstantFP(const Type* Ty, double V) { return ConstantFP::get(Ty, V); } -ConstantFP* LLVMContext::getConstantFPNegativeZero(const Type* Ty) const { +ConstantFP* LLVMContext::getConstantFPNegativeZero(const Type* Ty) { return ConstantFP::getNegativeZero(Ty); } // ConstantVector accessors. Constant* LLVMContext::getConstantVector(const VectorType* T, - const std::vector& V) const { + const std::vector& V) { return ConstantVector::get(T, V); } -Constant* -LLVMContext::getConstantVector(const std::vector& V) const { +Constant* LLVMContext::getConstantVector(const std::vector& V) { return ConstantVector::get(V); } Constant* LLVMContext::getConstantVector(Constant* const* Vals, - unsigned NumVals) const { + unsigned NumVals) { return ConstantVector::get(Vals, NumVals); } -ConstantVector* -LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) const { +ConstantVector* LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) { return ConstantVector::getAllOnesValue(Ty); } // FunctionType accessors FunctionType* LLVMContext::getFunctionType(const Type* Result, const std::vector& Params, - bool isVarArg) const { + bool isVarArg) { return FunctionType::get(Result, Params, isVarArg); } // IntegerType accessors -const IntegerType* LLVMContext::getIntegerType(unsigned NumBits) const { +const IntegerType* LLVMContext::getIntegerType(unsigned NumBits) { return IntegerType::get(NumBits); } // OpaqueType accessors -OpaqueType* LLVMContext::getOpaqueType() const { +OpaqueType* LLVMContext::getOpaqueType() { return OpaqueType::get(); } // StructType accessors StructType* LLVMContext::getStructType(const std::vector& Params, - bool isPacked) const { + bool isPacked) { return StructType::get(Params, isPacked); } // ArrayType accessors ArrayType* LLVMContext::getArrayType(const Type* ElementType, - uint64_t NumElements) const { + uint64_t NumElements) { return ArrayType::get(ElementType, NumElements); } // PointerType accessors PointerType* LLVMContext::getPointerType(const Type* ElementType, - unsigned AddressSpace) const { + unsigned AddressSpace) { return PointerType::get(ElementType, AddressSpace); } -PointerType* -LLVMContext::getPointerTypeUnqualified(const Type* ElementType) const { +PointerType* LLVMContext::getPointerTypeUnqualified(const Type* ElementType) { return PointerType::getUnqual(ElementType); } // VectorType accessors VectorType* LLVMContext::getVectorType(const Type* ElementType, - unsigned NumElements) const { + unsigned NumElements) { return VectorType::get(ElementType, NumElements); } -VectorType* LLVMContext::getVectorTypeInteger(const VectorType* VTy) const { +VectorType* LLVMContext::getVectorTypeInteger(const VectorType* VTy) { return VectorType::getInteger(VTy); } -VectorType* -LLVMContext::getVectorTypeExtendedElement(const VectorType* VTy) const { +VectorType* LLVMContext::getVectorTypeExtendedElement(const VectorType* VTy) { return VectorType::getExtendedElementVectorType(VTy); } -VectorType* -LLVMContext::getVectorTypeTruncatedElement(const VectorType* VTy) const { +VectorType* LLVMContext::getVectorTypeTruncatedElement(const VectorType* VTy) { return VectorType::getTruncatedElementVectorType(VTy); } From dalej at apple.com Wed Jul 1 17:55:27 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 1 Jul 2009 15:55:27 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r74575 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <4A4B4E90.4020200@free.fr> References: <200906302353.n5UNr4JS000931@zion.cs.uiuc.edu> <6D383637-4E1F-499C-B91F-965E927D3D84@apple.com> <4A4B4E90.4020200@free.fr> Message-ID: On Jul 1, 2009, at 4:54 AMPDT, Duncan Sands wrote: > Hi Dale, > >>>> It's not that big of a deal, but please use SmallVector or >>>> something instead of alloca. SmallVector works when "N" is more >>>> than >>>> 4 by going to the heap so you won't run out of stack space for >>>> large >>>> N, and is more portable. >>> I am not a big lover of alloca, but it was used several places in >>> this >>> code before I started working on it so I don't think portability can >>> be a problem, and the numbers involved cannot be big enough to run >>> out >>> of stack space. >> >> Ok, works for me. Please don't use it in normal llvm code though, >> llvm-gcc is fine. > > it was used in two places in the llvm parts of llvm-gcc before. Since > the llvm style is to use SmallVector, can you please modify all places > to use SmallVector instead of alloca. There is actually a good reason to use alloca in all these cases. We know the exact number of elements at runtime, but not at compile time. Using SmallVector would either waste stack space, or require heap allocations, depending on which way we guessed wrong. There's no good reason to do that, so I'm going to leave it alone. From gohman at apple.com Wed Jul 1 18:12:35 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Jul 2009 23:12:35 -0000 Subject: [llvm-commits] [llvm] r74654 - /llvm/trunk/lib/VMCore/PassManager.cpp Message-ID: <200907012312.n61NCaHW028563@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 1 18:12:33 2009 New Revision: 74654 URL: http://llvm.org/viewvc/llvm-project?rev=74654&view=rev Log: Use find instead of operator[] to test whether an element is in a std::map. This fixes a bug that caused -debug-pass=Details to abort. Modified: llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=74654&r1=74653&r2=74654&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Wed Jul 1 18:12:33 2009 @@ -278,8 +278,10 @@ for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { ModulePass *MP = getContainedPass(Index); MP->dumpPassStructure(Offset + 1); - if (FunctionPassManagerImpl *FPP = OnTheFlyManagers[MP]) - FPP->dumpPassStructure(Offset + 2); + std::map::const_iterator I = + OnTheFlyManagers.find(MP); + if (I != OnTheFlyManagers.end()) + I->second->dumpPassStructure(Offset + 2); dumpLastUses(MP, Offset+1); } } From resistor at mac.com Wed Jul 1 18:13:44 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 23:13:44 -0000 Subject: [llvm-commits] [llvm] r74655 - in /llvm/trunk: examples/BrainF/ include/llvm/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/Debugger/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Debugger/ lib/Linker/ lib/VMCore/ tools/bugpoint/ tools/llvm-db/ tools/llvm-link/ tools/lto/ Message-ID: <200907012313.n61NDjFS028631@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 18:13:44 2009 New Revision: 74655 URL: http://llvm.org/viewvc/llvm-project?rev=74655&view=rev Log: Make the use of const with respect to LLVMContext sane. Hopefully this is the last time, for the moment, that I will need to make far-reaching changes. Modified: llvm/trunk/examples/BrainF/BrainF.cpp llvm/trunk/examples/BrainF/BrainF.h llvm/trunk/include/llvm/Assembly/Parser.h llvm/trunk/include/llvm/Bitcode/Archive.h llvm/trunk/include/llvm/Bitcode/ReaderWriter.h llvm/trunk/include/llvm/Debugger/Debugger.h llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/include/llvm/Linker.h llvm/trunk/include/llvm/Module.h llvm/trunk/lib/Archive/Archive.cpp llvm/trunk/lib/Archive/ArchiveInternals.h llvm/trunk/lib/Archive/ArchiveReader.cpp llvm/trunk/lib/Archive/ArchiveWriter.cpp llvm/trunk/lib/AsmParser/Parser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h llvm/trunk/lib/Debugger/Debugger.cpp llvm/trunk/lib/Linker/Linker.cpp llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/Module.cpp llvm/trunk/tools/bugpoint/BugDriver.cpp llvm/trunk/tools/bugpoint/BugDriver.h llvm/trunk/tools/llvm-db/CLIDebugger.cpp llvm/trunk/tools/llvm-db/CLIDebugger.h llvm/trunk/tools/llvm-link/llvm-link.cpp llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/lto/LTOCodeGenerator.h llvm/trunk/tools/lto/LTOModule.cpp llvm/trunk/tools/lto/LTOModule.h Modified: llvm/trunk/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.cpp (original) +++ llvm/trunk/examples/BrainF/BrainF.cpp Wed Jul 1 18:13:44 2009 @@ -37,7 +37,7 @@ const char *BrainF::testreg = "test"; Module *BrainF::parse(std::istream *in1, int mem, CompileFlags cf, - const LLVMContext& Context) { + LLVMContext& Context) { in = in1; memtotal = mem; comflag = cf; @@ -48,7 +48,7 @@ return module; } -void BrainF::header(const LLVMContext& C) { +void BrainF::header(LLVMContext& C) { module = new Module("BrainF", C); //Function prototypes Modified: llvm/trunk/examples/BrainF/BrainF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.h (original) +++ llvm/trunk/examples/BrainF/BrainF.h Wed Jul 1 18:13:44 2009 @@ -40,7 +40,7 @@ /// On error, it calls abort. /// The caller must delete the returned module. Module *parse(std::istream *in1, int mem, CompileFlags cf, - const LLVMContext& C); + LLVMContext& C); protected: /// The different symbols in the BrainF language @@ -66,7 +66,7 @@ static const char *testreg; /// Put the brainf function preamble and other fixed pieces of code - void header(const LLVMContext& C); + void header(LLVMContext& C); /// The main loop for parsing. It calls itself recursively /// to handle the depth of nesting of "[]". Modified: llvm/trunk/include/llvm/Assembly/Parser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Parser.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Parser.h (original) +++ llvm/trunk/include/llvm/Assembly/Parser.h Wed Jul 1 18:13:44 2009 @@ -32,7 +32,7 @@ Module *ParseAssemblyFile( const std::string &Filename, ///< The name of the file to parse ParseError &Error, ///< If not null, an object to return errors in. - const LLVMContext& Context ///< Context in which to allocate globals info. + LLVMContext& Context ///< Context in which to allocate globals info. ); /// The function is a secondary interface to the LLVM Assembly Parser. It parses @@ -45,7 +45,7 @@ const char *AsmString, ///< The string containing assembly Module *M, ///< A module to add the assembly too. ParseError &Error, ///< If not null, an object to return errors in. - const LLVMContext& Context + LLVMContext& Context ); //===------------------------------------------------------------------------=== Modified: llvm/trunk/include/llvm/Bitcode/Archive.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Archive.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Archive.h (original) +++ llvm/trunk/include/llvm/Bitcode/Archive.h Wed Jul 1 18:13:44 2009 @@ -280,7 +280,7 @@ /// @brief Create an empty Archive. static Archive* CreateEmpty( const sys::Path& Filename,///< Name of the archive to (eventually) create. - const LLVMContext& C ///< Context to use for global information + LLVMContext& C ///< Context to use for global information ); /// Open an existing archive and load its contents in preparation for @@ -291,7 +291,7 @@ /// @brief Open and load an archive file static Archive* OpenAndLoad( const sys::Path& filePath, ///< The file path to open and load - const LLVMContext& C, ///< The context to use for global information + LLVMContext& C, ///< The context to use for global information std::string* ErrorMessage ///< An optional error string ); @@ -313,7 +313,7 @@ /// @brief Open an existing archive and load its symbols. static Archive* OpenAndLoadSymbols( const sys::Path& Filename, ///< Name of the archive file to open - const LLVMContext& C, ///< The context to use for global info + LLVMContext& C, ///< The context to use for global info std::string* ErrorMessage=0 ///< An optional error string ); @@ -453,7 +453,7 @@ protected: /// @brief Construct an Archive for \p filename and optionally map it /// into memory. - explicit Archive(const sys::Path& filename, const LLVMContext& C); + explicit Archive(const sys::Path& filename, LLVMContext& C); /// @param data The symbol table data to be parsed /// @param len The length of the symbol table data @@ -534,7 +534,7 @@ unsigned firstFileOffset; ///< Offset to first normal file. ModuleMap modules; ///< The modules loaded via symbol lookup. ArchiveMember* foreignST; ///< This holds the foreign symbol table. - const LLVMContext& Context; ///< This holds global data. + LLVMContext& Context; ///< This holds global data. /// @} /// @name Hidden /// @{ Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original) +++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Wed Jul 1 18:13:44 2009 @@ -32,13 +32,13 @@ /// error, this returns null, *does not* take ownership of Buffer, and fills /// in *ErrMsg with an error description if ErrMsg is non-null. ModuleProvider *getBitcodeModuleProvider(MemoryBuffer *Buffer, - const LLVMContext& Context, + LLVMContext& Context, std::string *ErrMsg = 0); /// ParseBitcodeFile - Read the specified bitcode file, returning the module. /// If an error occurs, this returns null and fills in *ErrMsg if it is /// non-null. This method *never* takes ownership of Buffer. - Module *ParseBitcodeFile(MemoryBuffer *Buffer, const LLVMContext& Context, + Module *ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext& Context, std::string *ErrMsg = 0); /// WriteBitcodeToFile - Write the specified module to the specified output Modified: llvm/trunk/include/llvm/Debugger/Debugger.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Debugger/Debugger.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/include/llvm/Debugger/Debugger.h (original) +++ llvm/trunk/include/llvm/Debugger/Debugger.h Wed Jul 1 18:13:44 2009 @@ -96,7 +96,7 @@ /// the PATH for the specified program, loading it when found. If the /// specified program cannot be found, an exception is thrown to indicate /// the error. - void loadProgram(const std::string &Path, const LLVMContext& Context); + void loadProgram(const std::string &Path, LLVMContext& Context); /// unloadProgram - If a program is running, kill it, then unload all traces /// of the current program. If no program is loaded, this method silently Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Wed Jul 1 18:13:44 2009 @@ -198,7 +198,7 @@ }; /// FOR BACKWARDS COMPATIBILITY - Returns a global context. -extern const LLVMContext& getGlobalContext(); +extern LLVMContext& getGlobalContext(); } Modified: llvm/trunk/include/llvm/Linker.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/include/llvm/Linker.h (original) +++ llvm/trunk/include/llvm/Linker.h Wed Jul 1 18:13:44 2009 @@ -67,7 +67,7 @@ Linker( const std::string& progname, ///< name of tool running linker const std::string& modulename, ///< name of linker's end-result module - const LLVMContext& C, ///< Context for global info + LLVMContext& C, ///< Context for global info unsigned Flags = 0 ///< ControlFlags (one or more |'d together) ); @@ -285,7 +285,7 @@ /// @name Data /// @{ private: - const LLVMContext& Context; ///< The context for global information + LLVMContext& Context; ///< The context for global information Module* Composite; ///< The composite module linked together std::vector LibPaths; ///< The library search paths unsigned Flags; ///< Flags to control optional behavior. Modified: llvm/trunk/include/llvm/Module.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Module.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/include/llvm/Module.h (original) +++ llvm/trunk/include/llvm/Module.h Wed Jul 1 18:13:44 2009 @@ -110,7 +110,7 @@ /// @name Member Variables /// @{ private: - const LLVMContext& Context; ///< The LLVMContext from which types and + LLVMContext& Context; ///< The LLVMContext from which types and ///< constants are allocated. GlobalListType GlobalList; ///< The Global Variables in the module FunctionListType FunctionList; ///< The Functions in the module @@ -131,7 +131,7 @@ public: /// The Module constructor. Note that there is no default constructor. You /// must provide a name for the module upon construction. - explicit Module(const std::string &ModuleID, const LLVMContext& C); + explicit Module(const std::string &ModuleID, LLVMContext& C); /// The module destructor. This will dropAllReferences. ~Module(); @@ -162,7 +162,7 @@ /// Get the global data context. /// @returns LLVMContext - a container for LLVM's global information - const LLVMContext& getContext() const { return Context; } + LLVMContext& getContext() const { return Context; } /// Get any module-scope inline assembly blocks. /// @returns a string containing the module-scope inline assembly blocks. Modified: llvm/trunk/lib/Archive/Archive.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/Archive.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/Archive/Archive.cpp (original) +++ llvm/trunk/lib/Archive/Archive.cpp Wed Jul 1 18:13:44 2009 @@ -138,7 +138,7 @@ // Archive constructor - this is the only constructor that gets used for the // Archive class. Everything else (default,copy) is deprecated. This just // initializes and maps the file into memory, if requested. -Archive::Archive(const sys::Path& filename, const LLVMContext& C) +Archive::Archive(const sys::Path& filename, LLVMContext& C) : archPath(filename), members(), mapfile(0), base(0), symTab(), strtab(), symTabSize(0), firstFileOffset(0), modules(), foreignST(0), Context(C) { } @@ -208,7 +208,7 @@ // Get just the externally visible defined symbols from the bitcode bool llvm::GetBitcodeSymbols(const sys::Path& fName, - const LLVMContext& Context, + LLVMContext& Context, std::vector& symbols, std::string* ErrMsg) { std::auto_ptr Buffer( @@ -240,7 +240,7 @@ ModuleProvider* llvm::GetBitcodeSymbols(const unsigned char *BufPtr, unsigned Length, const std::string& ModuleID, - const LLVMContext& Context, + LLVMContext& Context, std::vector& symbols, std::string* ErrMsg) { // Get the module provider Modified: llvm/trunk/lib/Archive/ArchiveInternals.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveInternals.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveInternals.h (original) +++ llvm/trunk/lib/Archive/ArchiveInternals.h Wed Jul 1 18:13:44 2009 @@ -73,13 +73,13 @@ // Get just the externally visible defined symbols from the bitcode bool GetBitcodeSymbols(const sys::Path& fName, - const LLVMContext& Context, + LLVMContext& Context, std::vector& symbols, std::string* ErrMsg); ModuleProvider* GetBitcodeSymbols(const unsigned char*Buffer,unsigned Length, const std::string& ModuleID, - const LLVMContext& Context, + LLVMContext& Context, std::vector& symbols, std::string* ErrMsg); } Modified: llvm/trunk/lib/Archive/ArchiveReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveReader.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveReader.cpp (original) +++ llvm/trunk/lib/Archive/ArchiveReader.cpp Wed Jul 1 18:13:44 2009 @@ -327,7 +327,7 @@ // Open and completely load the archive file. Archive* -Archive::OpenAndLoad(const sys::Path& file, const LLVMContext& C, +Archive::OpenAndLoad(const sys::Path& file, LLVMContext& C, std::string* ErrorMessage) { std::auto_ptr result ( new Archive(file, C)); if (result->mapToMemory(ErrorMessage)) @@ -442,7 +442,7 @@ // Open the archive and load just the symbol tables Archive* Archive::OpenAndLoadSymbols(const sys::Path& file, - const LLVMContext& C, + LLVMContext& C, std::string* ErrorMessage) { std::auto_ptr result ( new Archive(file, C) ); if (result->mapToMemory(ErrorMessage)) Modified: llvm/trunk/lib/Archive/ArchiveWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveWriter.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveWriter.cpp (original) +++ llvm/trunk/lib/Archive/ArchiveWriter.cpp Wed Jul 1 18:13:44 2009 @@ -64,7 +64,7 @@ } // Create an empty archive. -Archive* Archive::CreateEmpty(const sys::Path& FilePath, const LLVMContext& C) { +Archive* Archive::CreateEmpty(const sys::Path& FilePath, LLVMContext& C) { Archive* result = new Archive(FilePath, C); return result; } Modified: llvm/trunk/lib/AsmParser/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Parser.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Parser.cpp (original) +++ llvm/trunk/lib/AsmParser/Parser.cpp Wed Jul 1 18:13:44 2009 @@ -21,7 +21,7 @@ using namespace llvm; Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err, - const LLVMContext& Context) { + LLVMContext& Context) { Err.setFilename(Filename); std::string ErrorStr; @@ -39,7 +39,7 @@ } Module *llvm::ParseAssemblyString(const char *AsmString, Module *M, - ParseError &Err, const LLVMContext& Context) { + ParseError &Err, LLVMContext& Context) { Err.setFilename(""); OwningPtr Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Jul 1 18:13:44 2009 @@ -2090,7 +2090,7 @@ /// getBitcodeModuleProvider - lazy function-at-a-time loading from a file. /// ModuleProvider *llvm::getBitcodeModuleProvider(MemoryBuffer *Buffer, - const LLVMContext& Context, + LLVMContext& Context, std::string *ErrMsg) { BitcodeReader *R = new BitcodeReader(Buffer, Context); if (R->ParseBitcode()) { @@ -2107,7 +2107,7 @@ /// ParseBitcodeFile - Read the specified bitcode file, returning the module. /// If an error occurs, return null and fill in *ErrMsg if non-null. -Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, const LLVMContext& Context, +Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext& Context, std::string *ErrMsg){ BitcodeReader *R; R = static_cast(getBitcodeModuleProvider(Buffer, Context, Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Wed Jul 1 18:13:44 2009 @@ -86,7 +86,7 @@ }; class BitcodeReader : public ModuleProvider { - const LLVMContext& Context; + LLVMContext& Context; MemoryBuffer *Buffer; BitstreamReader StreamFile; BitstreamCursor Stream; @@ -125,7 +125,7 @@ /// stream) and what linkage the original function had. DenseMap > DeferredFunctionInfo; public: - explicit BitcodeReader(MemoryBuffer *buffer, const LLVMContext& C) + explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext& C) : Context(C), Buffer(buffer), ErrorString(0) { HasReversedFunctionsWithBodies = false; } Modified: llvm/trunk/lib/Debugger/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Debugger/Debugger.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/Debugger/Debugger.cpp (original) +++ llvm/trunk/lib/Debugger/Debugger.cpp Wed Jul 1 18:13:44 2009 @@ -47,7 +47,7 @@ static Module * getMaterializedModuleProvider(const std::string &Filename, - const LLVMContext& C) { + LLVMContext& C) { std::auto_ptr Buffer; Buffer.reset(MemoryBuffer::getFileOrSTDIN(Filename.c_str())); if (Buffer.get()) @@ -59,7 +59,7 @@ /// the PATH for the specified program, loading it when found. If the /// specified program cannot be found, an exception is thrown to indicate the /// error. -void Debugger::loadProgram(const std::string &Filename, const LLVMContext& C) { +void Debugger::loadProgram(const std::string &Filename, LLVMContext& C) { if ((Program = getMaterializedModuleProvider(Filename, C)) || (Program = getMaterializedModuleProvider(Filename+".bc", C))) return; // Successfully loaded the program. Modified: llvm/trunk/lib/Linker/Linker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/Linker.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/Linker/Linker.cpp (original) +++ llvm/trunk/lib/Linker/Linker.cpp Wed Jul 1 18:13:44 2009 @@ -20,7 +20,7 @@ using namespace llvm; Linker::Linker(const std::string& progname, const std::string& modname, - const LLVMContext& C, unsigned flags): + LLVMContext& C, unsigned flags): Context(C), Composite(new Module(modname, C)), LibPaths(), Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Wed Jul 1 18:13:44 2009 @@ -22,7 +22,7 @@ static ManagedStatic GlobalContext; -const LLVMContext& llvm::getGlobalContext() { +LLVMContext& llvm::getGlobalContext() { return *GlobalContext; } Modified: llvm/trunk/lib/VMCore/Module.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Module.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Module.cpp (original) +++ llvm/trunk/lib/VMCore/Module.cpp Wed Jul 1 18:13:44 2009 @@ -55,7 +55,7 @@ // Primitive Module methods. // -Module::Module(const std::string &MID, const LLVMContext& C) +Module::Module(const std::string &MID, LLVMContext& C) : Context(C), ModuleID(MID), DataLayout("") { ValSymTab = new ValueSymbolTable(); TypeSymTab = new TypeSymbolTable(); Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/BugDriver.cpp (original) +++ llvm/trunk/tools/bugpoint/BugDriver.cpp Wed Jul 1 18:13:44 2009 @@ -65,7 +65,7 @@ BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs, unsigned timeout, unsigned memlimit, - const LLVMContext& ctxt) + LLVMContext& ctxt) : Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile), Program(0), Interpreter(0), SafeInterpreter(0), gcc(0), run_as_child(as_child), run_find_bugs(find_bugs), Timeout(timeout), @@ -76,7 +76,7 @@ /// return it, or return null if not possible. /// Module *llvm::ParseInputFile(const std::string &Filename, - const LLVMContext& Ctxt) { + LLVMContext& Ctxt) { std::auto_ptr Buffer(MemoryBuffer::getFileOrSTDIN(Filename)); Module *Result = 0; if (Buffer.get()) Modified: llvm/trunk/tools/bugpoint/BugDriver.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/BugDriver.h (original) +++ llvm/trunk/tools/bugpoint/BugDriver.h Wed Jul 1 18:13:44 2009 @@ -43,7 +43,7 @@ extern bool BugpointIsInterrupted; class BugDriver { - const LLVMContext& Context; + LLVMContext& Context; const std::string ToolName; // Name of bugpoint std::string ReferenceOutputFile; // Name of `good' output file Module *Program; // The raw program, linked together @@ -62,11 +62,11 @@ public: BugDriver(const char *toolname, bool as_child, bool find_bugs, - unsigned timeout, unsigned memlimit, const LLVMContext& ctxt); + unsigned timeout, unsigned memlimit, LLVMContext& ctxt); const std::string &getToolName() const { return ToolName; } - const LLVMContext& getContext() { return Context; } + LLVMContext& getContext() { return Context; } // Set up methods... these methods are used to copy information about the // command line arguments into instance variables of BugDriver. @@ -295,7 +295,7 @@ /// return it, or return null if not possible. /// Module *ParseInputFile(const std::string &InputFilename, - const LLVMContext& ctxt); + LLVMContext& ctxt); /// getPassesString - Turn a list of passes into a string which indicates the Modified: llvm/trunk/tools/llvm-db/CLIDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/CLIDebugger.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/CLIDebugger.cpp (original) +++ llvm/trunk/tools/llvm-db/CLIDebugger.cpp Wed Jul 1 18:13:44 2009 @@ -22,7 +22,7 @@ /// CLIDebugger constructor - This initializes the debugger to its default /// state, and initializes the command table. /// -CLIDebugger::CLIDebugger(const LLVMContext& ctxt) +CLIDebugger::CLIDebugger(LLVMContext& ctxt) : Context(ctxt), TheProgramInfo(0), TheRuntimeInfo(0), Prompt("(llvm-db) "), ListSize(10) { // Initialize instance variables Modified: llvm/trunk/tools/llvm-db/CLIDebugger.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/CLIDebugger.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/llvm-db/CLIDebugger.h (original) +++ llvm/trunk/tools/llvm-db/CLIDebugger.h Wed Jul 1 18:13:44 2009 @@ -29,7 +29,7 @@ /// CLIDebugger - This class implements the command line interface for the /// LLVM debugger. class CLIDebugger { - const LLVMContext& Context; + LLVMContext& Context; /// Dbg - The low-level LLVM debugger object that we use to do our dirty /// work. @@ -82,7 +82,7 @@ const SourceLanguage *CurrentLanguage; public: - CLIDebugger(const LLVMContext& ctxt); + CLIDebugger(LLVMContext& ctxt); /// getDebugger - Return the current LLVM debugger implementation being /// used. Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/llvm-link/llvm-link.cpp (original) +++ llvm/trunk/tools/llvm-link/llvm-link.cpp Wed Jul 1 18:13:44 2009 @@ -49,7 +49,7 @@ // searches the link path for the specified file to try to find it... // static inline std::auto_ptr LoadFile(const std::string &FN, - const LLVMContext& Context) { + LLVMContext& Context) { sys::Path Filename; if (!Filename.set(FN)) { cerr << "Invalid file name: '" << FN << "'\n"; Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Wed Jul 1 18:13:44 2009 @@ -69,7 +69,7 @@ } -LTOCodeGenerator::LTOCodeGenerator(const LLVMContext& Context) +LTOCodeGenerator::LTOCodeGenerator(LLVMContext& Context) : _context(Context), _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL), _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false), Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Wed Jul 1 18:13:44 2009 @@ -31,7 +31,7 @@ public: static const char* getVersionString(); - LTOCodeGenerator(const llvm::LLVMContext& Context); + LTOCodeGenerator(llvm::LLVMContext& Context); ~LTOCodeGenerator(); bool addModule(class LTOModule*, std::string& errMsg); @@ -54,7 +54,7 @@ typedef llvm::StringMap StringSet; - const llvm::LLVMContext& _context; + llvm::LLVMContext& _context; llvm::Linker _linker; llvm::TargetMachine* _target; bool _emitDwarfDebugInfo; Modified: llvm/trunk/tools/lto/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Wed Jul 1 18:13:44 2009 @@ -87,7 +87,7 @@ } LTOModule* LTOModule::makeLTOModule(const char* path, - const LLVMContext& Context, + LLVMContext& Context, std::string& errMsg) { OwningPtr buffer(MemoryBuffer::getFile(path, &errMsg)); @@ -113,7 +113,7 @@ LTOModule* LTOModule::makeLTOModule(const void* mem, size_t length, - const LLVMContext& Context, + LLVMContext& Context, std::string& errMsg) { OwningPtr buffer(makeBuffer(mem, length)); @@ -142,7 +142,7 @@ } LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer, - const LLVMContext& Context, + LLVMContext& Context, std::string& errMsg) { // parse bitcode buffer Modified: llvm/trunk/tools/lto/LTOModule.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.h?rev=74655&r1=74654&r2=74655&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.h (original) +++ llvm/trunk/tools/lto/LTOModule.h Wed Jul 1 18:13:44 2009 @@ -52,10 +52,10 @@ const char* triplePrefix); static LTOModule* makeLTOModule(const char* path, - const llvm::LLVMContext& Context, + llvm::LLVMContext& Context, std::string& errMsg); static LTOModule* makeLTOModule(const void* mem, size_t length, - const llvm::LLVMContext& Context, + llvm::LLVMContext& Context, std::string& errMsg); const char* getTargetTriple(); @@ -91,7 +91,7 @@ const char* triplePrefix); static LTOModule* makeLTOModule(llvm::MemoryBuffer* buffer, - const llvm::LLVMContext& Context, + llvm::LLVMContext& Context, std::string& errMsg); static llvm::MemoryBuffer* makeBuffer(const void* mem, size_t length); From isanbard at gmail.com Wed Jul 1 18:14:05 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Jul 2009 23:14:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74656 - /llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Message-ID: <200907012314.n61NE5BY028656@zion.cs.uiuc.edu> Author: void Date: Wed Jul 1 18:14:04 2009 New Revision: 74656 URL: http://llvm.org/viewvc/llvm-project?rev=74656&view=rev Log: Hack to get this file to compile with LLVMContext stuff. Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=74656&r1=74655&r2=74656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Wed Jul 1 18:14:04 2009 @@ -46,10 +46,12 @@ /// void dummy_function() { llvm::ModuleProvider *MP = new llvm::ExistingModuleProvider(0); + llvm::LLVMContext Ctxt(); + llvm::createVerifierPass(); llvm::CreateBitcodeWriterPass(*llvm::cout); llvm::WriteBitcodeToFile(0, *llvm::cout); - llvm::ParseBitcodeFile(NULL); + llvm::ParseBitcodeFile(NULL, Ctxt); llvm::MemoryBuffer::getNewMemBuffer(0); llvm::createInstructionCombiningPass(); From bob.wilson at apple.com Wed Jul 1 18:16:05 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 01 Jul 2009 23:16:05 -0000 Subject: [llvm-commits] [llvm] r74658 - in /llvm/trunk/lib/Target/ARM: ARMAddressingModes.h ARMConstantIslandPass.cpp ARMISelDAGToDAG.cpp ARMInstrFormats.td ARMInstrInfo.h ARMInstrInfo.td AsmPrinter/ARMAsmPrinter.cpp Message-ID: <200907012316.n61NG6ID028740@zion.cs.uiuc.edu> Author: bwilson Date: Wed Jul 1 18:16:05 2009 New Revision: 74658 URL: http://llvm.org/viewvc/llvm-project?rev=74658&view=rev Log: Add a new addressing mode for NEON load/store instructions. Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrInfo.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAddressingModes.h?rev=74658&r1=74657&r2=74658&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMAddressingModes.h (original) +++ llvm/trunk/lib/Target/ARM/ARMAddressingModes.h Wed Jul 1 18:16:05 2009 @@ -496,7 +496,29 @@ static inline bool getAM5WBFlag(unsigned AM5Opc) { return ((AM5Opc >> 8) & 1); } - + + //===--------------------------------------------------------------------===// + // Addressing Mode #6 + //===--------------------------------------------------------------------===// + // + // This is used for NEON load / store instructions. + // + // addrmode6 := reg with optional writeback + // + // This is stored in three operands [regaddr, regupdate, opc]. The first is + // the address register. The second register holds the value of a post-access + // increment for writeback or reg0 if no writeback or if the writeback + // increment is the size of the memory access. The third operand encodes + // whether there is writeback to the address register. + + static inline unsigned getAM6Opc(bool WB = false) { + return (int)WB; + } + + static inline bool getAM6WBFlag(unsigned Mode) { + return Mode & 1; + } + } // end namespace ARM_AM } // end namespace llvm Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=74658&r1=74657&r2=74658&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Wed Jul 1 18:16:05 2009 @@ -462,6 +462,7 @@ Bits = 8; Scale = 4; // +-(offset_8*4) break; + // addrmode6 has no immediate offset. case ARMII::AddrModeT1_1: Bits = 5; // +offset_5 break; Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=74658&r1=74657&r2=74658&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Wed Jul 1 18:16:05 2009 @@ -76,9 +76,11 @@ SDValue &Offset, SDValue &Opc); bool SelectAddrMode5(SDValue Op, SDValue N, SDValue &Base, SDValue &Offset); + bool SelectAddrMode6(SDValue Op, SDValue N, SDValue &Addr, SDValue &Update, + SDValue &Opc); bool SelectAddrModePC(SDValue Op, SDValue N, SDValue &Offset, - SDValue &Label); + SDValue &Label); bool SelectThumbAddrModeRR(SDValue Op, SDValue N, SDValue &Base, SDValue &Offset); @@ -105,7 +107,6 @@ bool SelectT2AddrModeSoReg(SDValue Op, SDValue N, SDValue &Base, SDValue &OffReg, SDValue &ShImm); - // Include the pieces autogenerated from the target description. #include "ARMGenDAGISel.inc" @@ -415,6 +416,16 @@ return true; } +bool ARMDAGToDAGISel::SelectAddrMode6(SDValue Op, SDValue N, + SDValue &Addr, SDValue &Update, + SDValue &Opc) { + Addr = N; + // The optional writeback is handled in ARMLoadStoreOpt. + Update = CurDAG->getRegister(0, MVT::i32); + Opc = CurDAG->getTargetConstant(ARM_AM::getAM6Opc(false), MVT::i32); + return true; +} + bool ARMDAGToDAGISel::SelectAddrModePC(SDValue Op, SDValue N, SDValue &Offset, SDValue &Label) { if (N.getOpcode() == ARMISD::PIC_ADD && N.hasOneUse()) { Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=74658&r1=74657&r2=74658&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Wed Jul 1 18:16:05 2009 @@ -72,15 +72,16 @@ def AddrMode3 : AddrMode<3>; def AddrMode4 : AddrMode<4>; def AddrMode5 : AddrMode<5>; -def AddrModeT1_1 : AddrMode<6>; -def AddrModeT1_2 : AddrMode<7>; -def AddrModeT1_4 : AddrMode<8>; -def AddrModeT1_s : AddrMode<9>; -def AddrModeT2_i12: AddrMode<10>; -def AddrModeT2_i8 : AddrMode<11>; -def AddrModeT2_so : AddrMode<12>; -def AddrModeT2_pc : AddrMode<13>; -def AddrModeT2_i8s4 : AddrMode<14>; +def AddrMode6 : AddrMode<6>; +def AddrModeT1_1 : AddrMode<7>; +def AddrModeT1_2 : AddrMode<8>; +def AddrModeT1_4 : AddrMode<9>; +def AddrModeT1_s : AddrMode<10>; +def AddrModeT2_i12: AddrMode<12>; +def AddrModeT2_i8 : AddrMode<12>; +def AddrModeT2_so : AddrMode<13>; +def AddrModeT2_pc : AddrMode<14>; +def AddrModeT2_i8s4 : AddrMode<15>; // Instruction size. class SizeFlagVal val> { Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=74658&r1=74657&r2=74658&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Wed Jul 1 18:16:05 2009 @@ -39,15 +39,16 @@ AddrMode3 = 3, AddrMode4 = 4, AddrMode5 = 5, - AddrModeT1_1 = 6, - AddrModeT1_2 = 7, - AddrModeT1_4 = 8, - AddrModeT1_s = 9, // i8 * 4 for pc and sp relative data - AddrModeT2_i12 = 10, - AddrModeT2_i8 = 11, - AddrModeT2_so = 12, - AddrModeT2_pc = 13, // +/- i12 for pc relative data - AddrModeT2_i8s4 = 14, // i8 * 4 + AddrMode6 = 6, + AddrModeT1_1 = 7, + AddrModeT1_2 = 8, + AddrModeT1_4 = 9, + AddrModeT1_s = 10, // i8 * 4 for pc and sp relative data + AddrModeT2_i12 = 11, + AddrModeT2_i8 = 12, + AddrModeT2_so = 13, + AddrModeT2_pc = 14, // +/- i12 for pc relative data + AddrModeT2_i8s4 = 15, // i8 * 4 // Size* - Flags to keep track of the size of an instruction. SizeShift = 4, Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=74658&r1=74657&r2=74658&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Wed Jul 1 18:16:05 2009 @@ -287,6 +287,14 @@ let MIOperandInfo = (ops GPR, i32imm); } +// addrmode6 := reg with optional writeback +// +def addrmode6 : Operand, + ComplexPattern { + let PrintMethod = "printAddrMode6Operand"; + let MIOperandInfo = (ops GPR:$addr, GPR:$upd, i32imm); +} + // addrmodepc := pc + reg // def addrmodepc : Operand, Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=74658&r1=74657&r2=74658&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Wed Jul 1 18:16:05 2009 @@ -105,6 +105,7 @@ const char *Modifier = 0); void printAddrMode5Operand(const MachineInstr *MI, int OpNum, const char *Modifier = 0); + void printAddrMode6Operand(const MachineInstr *MI, int OpNum); void printAddrModePCOperand(const MachineInstr *MI, int OpNum, const char *Modifier = 0); void printBitfieldInvMaskImmOperand (const MachineInstr *MI, int OpNum); @@ -587,6 +588,22 @@ O << "]"; } +void ARMAsmPrinter::printAddrMode6Operand(const MachineInstr *MI, int Op) { + const MachineOperand &MO1 = MI->getOperand(Op); + const MachineOperand &MO2 = MI->getOperand(Op+1); + const MachineOperand &MO3 = MI->getOperand(Op+2); + + // FIXME: No support yet for specifying alignment. + O << "[" << TM.getRegisterInfo()->get(MO1.getReg()).AsmName << "]"; + + if (ARM_AM::getAM6WBFlag(MO3.getImm())) { + if (MO2.getReg() == 0) + O << "!"; + else + O << ", " << TM.getRegisterInfo()->get(MO2.getReg()).AsmName; + } +} + void ARMAsmPrinter::printAddrModePCOperand(const MachineInstr *MI, int Op, const char *Modifier) { if (Modifier && strcmp(Modifier, "label") == 0) { From dpatel at apple.com Wed Jul 1 18:19:02 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Jul 2009 23:19:02 -0000 Subject: [llvm-commits] [llvm] r74659 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200907012319.n61NJ2pa028857@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 18:19:01 2009 New Revision: 74659 URL: http://llvm.org/viewvc/llvm-project?rev=74659&view=rev Log: Refactor. No functionality change. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=74659&r1=74658&r2=74659&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Jul 1 18:19:01 2009 @@ -3955,13 +3955,15 @@ if (!DIDescriptor::ValidDebugInfo(SP, OptLevel)) return 0; + DISubprogram Subprogram(cast(SP)); + DICompileUnit CompileUnit = Subprogram.getCompileUnit(); + unsigned Line = Subprogram.getLineNumber(); + MachineFunction &MF = DAG.getMachineFunction(); if (OptLevel == CodeGenOpt::None) { // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is what // (most?) gdb expects. DebugLoc PrevLoc = CurDebugLoc; - DISubprogram Subprogram(cast(SP)); - DICompileUnit CompileUnit = Subprogram.getCompileUnit(); if (!Subprogram.describes(MF.getFunction())) { // This is a beginning of an inlined function. @@ -3973,7 +3975,6 @@ return 0; // Record the source line. - unsigned Line = Subprogram.getLineNumber(); setCurDebugLoc(DebugLoc::get( MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0))); @@ -3997,8 +3998,6 @@ } } } else { - DISubprogram Subprogram(cast(SP)); - std::string SPName; Subprogram.getLinkageName(SPName); if (!SPName.empty() @@ -4008,14 +4007,9 @@ return 0; } - // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is - // what (most?) gdb expects. - DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - // Record the source line but does not create a label for the normal // function start. It will be emitted at asm emission time. However, // create a label if this is a beginning of inlined function. - unsigned Line = Subprogram.getLineNumber(); setCurDebugLoc(DebugLoc::get( MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0))); // FIXME - Start new region because llvm.dbg.func_start also defines From gohman at apple.com Wed Jul 1 18:21:39 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Jul 2009 23:21:39 -0000 Subject: [llvm-commits] [llvm] r74661 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Message-ID: <200907012321.n61NLdaq028967@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 1 18:21:38 2009 New Revision: 74661 URL: http://llvm.org/viewvc/llvm-project?rev=74661&view=rev Log: Request LCSSA after LoopSimplify. This fixes a problem in which the PassManager was scheduling LCSSA before LoopSimplify, which does not preserve LCSSA. Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=74661&r1=74660&r2=74661&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Wed Jul 1 18:21:38 2009 @@ -82,10 +82,10 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.addRequired(); - AU.addRequiredID(LCSSAID); AU.addRequiredID(LoopSimplifyID); AU.addRequired(); AU.addRequired(); + AU.addRequiredID(LCSSAID); AU.addPreserved(); AU.addPreservedID(LoopSimplifyID); AU.addPreserved(); From clattner at apple.com Wed Jul 1 18:25:49 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 16:25:49 -0700 Subject: [llvm-commits] [llvm] r74630 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/AsmWriter.cpp test/Feature/mdnode2.ll In-Reply-To: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> References: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> Message-ID: <31D1282E-9B3F-42C5-87B5-32FC0AC7F4E3@apple.com> On Jul 1, 2009, at 12:21 PM, Devang Patel wrote: > Author: dpatel > Date: Wed Jul 1 14:21:12 2009 > New Revision: 74630 > > URL: http://llvm.org/viewvc/llvm-project?rev=74630&view=rev > Log: > Support stand alone metadata syntax. > > !0 = constant metadata !{i32 21, i32 22} Why "constant"? MD has no linkage and all are constants? Your parsing logic throws away "isconstant". -Chris From clattner at apple.com Wed Jul 1 18:27:38 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 16:27:38 -0700 Subject: [llvm-commits] [llvm] r74640 - in /llvm/trunk: examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/Kaleidoscope/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/Debugger/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Debugger/ lib/Linker/ lib/VMCore/ tools/bugpoint/ tools/llc/ tools/lli/ tools/llvm-ar/ tools/llvm-as/ tools/llvm-db/ tools/llvm-dis/ tools/llvm-extract/ tools/llvm-ld/ tools/llvm-link/ tools/llvm-nm/ t... In-Reply-To: <200907012122.n61LMcRr025036@zion.cs.uiuc.edu> References: <200907012122.n61LMcRr025036@zion.cs.uiuc.edu> Message-ID: <8B0AE62D-82C0-47AE-B5BB-01401A0B8276@apple.com> On Jul 1, 2009, at 2:22 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Jul 1 16:22:36 2009 > New Revision: 74640 > > URL: http://llvm.org/viewvc/llvm-project?rev=74640&view=rev > Log: > Hold the LLVMContext by reference rather than by pointer. Thanks Owen, -Chris From resistor at mac.com Wed Jul 1 18:28:56 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 23:28:56 -0000 Subject: [llvm-commits] [llvm] r74663 - /llvm/trunk/include/llvm-c/lto.h Message-ID: <200907012328.n61NSuOx029195@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 18:28:55 2009 New Revision: 74663 URL: http://llvm.org/viewvc/llvm-project?rev=74663&view=rev Log: Fix the LTO header for LLVMContext changes. Modified: llvm/trunk/include/llvm-c/lto.h Modified: llvm/trunk/include/llvm-c/lto.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=74663&r1=74662&r2=74663&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/lto.h (original) +++ llvm/trunk/include/llvm-c/lto.h Wed Jul 1 18:28:55 2009 @@ -16,6 +16,7 @@ #ifndef LTO_H #define LTO_H 1 +#include "llvm-c/Core.h" #include #include @@ -112,7 +113,7 @@ * Returns NULL on error (check lto_get_error_message() for details). */ extern lto_module_t -lto_module_create(const char* path); +lto_module_create(const char* path, LLVMContextRef Ctxt); /** @@ -120,7 +121,8 @@ * Returns NULL on error (check lto_get_error_message() for details). */ extern lto_module_t -lto_module_create_from_memory(const void* mem, size_t length); +lto_module_create_from_memory(const void* mem, size_t length, + LLVMContextRef Ctxt); /** @@ -164,7 +166,7 @@ * Returns NULL on error (check lto_get_error_message() for details). */ extern lto_code_gen_t -lto_codegen_create(void); +lto_codegen_create(LLVMContextRef Ctxt); /** From resistor at mac.com Wed Jul 1 18:29:47 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 16:29:47 -0700 Subject: [llvm-commits] [llvm] r74663 - /llvm/trunk/include/llvm-c/lto.h In-Reply-To: <200907012328.n61NSuOx029195@zion.cs.uiuc.edu> References: <200907012328.n61NSuOx029195@zion.cs.uiuc.edu> Message-ID: This is based on a patch by John Mosby. --Owen On Jul 1, 2009, at 4:28 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Jul 1 18:28:55 2009 > New Revision: 74663 > > URL: http://llvm.org/viewvc/llvm-project?rev=74663&view=rev > Log: > Fix the LTO header for LLVMContext changes. > > Modified: > llvm/trunk/include/llvm-c/lto.h > > Modified: llvm/trunk/include/llvm-c/lto.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=74663&r1=74662&r2=74663&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm-c/lto.h (original) > +++ llvm/trunk/include/llvm-c/lto.h Wed Jul 1 18:28:55 2009 > @@ -16,6 +16,7 @@ > #ifndef LTO_H > #define LTO_H 1 > > +#include "llvm-c/Core.h" > #include > #include > > @@ -112,7 +113,7 @@ > * Returns NULL on error (check lto_get_error_message() for details). > */ > extern lto_module_t > -lto_module_create(const char* path); > +lto_module_create(const char* path, LLVMContextRef Ctxt); > > > /** > @@ -120,7 +121,8 @@ > * Returns NULL on error (check lto_get_error_message() for details). > */ > extern lto_module_t > -lto_module_create_from_memory(const void* mem, size_t length); > +lto_module_create_from_memory(const void* mem, size_t length, > + LLVMContextRef Ctxt); > > > /** > @@ -164,7 +166,7 @@ > * Returns NULL on error (check lto_get_error_message() for details). > */ > extern lto_code_gen_t > -lto_codegen_create(void); > +lto_codegen_create(LLVMContextRef Ctxt); > > > /** > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Wed Jul 1 18:36:03 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 01 Jul 2009 23:36:03 -0000 Subject: [llvm-commits] [llvm] r74667 - /llvm/trunk/lib/Target/PowerPC/README.txt Message-ID: <200907012336.n61Na3uQ029453@zion.cs.uiuc.edu> Author: johannes Date: Wed Jul 1 18:36:02 2009 New Revision: 74667 URL: http://llvm.org/viewvc/llvm-project?rev=74667&view=rev Log: Add darwin stub removal to wishlist. Modified: llvm/trunk/lib/Target/PowerPC/README.txt Modified: llvm/trunk/lib/Target/PowerPC/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/README.txt?rev=74667&r1=74666&r2=74667&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/README.txt (original) +++ llvm/trunk/lib/Target/PowerPC/README.txt Wed Jul 1 18:36:02 2009 @@ -180,6 +180,15 @@ ===-------------------------------------------------------------------------=== +Darwin Stub removal: + +We still generate calls to foo$stub, and stubs, on Darwin. This is not +necessary on Leopard (10.5) or later, as stubs are generated by ld when +necessary. The choice should depend on the value of -mmacosx-version-min. +x86-32 does this right, see its logic. + +===-------------------------------------------------------------------------=== + Darwin Stub LICM optimization: Loops like this: @@ -196,6 +205,8 @@ stub). This is Darwin specific and would have to be done in the code generator. Probably not a win on x86. +Note that removing stubs altogether, as in the previous item, is better yet. + ===-------------------------------------------------------------------------=== Simple IPO for argument passing, change: From devang.patel at gmail.com Wed Jul 1 18:37:34 2009 From: devang.patel at gmail.com (Devang Patel) Date: Wed, 1 Jul 2009 16:37:34 -0700 Subject: [llvm-commits] [llvm] r74630 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/AsmWriter.cpp test/Feature/mdnode2.ll In-Reply-To: <31D1282E-9B3F-42C5-87B5-32FC0AC7F4E3@apple.com> References: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> <31D1282E-9B3F-42C5-87B5-32FC0AC7F4E3@apple.com> Message-ID: <352a1fb20907011637x3ef8db68o5e52c778f6e07b58@mail.gmail.com> On Wed, Jul 1, 2009 at 4:25 PM, Chris Lattner wrote: > > On Jul 1, 2009, at 12:21 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Wed Jul ?1 14:21:12 2009 >> New Revision: 74630 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74630&view=rev >> Log: >> Support stand alone metadata syntax. >> >> !0 = constant metadata !{i32 21, i32 22} > > Why "constant"? There is no need IMO. What do you say ? > MD has no linkage and all are constants? Yes. >?Your > parsing logic throws away "isconstant". - Devang From daniel at zuster.org Wed Jul 1 18:38:44 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 01 Jul 2009 23:38:44 -0000 Subject: [llvm-commits] [llvm] r74668 - /llvm/trunk/docs/WritingAnLLVMPass.html Message-ID: <200907012338.n61NciZT029532@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 18:38:44 2009 New Revision: 74668 URL: http://llvm.org/viewvc/llvm-project?rev=74668&view=rev Log: Try to clarify a point about getting DominatorTree info from a module pass. Modified: llvm/trunk/docs/WritingAnLLVMPass.html Modified: llvm/trunk/docs/WritingAnLLVMPass.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMPass.html?rev=74668&r1=74667&r2=74668&view=diff ============================================================================== --- llvm/trunk/docs/WritingAnLLVMPass.html (original) +++ llvm/trunk/docs/WritingAnLLVMPass.html Wed Jul 1 18:38:44 2009 @@ -491,10 +491,15 @@ ModulePass indicates that your pass uses the entire program as a unit, refering to function bodies in no predictable order, or adding and removing functions. Because nothing is known about the behavior of ModulePass -subclasses, no optimization can be done for their execution. A module pass -can use function level passes (e.g. dominators) using getAnalysis interface - getAnalysis<DominatorTree>(Function), if the function pass -does not require any module passes.

    +subclasses, no optimization can be done for their execution.

    + +

    A module pass can use function level passes (e.g. dominators) using +the getAnalysis interface +getAnalysis<DominatorTree>(llvm::Function *) to provide the +function to retrieve analysis result for, if the function pass does not require +any module passes. Note that this can only be done for functions for which the +analysis ran, e.g. in the case of dominators you should only ask for the +DominatorTree for function definitions, not declarations.

    To write a correct ModulePass subclass, derive from ModulePass and overload the runOnModule method with the From devang.patel at gmail.com Wed Jul 1 18:39:01 2009 From: devang.patel at gmail.com (Devang Patel) Date: Wed, 1 Jul 2009 16:39:01 -0700 Subject: [llvm-commits] [llvm] r74663 - /llvm/trunk/include/llvm-c/lto.h In-Reply-To: <200907012328.n61NSuOx029195@zion.cs.uiuc.edu> References: <200907012328.n61NSuOx029195@zion.cs.uiuc.edu> Message-ID: <352a1fb20907011639v7b6e2ed7lb9dd64ff83cb3a5b@mail.gmail.com> On Wed, Jul 1, 2009 at 4:28 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Jul ?1 18:28:55 2009 > New Revision: 74663 > > URL: http://llvm.org/viewvc/llvm-project?rev=74663&view=rev > Log: > Fix the LTO header for LLVMContext changes. What about LTO clients ? - Devang From isanbard at gmail.com Wed Jul 1 18:47:30 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Jul 2009 23:47:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74669 - /llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Message-ID: <200907012347.n61NlUe2029790@zion.cs.uiuc.edu> Author: void Date: Wed Jul 1 18:47:29 2009 New Revision: 74669 URL: http://llvm.org/viewvc/llvm-project?rev=74669&view=rev Log: Fix. Don't make this a function. Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=74669&r1=74668&r2=74669&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Wed Jul 1 18:47:29 2009 @@ -46,7 +46,7 @@ /// void dummy_function() { llvm::ModuleProvider *MP = new llvm::ExistingModuleProvider(0); - llvm::LLVMContext Ctxt(); + llvm::LLVMContext Ctxt; llvm::createVerifierPass(); llvm::CreateBitcodeWriterPass(*llvm::cout); From resistor at mac.com Wed Jul 1 18:53:07 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 16:53:07 -0700 Subject: [llvm-commits] [llvm] r74663 - /llvm/trunk/include/llvm-c/lto.h In-Reply-To: <352a1fb20907011639v7b6e2ed7lb9dd64ff83cb3a5b@mail.gmail.com> References: <200907012328.n61NSuOx029195@zion.cs.uiuc.edu> <352a1fb20907011639v7b6e2ed7lb9dd64ff83cb3a5b@mail.gmail.com> Message-ID: <6D175958-9440-4A13-A1C8-CC1AE05680F3@mac.com> On Jul 1, 2009, at 4:39 PM, Devang Patel wrote: > On Wed, Jul 1, 2009 at 4:28 PM, Owen Anderson wrote: >> Author: resistor >> Date: Wed Jul 1 18:28:55 2009 >> New Revision: 74663 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74663&view=rev >> Log: >> Fix the LTO header for LLVMContext changes. > > What about LTO clients ? The only in-tree client I'm aware of is the Gold plugin, and Nicholas has agreed to update it, since I can't test it. --Owen From resistor at mac.com Wed Jul 1 18:56:46 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 23:56:46 -0000 Subject: [llvm-commits] [llvm] r74670 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp Message-ID: <200907012356.n61Nuk0u030068@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 18:56:45 2009 New Revision: 74670 URL: http://llvm.org/viewvc/llvm-project?rev=74670&view=rev Log: Add a few methods that got left out earlier. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74670&r1=74669&r2=74670&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Wed Jul 1 18:56:45 2009 @@ -53,6 +53,10 @@ LLVMContext(); ~LLVMContext(); + // Constant accessors + Constant* getNullValue(const Type* Ty); + Constant* getAllOnesValue(const Type* Ty); + // ConstantInt accessors ConstantInt* getConstantIntTrue(); ConstantInt* getConstantIntFalse(); @@ -180,6 +184,7 @@ OpaqueType* getOpaqueType(); // StructType accessors + StructType* getStructType(bool isPacked=false); StructType* getStructType(const std::vector& Params, bool isPacked = false); @@ -188,7 +193,7 @@ // PointerType accessors PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace); - PointerType* getPointerTypeUnqualified(const Type* ElementType); + PointerType* getPointerTypeUnqual(const Type* ElementType); // VectorType accessors VectorType* getVectorType(const Type* ElementType, unsigned NumElements); Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74670&r1=74669&r2=74670&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Wed Jul 1 18:56:45 2009 @@ -29,6 +29,15 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl()) { } LLVMContext::~LLVMContext() { delete pImpl; } +// Constant accessors +Constant* LLVMContext::getNullValue(const Type* Ty) { + return Constant::getNullValue(Ty); +} + +Constant* LLVMContext::getAllOnesValue(const Type* Ty) { + return Constant::getAllOnesValue(Ty); +} + // ConstantInt accessors. ConstantInt* LLVMContext::getConstantIntTrue() { return ConstantInt::getTrue(); @@ -409,6 +418,10 @@ } // StructType accessors +StructType* LLVMContext::getStructType(bool isPacked) { + return StructType::get(isPacked); +} + StructType* LLVMContext::getStructType(const std::vector& Params, bool isPacked) { return StructType::get(Params, isPacked); @@ -426,7 +439,7 @@ return PointerType::get(ElementType, AddressSpace); } -PointerType* LLVMContext::getPointerTypeUnqualified(const Type* ElementType) { +PointerType* LLVMContext::getPointerTypeUnqual(const Type* ElementType) { return PointerType::getUnqual(ElementType); } From resistor at mac.com Wed Jul 1 18:57:11 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 01 Jul 2009 23:57:11 -0000 Subject: [llvm-commits] [llvm] r74671 - in /llvm/trunk/lib/AsmParser: LLParser.cpp LLParser.h Message-ID: <200907012357.n61NvBuR030095@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 18:57:11 2009 New Revision: 74671 URL: http://llvm.org/viewvc/llvm-project?rev=74671&view=rev Log: Try again at converting the LLParser to use LLVMContext, without massive breakage this time. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74671&r1=74670&r2=74671&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul 1 18:57:11 2009 @@ -18,6 +18,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" +#include "llvm/LLVMContext.h" #include "llvm/MDNode.h" #include "llvm/Module.h" #include "llvm/ValueSymbolTable.h" @@ -997,7 +998,7 @@ break; case lltok::kw_opaque: // TypeRec ::= 'opaque' - Result = OpaqueType::get(); + Result = Context.getOpaqueType(); Lex.Lex(); break; case lltok::lbrace: @@ -1027,7 +1028,7 @@ if (const Type *T = M->getTypeByName(Lex.getStrVal())) { Result = T; } else { - Result = OpaqueType::get(); + Result = Context.getOpaqueType(); ForwardRefTypes.insert(std::make_pair(Lex.getStrVal(), std::make_pair(Result, Lex.getLoc()))); @@ -1046,7 +1047,7 @@ if (I != ForwardRefTypeIDs.end()) Result = I->second.first; else { - Result = OpaqueType::get(); + Result = Context.getOpaqueType(); ForwardRefTypeIDs.insert(std::make_pair(Lex.getUIntVal(), std::make_pair(Result, Lex.getLoc()))); @@ -1059,7 +1060,7 @@ Lex.Lex(); unsigned Val; if (ParseUInt32(Val)) return true; - OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder. + OpaqueType *OT = Context.getOpaqueType(); //Use temporary placeholder. UpRefs.push_back(UpRefRecord(Lex.getLoc(), Val, OT)); Result = OT; break; @@ -1080,7 +1081,7 @@ return TokError("pointers to void are invalid; use i8* instead"); if (!PointerType::isValidElementType(Result.get())) return TokError("pointer to this type is invalid"); - Result = HandleUpRefs(PointerType::getUnqual(Result.get())); + Result = HandleUpRefs(Context.getPointerTypeUnqual(Result.get())); Lex.Lex(); break; @@ -1097,7 +1098,7 @@ ParseToken(lltok::star, "expected '*' in address space")) return true; - Result = HandleUpRefs(PointerType::get(Result.get(), AddrSpace)); + Result = HandleUpRefs(Context.getPointerType(Result.get(), AddrSpace)); break; } @@ -1258,7 +1259,8 @@ for (unsigned i = 0, e = ArgList.size(); i != e; ++i) ArgListTy.push_back(ArgList[i].Type); - Result = HandleUpRefs(FunctionType::get(Result.get(), ArgListTy, isVarArg)); + Result = HandleUpRefs(Context.getFunctionType(Result.get(), + ArgListTy, isVarArg)); return false; } @@ -1273,7 +1275,7 @@ Lex.Lex(); // Consume the '{' if (EatIfPresent(lltok::rbrace)) { - Result = StructType::get(Packed); + Result = Context.getStructType(Packed); return false; } @@ -1305,7 +1307,7 @@ std::vector ParamsListTy; for (unsigned i = 0, e = ParamsList.size(); i != e; ++i) ParamsListTy.push_back(ParamsList[i].get()); - Result = HandleUpRefs(StructType::get(ParamsListTy, Packed)); + Result = HandleUpRefs(Context.getStructType(ParamsListTy, Packed)); return false; } @@ -1344,11 +1346,11 @@ return Error(SizeLoc, "size too large for vector"); if (!VectorType::isValidElementType(EltTy)) return Error(TypeLoc, "vector element type must be fp or integer"); - Result = VectorType::get(EltTy, unsigned(Size)); + Result = Context.getVectorType(EltTy, unsigned(Size)); } else { if (!ArrayType::isValidElementType(EltTy)) return Error(TypeLoc, "invalid array element type"); - Result = HandleUpRefs(ArrayType::get(EltTy, Size)); + Result = HandleUpRefs(Context.getArrayType(EltTy, Size)); } return false; } @@ -1653,11 +1655,11 @@ ID.Kind = ValID::t_APFloat; break; case lltok::kw_true: - ID.ConstantVal = ConstantInt::getTrue(); + ID.ConstantVal = Context.getConstantIntTrue(); ID.Kind = ValID::t_Constant; break; case lltok::kw_false: - ID.ConstantVal = ConstantInt::getFalse(); + ID.ConstantVal = Context.getConstantIntFalse(); ID.Kind = ValID::t_Constant; break; case lltok::kw_null: ID.Kind = ValID::t_Null; break; @@ -1672,7 +1674,7 @@ ParseToken(lltok::rbrace, "expected end of struct constant")) return true; - ID.ConstantVal = ConstantStruct::get(Elts.data(), Elts.size(), false); + ID.ConstantVal = Context.getConstantStruct(Elts.data(), Elts.size(), false); ID.Kind = ValID::t_Constant; return false; } @@ -1691,7 +1693,8 @@ return true; if (isPackedStruct) { - ID.ConstantVal = ConstantStruct::get(Elts.data(), Elts.size(), true); + ID.ConstantVal = + Context.getConstantStruct(Elts.data(), Elts.size(), true); ID.Kind = ValID::t_Constant; return false; } @@ -1711,7 +1714,7 @@ "vector element #" + utostr(i) + " is not of type '" + Elts[0]->getType()->getDescription()); - ID.ConstantVal = ConstantVector::get(Elts.data(), Elts.size()); + ID.ConstantVal = Context.getConstantVector(Elts.data(), Elts.size()); ID.Kind = ValID::t_Constant; return false; } @@ -1735,7 +1738,7 @@ return Error(FirstEltLoc, "invalid array element type: " + Elts[0]->getType()->getDescription()); - ArrayType *ATy = ArrayType::get(Elts[0]->getType(), Elts.size()); + ArrayType *ATy = Context.getArrayType(Elts[0]->getType(), Elts.size()); // Verify all elements are correct type! for (unsigned i = 0, e = Elts.size(); i != e; ++i) { @@ -1745,13 +1748,13 @@ " is not of type '" +Elts[0]->getType()->getDescription()); } - ID.ConstantVal = ConstantArray::get(ATy, Elts.data(), Elts.size()); + ID.ConstantVal = Context.getConstantArray(ATy, Elts.data(), Elts.size()); ID.Kind = ValID::t_Constant; return false; } case lltok::kw_c: // c "foo" Lex.Lex(); - ID.ConstantVal = ConstantArray::get(Lex.getStrVal(), false); + ID.ConstantVal = Context.getConstantArray(Lex.getStrVal(), false); if (ParseToken(lltok::StringConstant, "expected string")) return true; ID.Kind = ValID::t_Constant; return false; @@ -1797,8 +1800,8 @@ return Error(ID.Loc, "invalid cast opcode for cast from '" + SrcVal->getType()->getDescription() + "' to '" + DestTy->getDescription() + "'"); - ID.ConstantVal = ConstantExpr::getCast((Instruction::CastOps)Opc, SrcVal, - DestTy); + ID.ConstantVal = Context.getConstantExprCast((Instruction::CastOps)Opc, + SrcVal, DestTy); ID.Kind = ValID::t_Constant; return false; } @@ -1817,7 +1820,7 @@ Indices.end())) return Error(ID.Loc, "invalid indices for extractvalue"); ID.ConstantVal = - ConstantExpr::getExtractValue(Val, Indices.data(), Indices.size()); + Context.getConstantExprExtractValue(Val, Indices.data(), Indices.size()); ID.Kind = ValID::t_Constant; return false; } @@ -1837,8 +1840,8 @@ if (!ExtractValueInst::getIndexedType(Val0->getType(), Indices.begin(), Indices.end())) return Error(ID.Loc, "invalid indices for insertvalue"); - ID.ConstantVal = - ConstantExpr::getInsertValue(Val0, Val1, Indices.data(), Indices.size()); + ID.ConstantVal = Context.getConstantExprInsertValue(Val0, Val1, + Indices.data(), Indices.size()); ID.Kind = ValID::t_Constant; return false; } @@ -1865,24 +1868,24 @@ if (Opc == Instruction::FCmp) { if (!Val0->getType()->isFPOrFPVector()) return Error(ID.Loc, "fcmp requires floating point operands"); - ID.ConstantVal = ConstantExpr::getFCmp(Pred, Val0, Val1); + ID.ConstantVal = Context.getConstantExprFCmp(Pred, Val0, Val1); } else if (Opc == Instruction::ICmp) { if (!Val0->getType()->isIntOrIntVector() && !isa(Val0->getType())) return Error(ID.Loc, "icmp requires pointer or integer operands"); - ID.ConstantVal = ConstantExpr::getICmp(Pred, Val0, Val1); + ID.ConstantVal = Context.getConstantExprICmp(Pred, Val0, Val1); } else if (Opc == Instruction::VFCmp) { // FIXME: REMOVE VFCMP Support if (!Val0->getType()->isFPOrFPVector() || !isa(Val0->getType())) return Error(ID.Loc, "vfcmp requires vector floating point operands"); - ID.ConstantVal = ConstantExpr::getVFCmp(Pred, Val0, Val1); + ID.ConstantVal = Context.getConstantExprVFCmp(Pred, Val0, Val1); } else if (Opc == Instruction::VICmp) { // FIXME: REMOVE VICMP Support if (!Val0->getType()->isIntOrIntVector() || !isa(Val0->getType())) return Error(ID.Loc, "vicmp requires vector floating point operands"); - ID.ConstantVal = ConstantExpr::getVICmp(Pred, Val0, Val1); + ID.ConstantVal = Context.getConstantExprVICmp(Pred, Val0, Val1); } ID.Kind = ValID::t_Constant; return false; @@ -1915,7 +1918,7 @@ if (!Val0->getType()->isIntOrIntVector() && !Val0->getType()->isFPOrFPVector()) return Error(ID.Loc,"constexpr requires integer, fp, or vector operands"); - ID.ConstantVal = ConstantExpr::get(Opc, Val0, Val1); + ID.ConstantVal = Context.getConstantExpr(Opc, Val0, Val1); ID.Kind = ValID::t_Constant; return false; } @@ -1941,7 +1944,7 @@ if (!Val0->getType()->isIntOrIntVector()) return Error(ID.Loc, "constexpr requires integer or integer vector operands"); - ID.ConstantVal = ConstantExpr::get(Opc, Val0, Val1); + ID.ConstantVal = Context.getConstantExpr(Opc, Val0, Val1); ID.Kind = ValID::t_Constant; return false; } @@ -1966,7 +1969,7 @@ if (!GetElementPtrInst::getIndexedType(Elts[0]->getType(), (Value**)&Elts[1], Elts.size()-1)) return Error(ID.Loc, "invalid indices for getelementptr"); - ID.ConstantVal = ConstantExpr::getGetElementPtr(Elts[0], + ID.ConstantVal = Context.getConstantExprGetElementPtr(Elts[0], &Elts[1], Elts.size()-1); } else if (Opc == Instruction::Select) { if (Elts.size() != 3) @@ -1974,26 +1977,28 @@ if (const char *Reason = SelectInst::areInvalidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, Reason); - ID.ConstantVal = ConstantExpr::getSelect(Elts[0], Elts[1], Elts[2]); + ID.ConstantVal = Context.getConstantExprSelect(Elts[0], Elts[1], Elts[2]); } else if (Opc == Instruction::ShuffleVector) { if (Elts.size() != 3) return Error(ID.Loc, "expected three operands to shufflevector"); if (!ShuffleVectorInst::isValidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, "invalid operands to shufflevector"); - ID.ConstantVal = ConstantExpr::getShuffleVector(Elts[0], Elts[1],Elts[2]); + ID.ConstantVal = + Context.getConstantExprShuffleVector(Elts[0], Elts[1],Elts[2]); } else if (Opc == Instruction::ExtractElement) { if (Elts.size() != 2) return Error(ID.Loc, "expected two operands to extractelement"); if (!ExtractElementInst::isValidOperands(Elts[0], Elts[1])) return Error(ID.Loc, "invalid extractelement operands"); - ID.ConstantVal = ConstantExpr::getExtractElement(Elts[0], Elts[1]); + ID.ConstantVal = Context.getConstantExprExtractElement(Elts[0], Elts[1]); } else { assert(Opc == Instruction::InsertElement && "Unknown opcode"); if (Elts.size() != 3) return Error(ID.Loc, "expected three operands to insertelement"); if (!InsertElementInst::isValidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, "invalid insertelement operands"); - ID.ConstantVal = ConstantExpr::getInsertElement(Elts[0], Elts[1],Elts[2]); + ID.ConstantVal = + Context.getConstantExprInsertElement(Elts[0], Elts[1],Elts[2]); } ID.Kind = ValID::t_Constant; @@ -2037,7 +2042,7 @@ if (!isa(Ty)) return Error(ID.Loc, "integer constant must have integer type"); ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits()); - V = ConstantInt::get(ID.APSIntVal); + V = Context.getConstantInt(ID.APSIntVal); return false; case ValID::t_APFloat: if (!Ty->isFloatingPoint() || @@ -2052,7 +2057,7 @@ ID.APFloatVal.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &Ignored); } - V = ConstantFP::get(ID.APFloatVal); + V = Context.getConstantFP(ID.APFloatVal); if (V->getType() != Ty) return Error(ID.Loc, "floating point constant does not have type '" + @@ -2062,7 +2067,7 @@ case ValID::t_Null: if (!isa(Ty)) return Error(ID.Loc, "null must be a pointer type"); - V = ConstantPointerNull::get(cast(Ty)); + V = Context.getConstantPointerNull(cast(Ty)); return false; case ValID::t_Undef: // FIXME: LabelTy should not be a first-class type. @@ -2080,7 +2085,7 @@ // FIXME: LabelTy should not be a first-class type. if (!Ty->isFirstClassType() || Ty == Type::LabelTy) return Error(ID.Loc, "invalid type for null constant"); - V = Constant::getNullValue(Ty); + V = Context.getNullValue(Ty); return false; case ValID::t_Constant: if (ID.ConstantVal->getType() != Ty) @@ -2282,8 +2287,9 @@ RetType != Type::VoidTy) return Error(RetTypeLoc, "functions with 'sret' argument must return void"); - const FunctionType *FT = FunctionType::get(RetType, ParamTypeList, isVarArg); - const PointerType *PFT = PointerType::getUnqual(FT); + const FunctionType *FT = + Context.getFunctionType(RetType, ParamTypeList, isVarArg); + const PointerType *PFT = Context.getPointerTypeUnqual(FT); Fn = 0; if (!FunctionName.empty()) { @@ -2736,8 +2742,8 @@ if (!FunctionType::isValidReturnType(RetType)) return Error(RetTypeLoc, "Invalid result type for LLVM function"); - Ty = FunctionType::get(RetType, ParamTypes, false); - PFTy = PointerType::getUnqual(Ty); + Ty = Context.getFunctionType(RetType, ParamTypes, false); + PFTy = Context.getPointerTypeUnqual(Ty); } // Look up the callee. @@ -3085,8 +3091,8 @@ if (!FunctionType::isValidReturnType(RetType)) return Error(RetTypeLoc, "Invalid result type for LLVM function"); - Ty = FunctionType::get(RetType, ParamTypes, false); - PFTy = PointerType::getUnqual(Ty); + Ty = Context.getFunctionType(RetType, ParamTypes, false); + PFTy = Context.getPointerTypeUnqual(Ty); } // Look up the callee. Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=74671&r1=74670&r2=74671&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Wed Jul 1 18:57:11 2009 @@ -15,6 +15,7 @@ #define LLVM_ASMPARSER_LLPARSER_H #include "LLLexer.h" +#include "llvm/Module.h" #include "llvm/Type.h" #include @@ -35,7 +36,7 @@ public: typedef LLLexer::LocTy LocTy; private: - + LLVMContext& Context; LLLexer Lex; Module *M; @@ -72,7 +73,8 @@ std::map > ForwardRefValIDs; std::vector NumberedVals; public: - LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : Lex(F, Err), M(m) {} + LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : + Context(m->getContext()), Lex(F, Err), M(m) {} bool Run(); private: From dpatel at apple.com Wed Jul 1 19:08:10 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 02 Jul 2009 00:08:10 -0000 Subject: [llvm-commits] [llvm] r74673 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200907020008.n6208AVc030466@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 19:08:09 2009 New Revision: 74673 URL: http://llvm.org/viewvc/llvm-project?rev=74673&view=rev Log: Simplify. No intentional functionality change. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=74673&r1=74672&r2=74673&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Jul 1 19:08:09 2009 @@ -3960,62 +3960,49 @@ unsigned Line = Subprogram.getLineNumber(); MachineFunction &MF = DAG.getMachineFunction(); - if (OptLevel == CodeGenOpt::None) { - // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is what - // (most?) gdb expects. - DebugLoc PrevLoc = CurDebugLoc; + // If this subprogram does not describe current function then this is + // beginning of a inlined function. - if (!Subprogram.describes(MF.getFunction())) { - // This is a beginning of an inlined function. + bool isInlinedFnStart = !Subprogram.describes(MF.getFunction()); + if (isInlinedFnStart && OptLevel != CodeGenOpt::None) + // FIXME: Debugging informaation for inlined function is only + // supported at CodeGenOpt::Node. + return 0; - // If llvm.dbg.func.start is seen in a new block before any - // llvm.dbg.stoppoint intrinsic then the location info is unknown. - // FIXME : Why DebugLoc is reset at the beginning of each block ? - if (PrevLoc.isUnknown()) - return 0; - - // Record the source line. - setCurDebugLoc(DebugLoc::get( - MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0))); - - if (DW && DW->ShouldEmitDwarfDebug()) { - DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); - unsigned LabelID = DW->RecordInlinedFnStart(Subprogram, - DICompileUnit(PrevLocTpl.CompileUnit), - PrevLocTpl.Line, - PrevLocTpl.Col); + if (isInlinedFnStart && OptLevel == CodeGenOpt::None) { + // This is a beginning of an inlined function. + DebugLoc PrevLoc = CurDebugLoc; + // If llvm.dbg.func.start is seen in a new block before any + // llvm.dbg.stoppoint intrinsic then the location info is unknown. + // FIXME : Why DebugLoc is reset at the beginning of each block ? + if (PrevLoc.isUnknown()) + return 0; + + // Record the source line. + unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0); + setCurDebugLoc(DebugLoc::get(LocID)); + + if (DW && DW->ShouldEmitDwarfDebug()) { + DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); + unsigned LabelID = DW->RecordInlinedFnStart(Subprogram, + DICompileUnit(PrevLocTpl.CompileUnit), + PrevLocTpl.Line, + PrevLocTpl.Col); DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); - } - } else { - // Record the source line. - unsigned Line = Subprogram.getLineNumber(); - MF.setDefaultDebugLoc(DebugLoc::get( - MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0))); - if (DW && DW->ShouldEmitDwarfDebug()) { - // llvm.dbg.func_start also defines beginning of function scope. - DW->RecordRegionStart(cast(FSI.getSubprogram())); - } - } - } else { - std::string SPName; - Subprogram.getLinkageName(SPName); - if (!SPName.empty() - && strcmp(SPName.c_str(), MF.getFunction()->getNameStart())) { - // This is beginning of inlined function. Debugging information for - // inlined function is not handled yet (only supported by FastISel). - return 0; } - - // Record the source line but does not create a label for the normal - // function start. It will be emitted at asm emission time. However, - // create a label if this is a beginning of inlined function. - setCurDebugLoc(DebugLoc::get( - MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0))); - // FIXME - Start new region because llvm.dbg.func_start also defines - // beginning of function scope. + return 0; } + // This is a beginning of a new function. + // Record the source line. + unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0); + MF.setDefaultDebugLoc(DebugLoc::get(LocID)); + + if (DW && DW->ShouldEmitDwarfDebug()) + // llvm.dbg.func_start also defines beginning of function scope. + DW->RecordRegionStart(cast(FSI.getSubprogram())); + return 0; } case Intrinsic::dbg_declare: { From ojomojo at gmail.com Wed Jul 1 19:10:23 2009 From: ojomojo at gmail.com (John Mosby) Date: Thu, 02 Jul 2009 00:10:23 -0000 Subject: [llvm-commits] [llvm] r74674 - /llvm/trunk/tools/lto/Makefile Message-ID: <200907020010.n620ANVV030545@zion.cs.uiuc.edu> Author: jdm Date: Wed Jul 1 19:10:23 2009 New Revision: 74674 URL: http://llvm.org/viewvc/llvm-project?rev=74674&view=rev Log: fix ld error with -no-undefined switch, which is undefined on darwin8 Modified: llvm/trunk/tools/lto/Makefile Modified: llvm/trunk/tools/lto/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/Makefile?rev=74674&r1=74673&r2=74674&view=diff ============================================================================== --- llvm/trunk/tools/lto/Makefile (original) +++ llvm/trunk/tools/lto/Makefile Wed Jul 1 19:10:23 2009 @@ -31,7 +31,7 @@ endif # extra options to override libtool defaults LLVMLibsOptions := $(LLVMLibsOptions) \ - -no-undefined -avoid-version \ + -avoid-version \ -Wl,-exported_symbols_list -Wl,$(PROJ_SRC_DIR)/lto.exports \ -Wl,-dead_strip \ -Wl,-seg1addr -Wl,0xE0000000 @@ -40,7 +40,7 @@ DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/') ifneq ($(DARWIN_VERS),8) LLVMLibsOptions := $(LLVMLibsOptions) \ - -Wl,-install_name \ + -no-undefined -Wl,-install_name \ -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)" endif endif From resistor at mac.com Wed Jul 1 19:16:39 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 00:16:39 -0000 Subject: [llvm-commits] [llvm] r74675 - in /llvm/trunk: include/llvm-c/Core.h lib/VMCore/Core.cpp Message-ID: <200907020016.n620GdHt030735@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 19:16:38 2009 New Revision: 74675 URL: http://llvm.org/viewvc/llvm-project?rev=74675&view=rev Log: Add a C wrapper for accessing the global default context. Modified: llvm/trunk/include/llvm-c/Core.h llvm/trunk/lib/VMCore/Core.cpp Modified: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=74675&r1=74674&r2=74675&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (original) +++ llvm/trunk/include/llvm-c/Core.h Wed Jul 1 19:16:38 2009 @@ -195,6 +195,7 @@ /* Create and destroy contexts. */ LLVMContextRef LLVMContextCreate(); +LLVMContextRef LLVMGetGlobalContext(); void LLVMContextDispose(LLVMContextRef C); /* Create and destroy modules. */ Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=74675&r1=74674&r2=74675&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Wed Jul 1 19:16:38 2009 @@ -45,6 +45,10 @@ return wrap(new LLVMContext()); } +LLVMContextRef LLVMGetGlobalContext() { + return wrap(&getGlobalContext()); +} + void LLVMContextDispose(LLVMContextRef C) { delete unwrap(C); } From gohman at apple.com Wed Jul 1 19:17:48 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 02 Jul 2009 00:17:48 -0000 Subject: [llvm-commits] [llvm] r74676 - in /llvm/trunk: include/llvm/Analysis/Dominators.h lib/Target/X86/X86FastISel.cpp lib/Transforms/Scalar/JumpThreading.cpp lib/Transforms/Scalar/TailDuplication.cpp tools/llvm-prof/llvm-prof.cpp Message-ID: <200907020017.n620HmL1030779@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 1 19:17:47 2009 New Revision: 74676 URL: http://llvm.org/viewvc/llvm-project?rev=74676&view=rev Log: Fix a bunch of other places that used operator[] to test whether a key is present in a std::map or DenseMap to use find instead. Modified: llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp llvm/trunk/tools/llvm-prof/llvm-prof.cpp Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=74676&r1=74675&r2=74676&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Wed Jul 1 19:17:47 2009 @@ -618,8 +618,9 @@ } DomTreeNodeBase *getNodeForBlock(NodeT *BB) { - if (DomTreeNodeBase *BBNode = this->DomTreeNodes[BB]) - return BBNode; + typename DomTreeNodeMapType::iterator I = this->DomTreeNodes.find(BB); + if (I != this->DomTreeNodes.end() && I->second) + return I->second; // Haven't calculated this node yet? Get or calculate the node for the // immediate dominator. Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=74676&r1=74675&r2=74676&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Wed Jul 1 19:17:47 2009 @@ -452,8 +452,9 @@ if (Subtarget->GVRequiresExtraLoad(GV, TM, isCall)) { // Check to see if we've already materialized this // value in a register in this block. - if (unsigned Reg = LocalValueMap[V]) { - AM.Base.Reg = Reg; + DenseMap::iterator I = LocalValueMap.find(V); + if (I != LocalValueMap.end() && I->second != 0) { + AM.Base.Reg = I->second; AM.GV = 0; return true; } Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=74676&r1=74675&r2=74676&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Wed Jul 1 19:17:47 2009 @@ -935,9 +935,11 @@ // Remap operands to patch up intra-block references. for (unsigned i = 0, e = New->getNumOperands(); i != e; ++i) - if (Instruction *Inst = dyn_cast(New->getOperand(i))) - if (Value *Remapped = ValueMapping[Inst]) - New->setOperand(i, Remapped); + if (Instruction *Inst = dyn_cast(New->getOperand(i))) { + DenseMap::iterator I = ValueMapping.find(Inst); + if (I != ValueMapping.end()) + New->setOperand(i, I->second); + } } // We didn't copy the terminator from BB over to NewBB, because there is now @@ -953,9 +955,11 @@ Value *IV = PN->getIncomingValueForBlock(BB); // Remap the value if necessary. - if (Instruction *Inst = dyn_cast(IV)) - if (Value *MappedIV = ValueMapping[Inst]) - IV = MappedIV; + if (Instruction *Inst = dyn_cast(IV)) { + DenseMap::iterator I = ValueMapping.find(Inst); + if (I != ValueMapping.end()) + IV = I->second; + } PN->addIncoming(IV, NewBB); } Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=74676&r1=74675&r2=74676&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Wed Jul 1 19:17:47 2009 @@ -317,9 +317,12 @@ // BI = Branch; ++BI; // Get an iterator to the first new instruction for (; BI != SourceBlock->end(); ++BI) - for (unsigned i = 0, e = BI->getNumOperands(); i != e; ++i) - if (Value *Remapped = ValueMapping[BI->getOperand(i)]) - BI->setOperand(i, Remapped); + for (unsigned i = 0, e = BI->getNumOperands(); i != e; ++i) { + std::map::const_iterator I = + ValueMapping.find(BI->getOperand(i)); + if (I != ValueMapping.end()) + BI->setOperand(i, I->second); + } // Next we check to see if any of the successors of DestBlock had PHI nodes. // If so, we need to add entries to the PHI nodes for SourceBlock now. @@ -333,8 +336,9 @@ Value *IV = PN->getIncomingValueForBlock(DestBlock); // Remap the value if necessary... - if (Value *MappedIV = ValueMapping[IV]) - IV = MappedIV; + std::map::const_iterator I = ValueMapping.find(IV); + if (I != ValueMapping.end()) + IV = I->second; PN->addIncoming(IV, SourceBlock); } } Modified: llvm/trunk/tools/llvm-prof/llvm-prof.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-prof/llvm-prof.cpp?rev=74676&r1=74675&r2=74676&view=diff ============================================================================== --- llvm/trunk/tools/llvm-prof/llvm-prof.cpp (original) +++ llvm/trunk/tools/llvm-prof/llvm-prof.cpp Wed Jul 1 19:17:47 2009 @@ -81,8 +81,10 @@ virtual void emitBasicBlockStartAnnot(const BasicBlock *BB, raw_ostream &OS) { if (BlockFreqs.empty()) return; - if (unsigned Count = BlockFreqs[BB]) - OS << "\t;;; Basic block executed " << Count << " times.\n"; + std::map::const_iterator I = + BlockFreqs.find(BB); + if (I != BlockFreqs.end()) + OS << "\t;;; Basic block executed " << I->second << " times.\n"; else OS << "\t;;; Never executed!\n"; } From dpatel at apple.com Wed Jul 1 19:28:04 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 02 Jul 2009 00:28:04 -0000 Subject: [llvm-commits] [llvm] r74677 - in /llvm/trunk/lib/CodeGen/SelectionDAG: FastISel.cpp SelectionDAGBuild.cpp Message-ID: <200907020028.n620S4uA031047@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 19:28:03 2009 New Revision: 74677 URL: http://llvm.org/viewvc/llvm-project?rev=74677&view=rev Log: Simplify. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=74677&r1=74676&r2=74677&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Wed Jul 1 19:28:03 2009 @@ -376,24 +376,24 @@ if (!DIDescriptor::ValidDebugInfo(SP, CodeGenOpt::None)) return true; - // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is what - // (most?) gdb expects. - DebugLoc PrevLoc = DL; DISubprogram Subprogram(cast(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); + unsigned Line = Subprogram.getLineNumber(); + // If this subprogram does not describe current function then this is + // beginning of a inlined function. if (!Subprogram.describes(MF.getFunction())) { // This is a beginning of an inlined function. // If llvm.dbg.func.start is seen in a new block before any // llvm.dbg.stoppoint intrinsic then the location info is unknown. // FIXME : Why DebugLoc is reset at the beginning of each block ? + DebugLoc PrevLoc = DL; if (PrevLoc.isUnknown()) return true; // Record the source line. - unsigned Line = Subprogram.getLineNumber(); - setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID( - CompileUnit.getGV(), Line, 0))); + unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0); + setCurDebugLoc(DebugLoc::get(LocID)); if (DW && DW->ShouldEmitDwarfDebug()) { DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); @@ -404,17 +404,18 @@ const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); BuildMI(MBB, DL, II).addImm(LabelID); } - } else { - // Record the source line. - unsigned Line = Subprogram.getLineNumber(); - MF.setDefaultDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID( - CompileUnit.getGV(), Line, 0))); - if (DW && DW->ShouldEmitDwarfDebug()) { - // llvm.dbg.func_start also defines beginning of function scope. - DW->RecordRegionStart(cast(FSI->getSubprogram())); - } + return true; } - + + // This is a beginning of a new function. + // Record the source line. + unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0); + MF.setDefaultDebugLoc(DebugLoc::get(LocID)); + + if (DW && DW->ShouldEmitDwarfDebug()) + // llvm.dbg.func_start also defines beginning of function scope. + DW->RecordRegionStart(cast(FSI->getSubprogram())); + return true; } case Intrinsic::dbg_declare: { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=74677&r1=74676&r2=74677&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Jul 1 19:28:03 2009 @@ -3962,7 +3962,6 @@ MachineFunction &MF = DAG.getMachineFunction(); // If this subprogram does not describe current function then this is // beginning of a inlined function. - bool isInlinedFnStart = !Subprogram.describes(MF.getFunction()); if (isInlinedFnStart && OptLevel != CodeGenOpt::None) // FIXME: Debugging informaation for inlined function is only From resistor at mac.com Wed Jul 1 19:31:14 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 00:31:14 -0000 Subject: [llvm-commits] [llvm] r74678 - in /llvm/trunk: include/llvm-c/lto.h tools/lto/LTOCodeGenerator.cpp tools/lto/LTOCodeGenerator.h tools/lto/LTOModule.cpp tools/lto/LTOModule.h tools/lto/lto.cpp Message-ID: <200907020031.n620VFX8031151@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 1 19:31:14 2009 New Revision: 74678 URL: http://llvm.org/viewvc/llvm-project?rev=74678&view=rev Log: Maintain the old LTO API, by using the global context. Modified: llvm/trunk/include/llvm-c/lto.h llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/lto/LTOCodeGenerator.h llvm/trunk/tools/lto/LTOModule.cpp llvm/trunk/tools/lto/LTOModule.h llvm/trunk/tools/lto/lto.cpp Modified: llvm/trunk/include/llvm-c/lto.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=74678&r1=74677&r2=74678&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/lto.h (original) +++ llvm/trunk/include/llvm-c/lto.h Wed Jul 1 19:31:14 2009 @@ -59,8 +59,6 @@ /** opaque reference to a code generator */ typedef struct LTOCodeGenerator* lto_code_gen_t; -typedef struct LTOContext* lto_context_t; - #ifdef __cplusplus extern "C" { #endif @@ -113,7 +111,7 @@ * Returns NULL on error (check lto_get_error_message() for details). */ extern lto_module_t -lto_module_create(const char* path, LLVMContextRef Ctxt); +lto_module_create(const char* path); /** @@ -121,8 +119,7 @@ * Returns NULL on error (check lto_get_error_message() for details). */ extern lto_module_t -lto_module_create_from_memory(const void* mem, size_t length, - LLVMContextRef Ctxt); +lto_module_create_from_memory(const void* mem, size_t length); /** @@ -166,7 +163,7 @@ * Returns NULL on error (check lto_get_error_message() for details). */ extern lto_code_gen_t -lto_codegen_create(LLVMContextRef Ctxt); +lto_codegen_create(void); /** Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=74678&r1=74677&r2=74678&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Wed Jul 1 19:31:14 2009 @@ -19,6 +19,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Linker.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" @@ -69,8 +70,8 @@ } -LTOCodeGenerator::LTOCodeGenerator(LLVMContext& Context) - : _context(Context), +LTOCodeGenerator::LTOCodeGenerator() + : _context(getGlobalContext()), _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL), _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false), _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC), Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=74678&r1=74677&r2=74678&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Wed Jul 1 19:31:14 2009 @@ -31,7 +31,7 @@ public: static const char* getVersionString(); - LTOCodeGenerator(llvm::LLVMContext& Context); + LTOCodeGenerator(); ~LTOCodeGenerator(); bool addModule(class LTOModule*, std::string& errMsg); Modified: llvm/trunk/tools/lto/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=74678&r1=74677&r2=74678&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Wed Jul 1 19:31:14 2009 @@ -69,7 +69,7 @@ bool LTOModule::isTargetMatch(MemoryBuffer* buffer, const char* triplePrefix) { OwningPtr mp(getBitcodeModuleProvider(buffer, - *new LLVMContext())); + getGlobalContext())); // on success, mp owns buffer and both are deleted at end of this method if ( !mp ) { delete buffer; @@ -87,13 +87,12 @@ } LTOModule* LTOModule::makeLTOModule(const char* path, - LLVMContext& Context, std::string& errMsg) { OwningPtr buffer(MemoryBuffer::getFile(path, &errMsg)); if ( !buffer ) return NULL; - return makeLTOModule(buffer.get(), Context, errMsg); + return makeLTOModule(buffer.get(), errMsg); } /// makeBuffer - create a MemoryBuffer from a memory range. @@ -113,13 +112,12 @@ LTOModule* LTOModule::makeLTOModule(const void* mem, size_t length, - LLVMContext& Context, std::string& errMsg) { OwningPtr buffer(makeBuffer(mem, length)); if ( !buffer ) return NULL; - return makeLTOModule(buffer.get(), Context, errMsg); + return makeLTOModule(buffer.get(), errMsg); } /// getFeatureString - Return a string listing the features associated with the @@ -142,11 +140,10 @@ } LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer, - LLVMContext& Context, std::string& errMsg) { // parse bitcode buffer - OwningPtr m(ParseBitcodeFile(buffer, Context, &errMsg)); + OwningPtr m(ParseBitcodeFile(buffer, getGlobalContext(), &errMsg)); if ( !m ) return NULL; // find machine architecture for this module Modified: llvm/trunk/tools/lto/LTOModule.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.h?rev=74678&r1=74677&r2=74678&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.h (original) +++ llvm/trunk/tools/lto/LTOModule.h Wed Jul 1 19:31:14 2009 @@ -32,7 +32,6 @@ class GlobalValue; class Value; class Function; - class LLVMContext; } @@ -52,10 +51,8 @@ const char* triplePrefix); static LTOModule* makeLTOModule(const char* path, - llvm::LLVMContext& Context, std::string& errMsg); static LTOModule* makeLTOModule(const void* mem, size_t length, - llvm::LLVMContext& Context, std::string& errMsg); const char* getTargetTriple(); @@ -91,7 +88,6 @@ const char* triplePrefix); static LTOModule* makeLTOModule(llvm::MemoryBuffer* buffer, - llvm::LLVMContext& Context, std::string& errMsg); static llvm::MemoryBuffer* makeBuffer(const void* mem, size_t length); Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=74678&r1=74677&r2=74678&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Wed Jul 1 19:31:14 2009 @@ -86,10 +86,9 @@ // loads an object file from disk // returns NULL on error (check lto_get_error_message() for details) // -lto_module_t lto_module_create(const char* path, LLVMContextRef Ctxt) +lto_module_t lto_module_create(const char* path) { - return LTOModule::makeLTOModule(path, *llvm::unwrap(Ctxt), - sLastErrorString); + return LTOModule::makeLTOModule(path, sLastErrorString); } @@ -97,11 +96,9 @@ // loads an object file from memory // returns NULL on error (check lto_get_error_message() for details) // -lto_module_t lto_module_create_from_memory(const void* mem, size_t length, - LLVMContextRef Ctxt) +lto_module_t lto_module_create_from_memory(const void* mem, size_t length) { - return LTOModule::makeLTOModule(mem, length, *llvm::unwrap(Ctxt), - sLastErrorString); + return LTOModule::makeLTOModule(mem, length, sLastErrorString); } @@ -158,9 +155,9 @@ // instantiates a code generator // returns NULL if there is an error // -lto_code_gen_t lto_codegen_create(LLVMContextRef ContextRef) +lto_code_gen_t lto_codegen_create(void) { - return new LTOCodeGenerator(*llvm::unwrap(ContextRef)); + return new LTOCodeGenerator(); } From daniel at zuster.org Wed Jul 1 19:51:52 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 02 Jul 2009 00:51:52 -0000 Subject: [llvm-commits] [llvm] r74679 - /llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Message-ID: <200907020051.n620pqwG031665@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 19:51:52 2009 New Revision: 74679 URL: http://llvm.org/viewvc/llvm-project?rev=74679&view=rev Log: llvm-mc/x86: Rename X86Operand::ScaleReg to IndexReg and make order consistent with syntax. Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=74679&r1=74678&r2=74679&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Wed Jul 1 19:51:52 2009 @@ -37,8 +37,8 @@ unsigned SegReg; MCValue Disp; unsigned BaseReg; + unsigned IndexReg; unsigned Scale; - unsigned ScaleReg; } Mem; }; @@ -55,14 +55,14 @@ return Res; } static X86Operand CreateMem(unsigned SegReg, MCValue Disp, unsigned BaseReg, - unsigned Scale, unsigned ScaleReg) { + unsigned IndexReg, unsigned Scale) { X86Operand Res; Res.Kind = Memory; Res.Mem.SegReg = SegReg; Res.Mem.Disp = Disp; Res.Mem.BaseReg = BaseReg; + Res.Mem.IndexReg = IndexReg; Res.Mem.Scale = Scale; - Res.Mem.ScaleReg = ScaleReg; return Res; } }; @@ -152,7 +152,7 @@ // If we reached here, then we just ate the ( of the memory operand. Process // the rest of the memory operand. - unsigned BaseReg = 0, ScaleReg = 0, Scale = 0; + unsigned BaseReg = 0, IndexReg = 0, Scale = 0; if (Lexer.is(asmtok::Register)) { BaseReg = 123; // FIXME: decode reg # @@ -163,7 +163,7 @@ Lexer.Lex(); // eat the comma. if (Lexer.is(asmtok::Register)) { - ScaleReg = 123; // FIXME: decode reg # + IndexReg = 123; // FIXME: decode reg # Lexer.Lex(); // eat the register. Scale = 1; // If not specified, the scale defaults to 1. } @@ -187,7 +187,7 @@ return TokError("unexpected token in memory operand"); Lexer.Lex(); // Eat the ')'. - Op = X86Operand::CreateMem(SegReg, Disp, BaseReg, Scale, ScaleReg); + Op = X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale); return false; } From nlewycky at google.com Wed Jul 1 19:54:43 2009 From: nlewycky at google.com (Nick Lewycky) Date: Wed, 1 Jul 2009 17:54:43 -0700 Subject: [llvm-commits] fix build of llvm-poolalloc Message-ID: The attached patch fixes the build of llvm-poolalloc after the recent LLVMContext changes. Please apply! Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/5d4e2ebd/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: poolalloc-llvmcontext.patch Type: text/x-patch Size: 595 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090701/5d4e2ebd/attachment.bin From dpatel at apple.com Wed Jul 1 20:15:24 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 02 Jul 2009 01:15:24 -0000 Subject: [llvm-commits] [llvm] r74680 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp Message-ID: <200907020115.n621FPlE032298@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 1 20:15:24 2009 New Revision: 74680 URL: http://llvm.org/viewvc/llvm-project?rev=74680&view=rev Log: Add debug info utility routines. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=74680&r1=74679&r2=74680&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Wed Jul 1 20:15:24 2009 @@ -33,6 +33,11 @@ class Value; struct DbgStopPointInst; struct DbgDeclareInst; + struct DbgFuncStartInst; + struct DbgRegionStartInst; + struct DbgRegionEndInst; + class DebugLoc; + class DebugLocTracker; class Instruction; class DIDescriptor { @@ -548,6 +553,49 @@ SmallVector &GlobalVars, SmallVector &Subprograms); + /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI, + CodeGenOpt::Level OptLev); + + /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI, + CodeGenOpt::Level OptLev); + + /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI, + CodeGenOpt::Level OptLev); + + /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI, + CodeGenOpt::Level OptLev); + + /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI, + CodeGenOpt::Level OptLev); + + /// ExtractDebugLocation - Extract debug location information + /// from llvm.dbg.stoppoint intrinsic. + DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI, + CodeGenOpt::Level OptLev, + DebugLocTracker &DebugLocInfo); + + /// ExtractDebugLocation - Extract debug location information + /// from llvm.dbg.func_start intrinsic. + DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, + CodeGenOpt::Level OptLev, + DebugLocTracker &DebugLocInfo); + + /// isInlinedFnStart - Return true if FSI is starting an inlined function. + bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn); + + /// isInlinedFnEnd - Return true if REI is ending an inlined function. + bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn); + } // end namespace llvm #endif Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=74680&r1=74679&r2=74680&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Jul 1 20:15:24 2009 @@ -21,6 +21,7 @@ #include "llvm/Module.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/Support/Dwarf.h" +#include "llvm/Support/DebugLoc.h" #include "llvm/Support/Streams.h" using namespace llvm; @@ -1050,4 +1051,114 @@ } } } + + /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI, + CodeGenOpt::Level OptLev) { + return DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLev); + } + + /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI, + CodeGenOpt::Level OptLev) { + return DIDescriptor::ValidDebugInfo(FSI.getSubprogram(), OptLev); + } + + /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI, + CodeGenOpt::Level OptLev) { + return DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLev); + } + + /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI, + CodeGenOpt::Level OptLev) { + return DIDescriptor::ValidDebugInfo(REI.getContext(), OptLev); + } + + + /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug + /// info intrisic. + bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI, + CodeGenOpt::Level OptLev) { + return DIDescriptor::ValidDebugInfo(DI.getVariable(), OptLev); + } + + /// ExtractDebugLocation - Extract debug location information + /// from llvm.dbg.stoppoint intrinsic. + DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI, + CodeGenOpt::Level OptLev, + DebugLocTracker &DebugLocInfo) { + DebugLoc DL; + Value *Context = SPI.getContext(); + if (DIDescriptor::ValidDebugInfo(Context, OptLev) == false) + return DL; + + // If this location is already tracked then use it. + DebugLocTuple Tuple(cast(Context), SPI.getLine(), + SPI.getColumn()); + DenseMap::iterator II + = DebugLocInfo.DebugIdMap.find(Tuple); + if (II != DebugLocInfo.DebugIdMap.end()) + return DebugLoc::get(II->second); + + // Add a new location entry. + unsigned Id = DebugLocInfo.DebugLocations.size(); + DebugLocInfo.DebugLocations.push_back(Tuple); + DebugLocInfo.DebugIdMap[Tuple] = Id; + + return DebugLoc::get(Id); + } + + /// ExtractDebugLocation - Extract debug location information + /// from llvm.dbg.func_start intrinsic. + DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, + CodeGenOpt::Level OptLev, + DebugLocTracker &DebugLocInfo) { + DebugLoc DL; + Value *SP = FSI.getSubprogram(); + if (DIDescriptor::ValidDebugInfo(SP, OptLev) == false) + return DL; + + DISubprogram Subprogram(cast(SP)); + unsigned Line = Subprogram.getLineNumber(); + DICompileUnit CU(Subprogram.getCompileUnit()); + + // If this location is already tracked then use it. + DebugLocTuple Tuple(CU.getGV(), Line, /* Column */ 0); + DenseMap::iterator II + = DebugLocInfo.DebugIdMap.find(Tuple); + if (II != DebugLocInfo.DebugIdMap.end()) + return DebugLoc::get(II->second); + + // Add a new location entry. + unsigned Id = DebugLocInfo.DebugLocations.size(); + DebugLocInfo.DebugLocations.push_back(Tuple); + DebugLocInfo.DebugIdMap[Tuple] = Id; + + return DebugLoc::get(Id); + } + + /// isInlinedFnStart - Return true if FSI is starting an inlined function. + bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn) { + DISubprogram Subprogram(cast(FSI.getSubprogram())); + if (Subprogram.describes(CurrentFn)) + return false; + + return true; + } + + /// isInlinedFnEnd - Return true if REI is ending an inlined function. + bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn) { + DISubprogram Subprogram(cast(REI.getContext())); + if (Subprogram.isNull() || Subprogram.describes(CurrentFn)) + return false; + + return true; + } + } From clattner at apple.com Wed Jul 1 20:19:00 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 18:19:00 -0700 Subject: [llvm-commits] [llvm] r74630 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/AsmWriter.cpp test/Feature/mdnode2.ll In-Reply-To: <352a1fb20907011637x3ef8db68o5e52c778f6e07b58@mail.gmail.com> References: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> <31D1282E-9B3F-42C5-87B5-32FC0AC7F4E3@apple.com> <352a1fb20907011637x3ef8db68o5e52c778f6e07b58@mail.gmail.com> Message-ID: On Jul 1, 2009, at 4:37 PM, Devang Patel wrote: >> >> On Jul 1, 2009, at 12:21 PM, Devang Patel wrote: >> >>> Author: dpatel >>> Date: Wed Jul 1 14:21:12 2009 >>> New Revision: 74630 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=74630&view=rev >>> Log: >>> Support stand alone metadata syntax. >>> >>> !0 = constant metadata !{i32 21, i32 22} >> >> Why "constant"? > > There is no need IMO. What do you say ? I think it should just be: !0 = metadata ... -Chris From clattner at apple.com Wed Jul 1 20:19:42 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 18:19:42 -0700 Subject: [llvm-commits] [llvm] r74663 - /llvm/trunk/include/llvm-c/lto.h In-Reply-To: <6D175958-9440-4A13-A1C8-CC1AE05680F3@mac.com> References: <200907012328.n61NSuOx029195@zion.cs.uiuc.edu> <352a1fb20907011639v7b6e2ed7lb9dd64ff83cb3a5b@mail.gmail.com> <6D175958-9440-4A13-A1C8-CC1AE05680F3@mac.com> Message-ID: <2AF303BE-98BC-41CA-882F-B53F9DA5B922@apple.com> On Jul 1, 2009, at 4:53 PM, Owen Anderson wrote: > > On Jul 1, 2009, at 4:39 PM, Devang Patel wrote: > >> On Wed, Jul 1, 2009 at 4:28 PM, Owen Anderson >> wrote: >>> Author: resistor >>> Date: Wed Jul 1 18:28:55 2009 >>> New Revision: 74663 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=74663&view=rev >>> Log: >>> Fix the LTO header for LLVMContext changes. >> >> What about LTO clients ? > > The only in-tree client I'm aware of is the Gold plugin, and Nicholas > has agreed to update it, since I can't test it. No, this is not acceptable. No C APIs are allowed to change, ever. If this is important, add new APIs. -Chris From evan.cheng at apple.com Wed Jul 1 20:23:33 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 02 Jul 2009 01:23:33 -0000 Subject: [llvm-commits] [llvm] r74681 - /llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200907020123.n621NXlr032527@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 1 20:23:32 2009 New Revision: 74681 URL: http://llvm.org/viewvc/llvm-project?rev=74681&view=rev Log: Factor out ARM indexed load matching code. Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=74681&r1=74680&r2=74681&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Wed Jul 1 20:23:32 2009 @@ -111,11 +111,13 @@ #include "ARMGenDAGISel.inc" private: - /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for - /// inline asm expressions. - virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op, - char ConstraintCode, - std::vector &OutOps); + SDNode *SelectARMIndexedLoad(SDValue Op); + + /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for + /// inline asm expressions. + virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op, + char ConstraintCode, + std::vector &OutOps); }; } @@ -713,6 +715,53 @@ return CurDAG->getTargetConstant((uint64_t)ARMCC::AL, MVT::i32); } +SDNode *ARMDAGToDAGISel::SelectARMIndexedLoad(SDValue Op) { + LoadSDNode *LD = cast(Op); + ISD::MemIndexedMode AM = LD->getAddressingMode(); + if (AM == ISD::UNINDEXED) + return NULL; + + MVT LoadedVT = LD->getMemoryVT(); + SDValue Offset, AMOpc; + bool isPre = (AM == ISD::PRE_INC) || (AM == ISD::PRE_DEC); + unsigned Opcode = 0; + bool Match = false; + if (LoadedVT == MVT::i32 && + SelectAddrMode2Offset(Op, LD->getOffset(), Offset, AMOpc)) { + Opcode = isPre ? ARM::LDR_PRE : ARM::LDR_POST; + Match = true; + } else if (LoadedVT == MVT::i16 && + SelectAddrMode3Offset(Op, LD->getOffset(), Offset, AMOpc)) { + Match = true; + Opcode = (LD->getExtensionType() == ISD::SEXTLOAD) + ? (isPre ? ARM::LDRSH_PRE : ARM::LDRSH_POST) + : (isPre ? ARM::LDRH_PRE : ARM::LDRH_POST); + } else if (LoadedVT == MVT::i8 || LoadedVT == MVT::i1) { + if (LD->getExtensionType() == ISD::SEXTLOAD) { + if (SelectAddrMode3Offset(Op, LD->getOffset(), Offset, AMOpc)) { + Match = true; + Opcode = isPre ? ARM::LDRSB_PRE : ARM::LDRSB_POST; + } + } else { + if (SelectAddrMode2Offset(Op, LD->getOffset(), Offset, AMOpc)) { + Match = true; + Opcode = isPre ? ARM::LDRB_PRE : ARM::LDRB_POST; + } + } + } + + if (Match) { + SDValue Chain = LD->getChain(); + SDValue Base = LD->getBasePtr(); + SDValue Ops[]= { Base, Offset, AMOpc, getAL(CurDAG), + CurDAG->getRegister(0, MVT::i32), Chain }; + return CurDAG->getTargetNode(Opcode, Op.getDebugLoc(), MVT::i32, MVT::i32, + MVT::Other, Ops, 6); + } + + return NULL; +} + SDNode *ARMDAGToDAGISel::Select(SDValue Op) { SDNode *N = Op.getNode(); @@ -843,47 +892,9 @@ return CurDAG->getTargetNode(ARM::SMULL, dl, MVT::i32, MVT::i32, Ops, 5); } case ISD::LOAD: { - LoadSDNode *LD = cast(Op); - ISD::MemIndexedMode AM = LD->getAddressingMode(); - MVT LoadedVT = LD->getMemoryVT(); - if (AM != ISD::UNINDEXED) { - SDValue Offset, AMOpc; - bool isPre = (AM == ISD::PRE_INC) || (AM == ISD::PRE_DEC); - unsigned Opcode = 0; - bool Match = false; - if (LoadedVT == MVT::i32 && - SelectAddrMode2Offset(Op, LD->getOffset(), Offset, AMOpc)) { - Opcode = isPre ? ARM::LDR_PRE : ARM::LDR_POST; - Match = true; - } else if (LoadedVT == MVT::i16 && - SelectAddrMode3Offset(Op, LD->getOffset(), Offset, AMOpc)) { - Match = true; - Opcode = (LD->getExtensionType() == ISD::SEXTLOAD) - ? (isPre ? ARM::LDRSH_PRE : ARM::LDRSH_POST) - : (isPre ? ARM::LDRH_PRE : ARM::LDRH_POST); - } else if (LoadedVT == MVT::i8 || LoadedVT == MVT::i1) { - if (LD->getExtensionType() == ISD::SEXTLOAD) { - if (SelectAddrMode3Offset(Op, LD->getOffset(), Offset, AMOpc)) { - Match = true; - Opcode = isPre ? ARM::LDRSB_PRE : ARM::LDRSB_POST; - } - } else { - if (SelectAddrMode2Offset(Op, LD->getOffset(), Offset, AMOpc)) { - Match = true; - Opcode = isPre ? ARM::LDRB_PRE : ARM::LDRB_POST; - } - } - } - - if (Match) { - SDValue Chain = LD->getChain(); - SDValue Base = LD->getBasePtr(); - SDValue Ops[]= { Base, Offset, AMOpc, getAL(CurDAG), - CurDAG->getRegister(0, MVT::i32), Chain }; - return CurDAG->getTargetNode(Opcode, dl, MVT::i32, MVT::i32, - MVT::Other, Ops, 6); - } - } + SDNode *ResNode = SelectARMIndexedLoad(Op); + if (ResNode) + return ResNode; // Other cases are autogenerated. break; } From sabre at nondot.org Wed Jul 1 20:24:34 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 01:24:34 -0000 Subject: [llvm-commits] [llvm] r74682 - /llvm/trunk/lib/Target/PowerPC/README.txt Message-ID: <200907020124.n621OYlH032567@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 20:24:34 2009 New Revision: 74682 URL: http://llvm.org/viewvc/llvm-project?rev=74682&view=rev Log: clarify: stub emission depends on the version of the linker you use, it has nothing to do with the target. Also, the stub elimination optimization *requires* making the stub explicit. Modified: llvm/trunk/lib/Target/PowerPC/README.txt Modified: llvm/trunk/lib/Target/PowerPC/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/README.txt?rev=74682&r1=74681&r2=74682&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/README.txt (original) +++ llvm/trunk/lib/Target/PowerPC/README.txt Wed Jul 1 20:24:34 2009 @@ -183,9 +183,10 @@ Darwin Stub removal: We still generate calls to foo$stub, and stubs, on Darwin. This is not -necessary on Leopard (10.5) or later, as stubs are generated by ld when -necessary. The choice should depend on the value of -mmacosx-version-min. -x86-32 does this right, see its logic. +necessary when building with the Leopard (10.5) or later linker, as stubs are +generated by ld when necessary. Parameterizing this based on the deployment +target (-mmacosx-version-min) is probably enough. x86-32 does this right, see +its logic. ===-------------------------------------------------------------------------=== @@ -205,8 +206,6 @@ stub). This is Darwin specific and would have to be done in the code generator. Probably not a win on x86. -Note that removing stubs altogether, as in the previous item, is better yet. - ===-------------------------------------------------------------------------=== Simple IPO for argument passing, change: From daniel at zuster.org Wed Jul 1 20:28:48 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 1 Jul 2009 18:28:48 -0700 Subject: [llvm-commits] [llvm] r74676 - in /llvm/trunk: include/llvm/Analysis/Dominators.h lib/Target/X86/X86FastISel.cpp lib/Transforms/Scalar/JumpThreading.cpp lib/Transforms/Scalar/TailDuplication.cpp tools/llvm-prof/llvm-prof.cpp In-Reply-To: <200907020017.n620HmL1030779@zion.cs.uiuc.edu> References: <200907020017.n620HmL1030779@zion.cs.uiuc.edu> Message-ID: <6a8523d60907011828i64890734jf69cef583c34e001@mail.gmail.com> Hi Dan, Some of these uses would be simpler if they used lookup() instead of find (assuming the null value shouldn't be in the map). For example, On Wed, Jul 1, 2009 at 5:17 PM, Dan Gohman wrote: > ? DomTreeNodeBase *getNodeForBlock(NodeT *BB) { > - ? ?if (DomTreeNodeBase *BBNode = this->DomTreeNodes[BB]) > - ? ? ?return BBNode; > + ? ?typename DomTreeNodeMapType::iterator I = this->DomTreeNodes.find(BB); > + ? ?if (I != this->DomTreeNodes.end() && I->second) > + ? ? ?return I->second; This can be written as: -- if (DomTreeNodeBase *Node = this->DomTreeNodes.lookup(BB)) return Node; -- - Daniel From evan.cheng at apple.com Wed Jul 1 20:30:04 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 02 Jul 2009 01:30:04 -0000 Subject: [llvm-commits] [llvm] r74683 - /llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Message-ID: <200907020130.n621U5hY032726@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 1 20:30:04 2009 New Revision: 74683 URL: http://llvm.org/viewvc/llvm-project?rev=74683&view=rev Log: 80 col violation. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=74683&r1=74682&r2=74683&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Wed Jul 1 20:30:04 2009 @@ -751,7 +751,7 @@ def LDRSB_POST: AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb), (ins GPR:$base,am3offset:$offset), LdMiscFrm, - "ldr", "sb $dst, [$base], $offset", "$base = $base_wb", []>; + "ldr", "sb $dst, [$base], $offset", "$base = $base_wb", []>; } // Store From daniel at zuster.org Wed Jul 1 20:40:53 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 1 Jul 2009 18:40:53 -0700 Subject: [llvm-commits] [llvm] r74624 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/ Message-ID: <6a8523d60907011840k41d8459cxad55aab6122bf0f9@mail.gmail.com> I probably missed the backstory here, but wouldn't it be better for us to consistently use byte alignment? Some contexts will always need non-power of two alignment, and I think there is value in standardizing on one form. The situation now is we have code like TargetData::get...Alignment which returns bytes, and MachineFunction::get...Alignment which returns log2. Alternately we could include Log2 in the name... - Daniel On Wed, Jul 1, 2009 at 11:51 AM, Bill Wendling wrote: > Author: void > Date: Wed Jul ?1 13:50:55 2009 > New Revision: 74624 > > URL: http://llvm.org/viewvc/llvm-project?rev=74624&view=rev > Log: > Update comments to make it clear that the function alignment is the Log2 of the > bytes and not bytes. > > Modified: > ? ?llvm/trunk/include/llvm/CodeGen/MachineFunction.h > ? ?llvm/trunk/include/llvm/Target/TargetLowering.h > ? ?llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > ? ?llvm/trunk/lib/Target/ARM/ARMISelLowering.h > ? ?llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp > ? ?llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h > ? ?llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp > ? ?llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h > ? ?llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp > ? ?llvm/trunk/lib/Target/IA64/IA64ISelLowering.h > ? ?llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp > ? ?llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h > ? ?llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp > ? ?llvm/trunk/lib/Target/Mips/MipsISelLowering.h > ? ?llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h > ? ?llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp > ? ?llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h > ? ?llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp > ? ?llvm/trunk/lib/Target/Sparc/SparcISelLowering.h > ? ?llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > ? ?llvm/trunk/lib/Target/X86/X86ISelLowering.h > ? ?llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp > ? ?llvm/trunk/lib/Target/XCore/XCoreISelLowering.h > > Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Wed Jul ?1 13:50:55 2009 > @@ -151,11 +151,11 @@ > ? MachineConstantPool *getConstantPool() { return ConstantPool; } > ? const MachineConstantPool *getConstantPool() const { return ConstantPool; } > > - ?/// getAlignment - Return the alignment of the function. > + ?/// getAlignment - Return the alignment (log2, not bytes) of the function. > ? /// > ? unsigned getAlignment() const { return Alignment; } > > - ?/// setAlignment - Set the alignment of the function. > + ?/// setAlignment - Set the alignment (log2, not bytes) of the function. > ? /// > ? void setAlignment(unsigned A) { Alignment = A; } > > > Modified: llvm/trunk/include/llvm/Target/TargetLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) > +++ llvm/trunk/include/llvm/Target/TargetLowering.h Wed Jul ?1 13:50:55 2009 > @@ -736,7 +736,7 @@ > ? /// PIC relocation models. > ? virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; > > - ?/// getFunctionAlignment - Return the alignment of this function. > + ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? virtual unsigned getFunctionAlignment(const Function *) const = 0; > > ? //===--------------------------------------------------------------------===// > > Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -455,7 +455,7 @@ > ? } > ?} > > -/// getFunctionAlignment - Return the alignment of this function. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned ARMTargetLowering::getFunctionAlignment(const Function *F) const { > ? return getTargetMachine().getSubtarget().isThumb() ? 1 : 2; > ?} > > Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -197,7 +197,7 @@ > ? ? ? return Subtarget; > ? ? } > > - ? ?/// getFunctionAlignment - Return the alignment of this function. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > > ? private: > > Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -181,7 +181,7 @@ > ? } > ?} > > -/// getFunctionAlignment - Return the function alignment. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned AlphaTargetLowering::getFunctionAlignment(const Function *F) const { > ? return 4; > ?} > > Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original) > +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -103,7 +103,7 @@ > > ? ? virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; > > - ? ?/// getFunctionAlignment - Return the function alignment. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > > ? private: > > Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -481,7 +481,7 @@ > ? return ((i != node_names.end()) ? i->second : 0); > ?} > > -/// getFunctionAlignment - Return the function alignment. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned SPUTargetLowering::getFunctionAlignment(const Function *) const { > ? return 3; > ?} > > Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h (original) > +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -149,7 +149,7 @@ > > ? ? virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; > > - ? ?/// getFunctionAlignment - Return the function alignment. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > ? }; > ?} > > Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -148,7 +148,7 @@ > ? return MVT::i1; > ?} > > -/// getFunctionAlignment - Return the function alignment. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned IA64TargetLowering::getFunctionAlignment(const Function *) const { > ? return 5; > ?} > > Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.h (original) > +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -70,7 +70,7 @@ > ? ? /// (currently, only "ret void") > ? ? virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); > > - ? ?/// getFunctionAlignment - Return the function alignment. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > ? }; > ?} > > Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -127,7 +127,7 @@ > ? } > ?} > > -/// getFunctionAlignment - Return the alignment of this function. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned MSP430TargetLowering::getFunctionAlignment(const Function *F) const { > ? return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; > ?} > > Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h (original) > +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -74,7 +74,7 @@ > ? ? /// DAG node. > ? ? virtual const char *getTargetNodeName(unsigned Opcode) const; > > - ? ?/// getFunctionAlignment - Return the alignment of this function. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > > ? ? SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG); > > Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -158,7 +158,7 @@ > ? return MVT::i32; > ?} > > -/// getFunctionAlignment - Return the function alignment. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned MipsTargetLowering::getFunctionAlignment(const Function *) const { > ? return 2; > ?} > > Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original) > +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -84,7 +84,7 @@ > ? ? /// getSetCCResultType - get the ISD::SETCC result ValueType > ? ? MVT getSetCCResultType(MVT VT) const; > > - ? ?/// getFunctionAlignment - Return the function alignment. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > ? private: > ? ? // Subtarget Info > > Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original) > +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -145,7 +145,7 @@ > ? ? unsigned GetTmpSize() { return TmpSize; } > ? ? void SetTmpSize(unsigned Size) { TmpSize = Size; } > > - ? ?/// getFunctionAlignment - Return the function alignment. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *) const { > ? ? ? // FIXME: The function never seems to be aligned. > ? ? ? return 1; > > Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -432,7 +432,7 @@ > ? return MVT::i32; > ?} > > -/// getFunctionAlignment - Return the function alignment. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned PPCTargetLowering::getFunctionAlignment(const Function *F) const { > ? if (getTargetMachine().getSubtarget().isDarwin()) > ? ? return F->hasFnAttr(Attribute::OptimizeForSize) ? 2 : 4; > > Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) > +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -337,7 +337,7 @@ > > ? ? virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; > > - ? ?/// getFunctionAlignment - Return the function alignment. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > > ? private: > > Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -1048,7 +1048,7 @@ > ? return false; > ?} > > -/// getFunctionAlignment - Return the function alignment. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned SparcTargetLowering::getFunctionAlignment(const Function *) const { > ? return 4; > ?} > > Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.h (original) > +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -74,7 +74,7 @@ > > ? ? virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; > > - ? ?/// getFunctionAlignment - Return the function alignment. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > ? }; > ?} // end namespace llvm > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -1027,7 +1027,7 @@ > ? return Table; > ?} > > -/// getFunctionAlignment - Return the alignment of this function. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned X86TargetLowering::getFunctionAlignment(const Function *F) const { > ? return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; > ?} > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -534,7 +534,7 @@ > ?#endif > ? ? ? ? ? ? ? ? ? ?); > > - ? ?/// getFunctionAlignment - Return the alignment of this function. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > > ? private: > > Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Wed Jul ?1 13:50:55 2009 > @@ -187,7 +187,7 @@ > ? } > ?} > > -/// getFunctionAlignment - Return the alignment of this function. > +/// getFunctionAlignment - Return the Log2 alignment of this function. > ?unsigned XCoreTargetLowering:: > ?getFunctionAlignment(const Function *) const { > ? return 1; > > Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.h?rev=74624&r1=74623&r2=74624&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.h (original) > +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.h Wed Jul ?1 13:50:55 2009 > @@ -84,7 +84,7 @@ > ? ? virtual bool isLegalAddressingMode(const AddrMode &AM, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const Type *Ty) const; > > - ? ?/// getFunctionAlignment - Return the alignment of this function. > + ? ?/// getFunctionAlignment - Return the Log2 alignment of this function. > ? ? virtual unsigned getFunctionAlignment(const Function *F) const; > > ? private: > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Wed Jul 1 20:58:25 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 02 Jul 2009 01:58:25 -0000 Subject: [llvm-commits] [llvm] r74684 - in /llvm/trunk/tools/llvm-mc: AsmParser.h MC-X86Specific.cpp Message-ID: <200907020158.n621wPff001050@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 20:58:24 2009 New Revision: 74684 URL: http://llvm.org/viewvc/llvm-project?rev=74684&view=rev Log: llvm-mc/x86: Factor out ParseX86Register. Modified: llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=74684&r1=74683&r2=74684&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Wed Jul 1 20:58:24 2009 @@ -81,6 +81,7 @@ bool ParseX86InstOperands(const char *InstName, MCInst &Inst); bool ParseX86Operand(X86Operand &Op); bool ParseX86MemOperand(X86Operand &Op); + bool ParseX86Register(X86Operand &Op); // Directive Parsing. bool ParseDirectiveDarwinSection(); // Darwin specific ".section". Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=74684&r1=74683&r2=74684&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Wed Jul 1 20:58:24 2009 @@ -42,6 +42,11 @@ } Mem; }; + unsigned getReg() const { + assert(Kind == Register && "Invalid access!"); + return Reg.RegNo; + } + static X86Operand CreateReg(unsigned RegNo) { X86Operand Res; Res.Kind = Register; @@ -56,6 +61,12 @@ } static X86Operand CreateMem(unsigned SegReg, MCValue Disp, unsigned BaseReg, unsigned IndexReg, unsigned Scale) { + // If there is no index register, we should never have a scale, and we + // should always have a scale (in {1,2,4,8}) if we do. + assert(((Scale == 0 && !IndexReg) || + (IndexReg && (Scale == 1 || Scale == 2 || + Scale == 4 || Scale == 8))) && + "Invalid scale!"); X86Operand Res; Res.Kind = Memory; Res.Mem.SegReg = SegReg; @@ -67,17 +78,24 @@ } }; +bool AsmParser::ParseX86Register(X86Operand &Op) { + assert(Lexer.getKind() == asmtok::Register && "Invalid token kind!"); + + // FIXME: Decode register number. + Op = X86Operand::CreateReg(123); + Lexer.Lex(); // Eat register token. + + return false; +} + bool AsmParser::ParseX86Operand(X86Operand &Op) { switch (Lexer.getKind()) { default: return ParseX86MemOperand(Op); case asmtok::Register: - // FIXME: Decode reg #. // FIXME: if a segment register, this could either be just the seg reg, or // the start of a memory operand. - Op = X86Operand::CreateReg(123); - Lexer.Lex(); // Eat register. - return false; + return ParseX86Register(Op); case asmtok::Dollar: { // $42 -> immediate. Lexer.Lex(); @@ -91,13 +109,12 @@ Lexer.Lex(); // Eat the star. if (Lexer.is(asmtok::Register)) { - Op = X86Operand::CreateReg(123); - Lexer.Lex(); // Eat register. + if (ParseX86Register(Op)) + return true; } else if (ParseX86MemOperand(Op)) return true; - // FIXME: Note that these are 'dereferenced' so that clients know the '*' is - // there. + // FIXME: Note the '*' in the operand for use by the matcher. return false; } } @@ -155,21 +172,23 @@ unsigned BaseReg = 0, IndexReg = 0, Scale = 0; if (Lexer.is(asmtok::Register)) { - BaseReg = 123; // FIXME: decode reg # - Lexer.Lex(); // eat the register. + if (ParseX86Register(Op)) + return true; + BaseReg = Op.getReg(); } if (Lexer.is(asmtok::Comma)) { Lexer.Lex(); // eat the comma. if (Lexer.is(asmtok::Register)) { - IndexReg = 123; // FIXME: decode reg # - Lexer.Lex(); // eat the register. + if (ParseX86Register(Op)) + return true; + IndexReg = Op.getReg(); Scale = 1; // If not specified, the scale defaults to 1. } if (Lexer.is(asmtok::Comma)) { - Lexer.Lex(); // eat the comma. + Lexer.Lex(); // Eat the comma. // If present, get and validate scale amount. if (Lexer.is(asmtok::IntVal)) { From daniel at zuster.org Wed Jul 1 21:00:22 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 1 Jul 2009 19:00:22 -0700 Subject: [llvm-commits] [llvm] r74608 - /llvm/trunk/lib/Support/SystemUtils.cpp In-Reply-To: References: <200907011526.n61FQXME012202@zion.cs.uiuc.edu> Message-ID: <6a8523d60907011900x700d9489id97f7b5222c63f78@mail.gmail.com> On Wed, Jul 1, 2009 at 8:55 AM, Misha Brukman wrote: > 2009/7/1 Daniel Dunbar >> >> + ?// Otherwise check the directory that the calling program is in. ?We >> can do >> + ?// this if ProgramPath contains at least one / character, indicating >> that it >> + ?// is a relative path to bugpoint itself. > > Why is this referring to bugpoint specifically? ?This is a generic system > library, not bugpoint-specific. > Did you mean "binary"? I don't know. I didn't write that comment I just changed one word and reflowed. - Daniel > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From daniel at zuster.org Wed Jul 1 21:09:07 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 02 Jul 2009 02:09:07 -0000 Subject: [llvm-commits] [llvm] r74685 - in /llvm/trunk/tools/llvm-mc: AsmParser.cpp AsmParser.h MC-X86Specific.cpp Message-ID: <200907020209.n62298Tv001365@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 21:09:07 2009 New Revision: 74685 URL: http://llvm.org/viewvc/llvm-project?rev=74685&view=rev Log: llvm-mc/x86: Fix bug in disambiguation of displacement operand, introduced by me (I think). - We weren't properly parsing the leading parenthesized expression in something like 'push (4)(%eax)'. - Added ParseParenRelocatableExpression to support this. I suspect we should just use lookahead, though. - Test case to follow. Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74685&r1=74684&r2=74685&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Wed Jul 1 21:09:07 2009 @@ -167,6 +167,19 @@ return false; } +bool AsmParser::ParseParenRelocatableExpression(MCValue &Res) { + AsmExpr *Expr; + + SMLoc StartLoc = Lexer.getLoc(); + if (ParseParenExpr(Expr)) + return true; + + if (!Expr->EvaluateAsRelocatable(Ctx, Res)) + return Error(StartLoc, "expected relocatable expression"); + + return false; +} + static unsigned getBinOpPrecedence(asmtok::TokKind K, AsmBinaryExpr::Opcode &Kind) { switch (K) { Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=74685&r1=74684&r2=74685&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Wed Jul 1 21:09:07 2009 @@ -73,6 +73,16 @@ /// @result - False on success. bool ParseRelocatableExpression(MCValue &Res); + /// ParseParenRelocatableExpression - Parse an expression which must be + /// relocatable, assuming that an initial '(' has already been consumed. + /// + /// @param Res - The relocatable expression value. The result is undefined on + /// error. + /// @result - False on success. + /// + /// @see ParseRelocatableExpression, ParseParenExpr. + bool ParseParenRelocatableExpression(MCValue &Res); + bool ParsePrimaryExpr(AsmExpr *&Res); bool ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res); bool ParseParenExpr(AsmExpr *&Res); Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=74685&r1=74684&r2=74685&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Wed Jul 1 21:09:07 2009 @@ -152,7 +152,7 @@ // memory operand consumed. } else { // It must be an parenthesized expression, parse it now. - if (ParseRelocatableExpression(Disp)) + if (ParseParenRelocatableExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized From bruno.cardoso at gmail.com Wed Jul 1 21:13:14 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Thu, 02 Jul 2009 02:13:14 -0000 Subject: [llvm-commits] [llvm] r74686 - in /llvm/trunk: include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELFCodeEmitter.cpp lib/Target/TargetELFWriterInfo.cpp lib/Target/X86/X86ELFWriterInfo.cpp lib/Target/X86/X86ELFWriterInfo.h Message-ID: <200907020213.n622DERP001541@zion.cs.uiuc.edu> Author: bruno Date: Wed Jul 1 21:13:13 2009 New Revision: 74686 URL: http://llvm.org/viewvc/llvm-project?rev=74686&view=rev Log: Remove getFunctionAlignment from TargetELFInfo and use new MachineFunction alignment method Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp llvm/trunk/lib/Target/TargetELFWriterInfo.cpp llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h?rev=74686&r1=74685&r2=74686&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h Wed Jul 1 21:13:13 2009 @@ -89,10 +89,6 @@ : (hasRelocationAddend() ? 12 : 8); } - /// getFunctionAlignment - Returns the alignment for function 'F', targets - /// with different alignment constraints should overload this method - virtual unsigned getFunctionAlignment(const Function *F) const; - /// getRelocationType - Returns the target specific ELF Relocation type. /// 'MachineRelTy' contains the object code independent relocation type virtual unsigned getRelocationType(unsigned MachineRelTy) const = 0; Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp?rev=74686&r1=74685&r2=74686&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Wed Jul 1 21:13:13 2009 @@ -40,10 +40,11 @@ BufferBegin = &BD[0]; BufferEnd = BufferBegin + BD.capacity(); - // Align the output buffer with function alignment, and - // upgrade the section alignment if required - unsigned Align = - TM.getELFWriterInfo()->getFunctionAlignment(MF.getFunction()); + // Get the function alignment in bytes + unsigned Align = (1 << MF.getAlignment()); + + // Align the section size with the function alignment, so the function can + // start in a aligned offset, also update the section alignment if needed. if (ES->Align < Align) ES->Align = Align; ES->Size = (ES->Size + (Align-1)) & (-Align); Modified: llvm/trunk/lib/Target/TargetELFWriterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetELFWriterInfo.cpp?rev=74686&r1=74685&r2=74686&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetELFWriterInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetELFWriterInfo.cpp Wed Jul 1 21:13:13 2009 @@ -24,13 +24,3 @@ TargetELFWriterInfo::~TargetELFWriterInfo() {} -/// getFunctionAlignment - Returns the alignment for function 'F', targets -/// with different alignment constraints should overload this method -unsigned TargetELFWriterInfo::getFunctionAlignment(const Function *F) const { - const TargetData *TD = TM.getTargetData(); - unsigned FnAlign = F->getAlignment(); - unsigned TDAlign = TD->getPointerABIAlignment(); - unsigned Align = std::max(FnAlign, TDAlign); - assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); - return Align; -} Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp?rev=74686&r1=74685&r2=74686&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp Wed Jul 1 21:13:13 2009 @@ -59,18 +59,6 @@ return 0; } -unsigned X86ELFWriterInfo::getFunctionAlignment(const Function *F) const { - unsigned FnAlign = 4; - - if (F->hasFnAttr(Attribute::OptimizeForSize)) - FnAlign = 1; - - if (F->getAlignment()) - FnAlign = Log2_32(F->getAlignment()); - - return (1 << FnAlign); -} - long int X86ELFWriterInfo::getAddendForRelTy(unsigned RelTy) const { if (is64Bit) { switch(RelTy) { Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h?rev=74686&r1=74685&r2=74686&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h Wed Jul 1 21:13:13 2009 @@ -41,10 +41,6 @@ X86ELFWriterInfo(TargetMachine &TM); virtual ~X86ELFWriterInfo(); - /// getFunctionAlignment - Returns the alignment for function 'F', targets - /// with different alignment constraints should overload this method - virtual unsigned getFunctionAlignment(const Function *F) const; - /// getRelocationType - Returns the target specific ELF Relocation type. /// 'MachineRelTy' contains the object code independent relocation type virtual unsigned getRelocationType(unsigned MachineRelTy) const; From daniel at zuster.org Wed Jul 1 21:26:40 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 02 Jul 2009 02:26:40 -0000 Subject: [llvm-commits] [llvm] r74687 - /llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Message-ID: <200907020226.n622Qeks001955@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 21:26:39 2009 New Revision: 74687 URL: http://llvm.org/viewvc/llvm-project?rev=74687&view=rev Log: llvm-mc/x86: Fix various nit-picky bugs in displacement parsing. - Test case to follow. Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=74687&r1=74686&r2=74687&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Wed Jul 1 21:26:39 2009 @@ -14,6 +14,7 @@ #include "AsmParser.h" #include "llvm/MC/MCInst.h" +#include "llvm/Support/SourceMgr.h" using namespace llvm; /// X86Operand - Instances of this class represent one X86 machine instruction. @@ -178,26 +179,48 @@ } if (Lexer.is(asmtok::Comma)) { - Lexer.Lex(); // eat the comma. - + Lexer.Lex(); // Eat the comma. + + // Following the comma we should have either an index register, or a scale + // value. We don't support the later form, but we want to parse it + // correctly. + // + // Not that even though it would be completely consistent to support syntax + // like "1(%eax,,1)", the assembler doesn't. if (Lexer.is(asmtok::Register)) { if (ParseX86Register(Op)) return true; IndexReg = Op.getReg(); Scale = 1; // If not specified, the scale defaults to 1. - } - if (Lexer.is(asmtok::Comma)) { - Lexer.Lex(); // Eat the comma. - - // If present, get and validate scale amount. - if (Lexer.is(asmtok::IntVal)) { - int64_t ScaleVal = Lexer.getCurIntVal(); - if (ScaleVal != 1 && ScaleVal != 2 && ScaleVal != 4 && ScaleVal != 8) - return TokError("scale factor in address must be 1, 2, 4 or 8"); - Lexer.Lex(); // eat the scale. - Scale = (unsigned)ScaleVal; + if (Lexer.isNot(asmtok::RParen)) { + // Parse the scale amount: + // ::= ',' [scale-expression] + if (Lexer.isNot(asmtok::Comma)) + return true; + Lexer.Lex(); // Eat the comma. + + if (Lexer.isNot(asmtok::RParen)) { + int64_t ScaleVal; + if (ParseAbsoluteExpression(ScaleVal)) + return true; + + // Validate the scale amount. + if (ScaleVal != 1 && ScaleVal != 2 && ScaleVal != 4 && ScaleVal != 8) + return TokError("scale factor in address must be 1, 2, 4 or 8"); + Scale = (unsigned)ScaleVal; + } } + } else if (Lexer.isNot(asmtok::RParen)) { + // Otherwise we have the unsupported form of a scale amount without an + // index. + SMLoc Loc = Lexer.getLoc(); + + int64_t Value; + if (ParseAbsoluteExpression(Value)) + return true; + + return Error(Loc, "cannot have scale factor without index register"); } } From daniel at zuster.org Wed Jul 1 21:28:23 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 02 Jul 2009 02:28:23 -0000 Subject: [llvm-commits] [llvm] r74688 - /llvm/trunk/test/MC/AsmParser/x86_operands.s Message-ID: <200907020228.n622SNfJ002011@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 1 21:28:23 2009 New Revision: 74688 URL: http://llvm.org/viewvc/llvm-project?rev=74688&view=rev Log: llvm-mc/x86: Test case for x86 operand parsing. Added: llvm/trunk/test/MC/AsmParser/x86_operands.s Added: llvm/trunk/test/MC/AsmParser/x86_operands.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/x86_operands.s?rev=74688&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/x86_operands.s (added) +++ llvm/trunk/test/MC/AsmParser/x86_operands.s Wed Jul 1 21:28:23 2009 @@ -0,0 +1,36 @@ +// FIXME: Actually test that we get the expected results. + +// RUN: llvm-mc %s > %t + +# Immediates + push $1 + push $(1+2) + push $a + push $1 + 2 + +# Disambiguation + push 4+4 + push (4+4) + push (4+4)(%eax) + push 8(%eax) + push (%eax) + push (4+4)(,%eax) + +# Indirect Memory Operands + push 1(%eax) + push 1(%eax,%ebx) + push 1(%eax,%ebx,) + push 1(%eax,%ebx,4) + push 1(,%ebx) + push 1(,%ebx,) + push 1(,%ebx,4) + push 1(,%ebx,(2+2)) + +# '*' + call a + call *a + call *%eax + call 4(%eax) # FIXME: Warn or reject. + call *4(%eax) + + From sabre at nondot.org Wed Jul 1 22:14:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 03:14:32 -0000 Subject: [llvm-commits] [llvm] r74689 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-constpool.ll Message-ID: <200907020314.n623EWdL003340@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 22:14:25 2009 New Revision: 74689 URL: http://llvm.org/viewvc/llvm-project?rev=74689&view=rev Log: Fix yet-another bug I introduced into fastisel, this time handling constant pool references that weren't getting properly rip-relative. Added: llvm/trunk/test/CodeGen/X86/fast-isel-constpool.ll Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=74689&r1=74688&r2=74689&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Wed Jul 1 22:14:25 2009 @@ -1514,7 +1514,9 @@ } else if (Subtarget->isPICStyleGOT()) { OpFlag = X86II::MO_GOTOFF; PICBase = getInstrInfo()->getGlobalBaseReg(&MF); - } + } else if (Subtarget->isPICStyleRIPRel() && + TM.getCodeModel() == CodeModel::Small) + PICBase = X86::RIP; } // Create the load from the constant pool. Added: llvm/trunk/test/CodeGen/X86/fast-isel-constpool.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-constpool.ll?rev=74689&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-constpool.ll (added) +++ llvm/trunk/test/CodeGen/X86/fast-isel-constpool.ll Wed Jul 1 22:14:25 2009 @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -fast-isel | grep {LCPI1_0(%rip)} +; Make sure fast isel uses rip-relative addressing when required. +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-apple-darwin9.0" + +define i32 @f0(double %x) nounwind { +entry: + %retval = alloca i32 ; [#uses=2] + %x.addr = alloca double ; [#uses=2] + store double %x, double* %x.addr + %tmp = load double* %x.addr ; [#uses=1] + %cmp = fcmp olt double %tmp, 8.500000e-01 ; [#uses=1] + %conv = zext i1 %cmp to i32 ; [#uses=1] + store i32 %conv, i32* %retval + %0 = load i32* %retval ; [#uses=1] + ret i32 %0 +} From clattner at apple.com Wed Jul 1 22:18:42 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Jul 2009 20:18:42 -0700 Subject: [llvm-commits] [llvm] r74624 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/ In-Reply-To: <6a8523d60907011840k41d8459cxad55aab6122bf0f9@mail.gmail.com> References: <6a8523d60907011840k41d8459cxad55aab6122bf0f9@mail.gmail.com> Message-ID: On Jul 1, 2009, at 6:40 PM, Daniel Dunbar wrote: > I probably missed the backstory here, but wouldn't it be better for us > to consistently use byte alignment? > > Some contexts will always need non-power of two alignment, and I think > there is value in standardizing on one form. The situation now is we > have code like TargetData::get...Alignment which returns bytes, and > MachineFunction::get...Alignment which returns log2. Alternately we > could include Log2 in the name... I vote for keeping it in log2 and standardizing on log2 form. The reason is that it takes less space to represent, it is impossible to store something that is not a pow2, and it is cheaper to convert from log2 -> bytes than from bytes->log2. -Chris From nicholas at mxc.ca Wed Jul 1 23:09:01 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 01 Jul 2009 21:09:01 -0700 Subject: [llvm-commits] [llvm] r74628 - in /llvm/trunk/include/llvm/CodeGen: MachineInstrBuilder.h MachineOperand.h In-Reply-To: <200907011908.n61J8Dua020706@zion.cs.uiuc.edu> References: <200907011908.n61J8Dua020706@zion.cs.uiuc.edu> Message-ID: <4A4C32DD.8020408@mxc.ca> Devang Patel wrote: > Author: dpatel > Date: Wed Jul 1 14:08:07 2009 > New Revision: 74628 > > URL: http://llvm.org/viewvc/llvm-project?rev=74628&view=rev > Log: > Add machine operand for MDNodes. This will be used to communicate debug info. > > Modified: > llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h > llvm/trunk/include/llvm/CodeGen/MachineOperand.h > > Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=74628&r1=74627&r2=74628&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Wed Jul 1 14:08:07 2009 > @@ -107,6 +107,13 @@ > return *this; > } > > + const MachineInstrBuilder &addMetadata(MDNode *N, > + int64_t Offset = 0, > + unsigned char TargetFlags = 0) const { > + MI->addOperand(MachineOperand::CreateMDNode(N, Offset, TargetFlags)); > + return *this; > + } > + > const MachineInstrBuilder &addExternalSymbol(const char *FnName, > int64_t Offset = 0, > unsigned char TargetFlags = 0) const { > > Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=74628&r1=74627&r2=74628&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Wed Jul 1 14:08:07 2009 > @@ -23,6 +23,7 @@ > class ConstantFP; > class MachineBasicBlock; > class GlobalValue; > +class MDNode; > class MachineInstr; > class TargetMachine; > class MachineRegisterInfo; > @@ -41,7 +42,8 @@ > MO_ConstantPoolIndex, ///< Address of indexed Constant in Constant Pool > MO_JumpTableIndex, ///< Address of indexed Jump Table for switch > MO_ExternalSymbol, ///< Name of external global symbol > - MO_GlobalAddress ///< Address of a global value > + MO_GlobalAddress, ///< Address of a global value > + MO_Metadata ///< Metadata info > }; > > private: > @@ -107,6 +109,7 @@ > int Index; // For MO_*Index - The index itself. > const char *SymbolName; // For MO_ExternalSymbol. > GlobalValue *GV; // For MO_GlobalAddress. > + MDNode *Node; // For MO_Metadata. Tab. > } Val; > int64_t Offset; // An offset from the object. > } OffsetedInfo; > @@ -423,6 +426,14 @@ > Op.setTargetFlags(TargetFlags); > return Op; > } > + static MachineOperand CreateMDNode(MDNode *N, int64_t Offset, > + unsigned char TargetFlags = 0) { Tabs. Nick > + MachineOperand Op(MachineOperand::MO_Metadata); > + Op.Contents.OffsetedInfo.Val.Node = N; > + Op.setOffset(Offset); > + Op.setTargetFlags(TargetFlags); > + return Op; > + } > static MachineOperand CreateES(const char *SymName, int64_t Offset = 0, > unsigned char TargetFlags = 0) { > MachineOperand Op(MachineOperand::MO_ExternalSymbol); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From nicholas at mxc.ca Wed Jul 1 23:15:15 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 01 Jul 2009 21:15:15 -0700 Subject: [llvm-commits] [llvm] r74630 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/AsmWriter.cpp test/Feature/mdnode2.ll In-Reply-To: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> References: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> Message-ID: <4A4C3453.6030204@mxc.ca> Hi Devang, I have a concern about this patch. You're assigning the numbers as you go while printing instead of storing them as a vector in the Module. This has the exact same behaviour when you print out the entire module, but I'm worried that if you "cout << Inst1; cout << Inst2;" where Inst1 and Inst2 both refer to two different metadata nodes then the numbering will reuse !0. If you want to avoid keeping a vector in the Module, the best thing to do would be to only use numbered metadata when printing the whole module and otherwise print out the full contents of the metadata node. That should be pretty easy to verify by adding a unit test to unittests/VMCore/MetadataTest.cpp. Nick Devang Patel wrote: > Author: dpatel > Date: Wed Jul 1 14:21:12 2009 > New Revision: 74630 > > URL: http://llvm.org/viewvc/llvm-project?rev=74630&view=rev > Log: > Support stand alone metadata syntax. > > !0 = constant metadata !{i32 21, i32 22} > @llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0} > > > Added: > llvm/trunk/test/Feature/mdnode2.ll > Modified: > llvm/trunk/lib/AsmParser/LLParser.cpp > llvm/trunk/lib/AsmParser/LLParser.h > llvm/trunk/lib/VMCore/AsmWriter.cpp > > Modified: llvm/trunk/lib/AsmParser/LLParser.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74630&r1=74629&r2=74630&view=diff > > ============================================================================== > --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) > +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul 1 14:21:12 2009 > @@ -109,6 +109,7 @@ > case lltok::StringConstant: // FIXME: REMOVE IN LLVM 3.0 > case lltok::LocalVar: if (ParseNamedType()) return true; break; > case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break; > + case lltok::Metadata: if (ParseStandaloneMetadata()) return true; break; > > // The Global variable production with no name can have many different > // optional leading prefixes, the production is: > @@ -355,6 +356,34 @@ > return ParseAlias(Name, NameLoc, Visibility); > } > > +/// ParseStandaloneMetadata: > +/// !42 = !{...} > +bool LLParser::ParseStandaloneMetadata() { > + assert(Lex.getKind() == lltok::Metadata); > + Lex.Lex(); > + unsigned MetadataID = 0; > + if (ParseUInt32(MetadataID)) > + return true; > + if (MetadataCache.find(MetadataID) != MetadataCache.end()) > + return TokError("Metadata id is already used"); > + if (ParseToken(lltok::equal, "expected '=' here")) > + return true; > + > + LocTy TyLoc; > + bool IsConstant; > + PATypeHolder Ty(Type::VoidTy); > + if (ParseGlobalType(IsConstant) || > + ParseType(Ty, TyLoc)) > + return true; > + > + Constant *Init = 0; > + if (ParseGlobalValue(Ty, Init)) > + return true; > + > + MetadataCache[MetadataID] = Init; > + return false; > +} > + > /// ParseAlias: > /// ::= GlobalVar '=' OptionalVisibility 'alias' OptionalLinkage Aliasee > /// Aliasee > @@ -1596,6 +1625,17 @@ > return false; > } > > + // Standalone metadata reference > + // !{ ..., !42, ... } > + unsigned MID = 0; > + if (!ParseUInt32(MID)) { > + std::map::iterator I = MetadataCache.find(MID); > + if (I == MetadataCache.end()) > + return TokError("Unknown metadata reference"); > + ID.ConstantVal = I->second; > + return false; > + } > + > // MDString: > // ::= '!' STRINGCONSTANT > std::string Str; > > Modified: llvm/trunk/lib/AsmParser/LLParser.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=74630&r1=74629&r2=74630&view=diff > > ============================================================================== > --- llvm/trunk/lib/AsmParser/LLParser.h (original) > +++ llvm/trunk/lib/AsmParser/LLParser.h Wed Jul 1 14:21:12 2009 > @@ -43,7 +43,8 @@ > std::map > ForwardRefTypes; > std::map > ForwardRefTypeIDs; > std::vector NumberedTypes; > - > + /// MetadataCache - This map keeps track of parsed metadata constants. > + std::map MetadataCache; > struct UpRefRecord { > /// Loc - This is the location of the upref. > LocTy Loc; > @@ -139,6 +140,7 @@ > bool ParseGlobal(const std::string &Name, LocTy Loc, unsigned Linkage, > bool HasLinkage, unsigned Visibility); > bool ParseAlias(const std::string &Name, LocTy Loc, unsigned Visibility); > + bool ParseStandaloneMetadata(); > > // Type Parsing. > bool ParseType(PATypeHolder &Result, bool AllowVoid = false); > > Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=74630&r1=74629&r2=74630&view=diff > > ============================================================================== > --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) > +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Jul 1 14:21:12 2009 > @@ -35,6 +35,7 @@ > #include "llvm/Support/raw_ostream.h" > #include > #include > +#include > using namespace llvm; > > // Make virtual table appear in this compilation unit. > @@ -945,25 +946,6 @@ > return; > } > > - if (const MDNode *N = dyn_cast(CV)) { > - Out << "!{"; > - for (MDNode::const_elem_iterator I = N->elem_begin(), E = N->elem_end(); > - I != E;) { > - if (!*I) { > - Out << "null"; > - } else { > - TypePrinter.print((*I)->getType(), Out); > - Out << ' '; > - WriteAsOperandInternal(Out, *I, TypePrinter, Machine); > - } > - > - if (++I != E) > - Out << ", "; > - } > - Out << "}"; > - return; > - } > - > if (const ConstantExpr *CE = dyn_cast(CV)) { > Out << CE->getOpcodeName(); > if (CE->isCompare()) > @@ -1092,10 +1074,14 @@ > TypePrinting TypePrinter; > AssemblyAnnotationWriter *AnnotationWriter; > std::vector NumberedTypes; > + > + // Each MDNode is assigned unique MetadataIDNo. > + std::map MDNodes; > + unsigned MetadataIDNo; > public: > inline AssemblyWriter(raw_ostream &o, SlotTracker &Mac, const Module *M, > AssemblyAnnotationWriter *AAW) > - : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) { > + : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW), MetadataIDNo(0) { > AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M); > } > > @@ -1124,6 +1110,7 @@ > void printModule(const Module *M); > void printTypeSymbolTable(const TypeSymbolTable &ST); > void printGlobal(const GlobalVariable *GV); > + void printMDNode(const MDNode *Node, bool StandAlone); > void printAlias(const GlobalAlias *GV); > void printFunction(const Function *F); > void printArgument(const Argument *FA, Attributes Attrs); > @@ -1264,6 +1251,28 @@ > } > > void AssemblyWriter::printGlobal(const GlobalVariable *GV) { > + if (GV->hasInitializer()) > + // If GV is initialized using Metadata then separate out metadata > + // operands used by the initializer. Note, MDNodes are not cyclic. > + if (MDNode *N = dyn_cast(GV->getInitializer())) { > + SmallVector WorkList; > + // Collect MDNodes used by the initializer. > + for (MDNode::const_elem_iterator I = N->elem_begin(), E = N->elem_end(); > + I != E; ++I) { > + const Value *TV = *I; > + if (TV) > + if (const MDNode *NN = dyn_cast(TV)) > + WorkList.push_back(NN); > + } > + > + // Print MDNodes used by the initializer. > + while (!WorkList.empty()) { > + const MDNode *N = WorkList.back(); WorkList.pop_back(); > + printMDNode(N, true); > + Out << '\n'; > + } > + } > + > if (GV->hasName()) { > PrintLLVMName(Out, GV); > Out << " = "; > @@ -1283,7 +1292,10 @@ > > if (GV->hasInitializer()) { > Out << ' '; > - writeOperand(GV->getInitializer(), false); > + if (MDNode *N = dyn_cast(GV->getInitializer())) > + printMDNode(N, false); > + else > + writeOperand(GV->getInitializer(), false); > } > > if (GV->hasSection()) > @@ -1295,6 +1307,42 @@ > Out << '\n'; > } > > +void AssemblyWriter::printMDNode(const MDNode *Node, > + bool StandAlone) { > + std::map::iterator MI = MDNodes.find(Node); > + // If this node is already printed then just refer it using its Metadata > + // id number. > + if (MI != MDNodes.end()) { > + Out << "metadata !" << MI->second; > + return; > + } > + > + if (StandAlone) { > + // Print standalone MDNode. > + // !42 = !{ ... } > + Out << "!" << MetadataIDNo << " = "; > + Out << "constant metadata "; > + } > + Out << "!{"; > + for (MDNode::const_elem_iterator I = Node->elem_begin(), E = Node->elem_end(); > + I != E;) { > + const Value *TV = *I; > + if (!TV) > + Out << "null"; > + else if (const MDNode *N = dyn_cast(TV)) > + printMDNode(N, StandAlone); > + else if (!*I) > + Out << "null"; > + else > + writeOperand(*I, true); > + if (++I != E) > + Out << ", "; > + } > + Out << "}"; > + > + MDNodes[Node] = MetadataIDNo++; > +} > + > void AssemblyWriter::printAlias(const GlobalAlias *GA) { > // Don't crash when dumping partially built GA > if (!GA->hasName()) > > Added: llvm/trunk/test/Feature/mdnode2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/mdnode2.ll?rev=74630&view=auto > > ============================================================================== > --- llvm/trunk/test/Feature/mdnode2.ll (added) > +++ llvm/trunk/test/Feature/mdnode2.ll Wed Jul 1 14:21:12 2009 > @@ -0,0 +1,7 @@ > +; RUN: llvm-as < %s | llvm-dis > %t.ll > +; RUN: grep "!0 = constant metadata !{i32 21, i32 22}" %t.ll > +; RUN: grep "!1 = constant metadata !{i32 23, i32 24}" %t.ll > +; RUN: grep "@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !1, metadata !0}" %t.ll > +!0 = constant metadata !{i32 21, i32 22} > +!1 = constant metadata !{i32 23, i32 24} > + at llvm.blah = constant metadata !{i32 1000, i16 200, metadata !1, metadata !0} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From sabre at nondot.org Wed Jul 1 23:22:02 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 04:22:02 -0000 Subject: [llvm-commits] [llvm] r74691 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-gv.ll Message-ID: <200907020422.n624M35N005163@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 1 23:22:01 2009 New Revision: 74691 URL: http://llvm.org/viewvc/llvm-project?rev=74691&view=rev Log: @GOTPCREL is also rip-relative. Fix fast-isel to do the right thing. This fixes an llvm-gcc bootstrap problem I introduced. Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=74691&r1=74690&r2=74691&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Wed Jul 1 23:22:01 2009 @@ -478,8 +478,10 @@ Opc = X86::MOV64rm; RC = X86::GR64RegisterClass; - if (TM.getRelocationModel() != Reloc::Static) + if (TM.getRelocationModel() != Reloc::Static) { StubAM.GVOpFlags = X86II::MO_GOTPCREL; + StubAM.Base.Reg = X86::RIP; + } } unsigned ResultReg = createResultReg(RC); Modified: llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll?rev=74691&r1=74690&r2=74691&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll (original) +++ llvm/trunk/test/CodeGen/X86/fast-isel-gv.ll Wed Jul 1 23:22:01 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -fast-isel | grep {_kill at GOTPCREL} +; RUN: llvm-as < %s | llc -fast-isel | grep {_kill at GOTPCREL(%rip)} target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-apple-darwin10.0" @f = global i8 (...)* @kill ; [#uses=1] From deeppatel1987 at gmail.com Thu Jul 2 01:06:30 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Wed, 1 Jul 2009 23:06:30 -0700 Subject: [llvm-commits] [llvm] r74608 - /llvm/trunk/lib/Support/SystemUtils.cpp In-Reply-To: References: <200907011526.n61FQXME012202@zion.cs.uiuc.edu> Message-ID: <305d6f60907012306m28aaa929la7aabe80aaaca46b@mail.gmail.com> On Wed, Jul 1, 2009 at 8:55 AM, Misha Brukman wrote: > 2009/7/1 Daniel Dunbar >> >> + ?// Otherwise check the directory that the calling program is in. ?We >> can do >> + ?// this if ProgramPath contains at least one / character, indicating >> that it >> + ?// is a relative path to bugpoint itself. > > Why is this referring to bugpoint specifically? ?This is a generic system > library, not bugpoint-specific. > Did you mean "binary"? It's probably because Viktor is working on improvements to bugpoint. Perhaps this could read "the executable" instead. deep From vkutuzov at accesssoftek.com Thu Jul 2 01:10:37 2009 From: vkutuzov at accesssoftek.com (Viktor Kutuzov) Date: Wed, 1 Jul 2009 23:10:37 -0700 Subject: [llvm-commits] [llvm] r74608 -/llvm/trunk/lib/Support/SystemUtils.cpp References: <200907011526.n61FQXME012202@zion.cs.uiuc.edu> <305d6f60907012306m28aaa929la7aabe80aaaca46b@mail.gmail.com> Message-ID: <0612312139B44A32AE41FB5CB0B692F2@andreic6e7fe55> Not mine. :) It was historically there. I guess these kind of helpers came from bugpoint needs or has been re-factored from there. Anyway, I'll change this comment and will include it in my next patch. Best regards, Viktor ----- Original Message ----- From: "Sandeep Patel" To: "Commit Messages and Patches for LLVM" Sent: Wednesday, July 01, 2009 11:06 PM Subject: Re: [llvm-commits] [llvm] r74608 -/llvm/trunk/lib/Support/SystemUtils.cpp On Wed, Jul 1, 2009 at 8:55 AM, Misha Brukman wrote: > 2009/7/1 Daniel Dunbar >> >> + // Otherwise check the directory that the calling program is in. We >> can do >> + // this if ProgramPath contains at least one / character, indicating >> that it >> + // is a relative path to bugpoint itself. > > Why is this referring to bugpoint specifically? This is a generic system > library, not bugpoint-specific. > Did you mean "binary"? It's probably because Viktor is working on improvements to bugpoint. Perhaps this could read "the executable" instead. deep _______________________________________________ llvm-commits mailing list llvm-commits at cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From devang.patel at gmail.com Thu Jul 2 01:17:57 2009 From: devang.patel at gmail.com (Devang Patel) Date: Wed, 1 Jul 2009 23:17:57 -0700 Subject: [llvm-commits] [llvm] r74630 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/AsmWriter.cpp test/Feature/mdnode2.ll In-Reply-To: <4A4C3453.6030204@mxc.ca> References: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> <4A4C3453.6030204@mxc.ca> Message-ID: <352a1fb20907012317x2f1200a2g6996c7cfd496b391@mail.gmail.com> On Wed, Jul 1, 2009 at 9:15 PM, Nick Lewycky wrote: > Hi Devang, I have a concern about this patch. > > You're assigning the numbers as you go while printing instead of storing > them as a vector in the Module. This has the exact same behaviour when > you print out the entire module, but I'm worried that if you "cout << > Inst1; cout << Inst2;" where Inst1 and Inst2 both refer to two different > metadata nodes then the numbering will reuse !0. > > If you want to avoid keeping a vector in the Module, I'd like to avoid it, if possible. > the best > thing to do would be to only use numbered metadata when printing the > whole module and otherwise print out the full contents of the metadata node. I think that's what happens. If you have a test case handy, pl. send it to me. - Devang > > That should be pretty easy to verify by adding a unit test to > unittests/VMCore/MetadataTest.cpp. > > Nick > > Devang Patel wrote: >> Author: dpatel >> Date: Wed Jul ?1 14:21:12 2009 >> New Revision: 74630 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74630&view=rev >> Log: >> Support stand alone metadata syntax. >> >> !0 = constant metadata !{i32 21, i32 22} >> @llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0} >> >> >> Added: >> ? ? llvm/trunk/test/Feature/mdnode2.ll >> Modified: >> ? ? llvm/trunk/lib/AsmParser/LLParser.cpp >> ? ? llvm/trunk/lib/AsmParser/LLParser.h >> ? ? llvm/trunk/lib/VMCore/AsmWriter.cpp >> >> Modified: llvm/trunk/lib/AsmParser/LLParser.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74630&r1=74629&r2=74630&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) >> +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul ?1 14:21:12 2009 >> @@ -109,6 +109,7 @@ >> ? ? ?case lltok::StringConstant: // FIXME: REMOVE IN LLVM 3.0 >> ? ? ?case lltok::LocalVar: ? if (ParseNamedType()) return true; break; >> ? ? ?case lltok::GlobalVar: ?if (ParseNamedGlobal()) return true; break; >> + ? ?case lltok::Metadata: ? if (ParseStandaloneMetadata()) return true; break; >> >> ? ? ?// The Global variable production with no name can have many different >> ? ? ?// optional leading prefixes, the production is: >> @@ -355,6 +356,34 @@ >> ? ?return ParseAlias(Name, NameLoc, Visibility); >> ?} >> >> +/// ParseStandaloneMetadata: >> +/// ? !42 = !{...} >> +bool LLParser::ParseStandaloneMetadata() { >> + ?assert(Lex.getKind() == lltok::Metadata); >> + ?Lex.Lex(); >> + ?unsigned MetadataID = 0; >> + ?if (ParseUInt32(MetadataID)) >> + ? ?return true; >> + ?if (MetadataCache.find(MetadataID) != MetadataCache.end()) >> + ? ?return TokError("Metadata id is already used"); >> + ?if (ParseToken(lltok::equal, "expected '=' here")) >> + ? ?return true; >> + >> + ?LocTy TyLoc; >> + ?bool IsConstant; >> + ?PATypeHolder Ty(Type::VoidTy); >> + ?if (ParseGlobalType(IsConstant) || >> + ? ? ?ParseType(Ty, TyLoc)) >> + ? ?return true; >> + >> + ?Constant *Init = 0; >> + ?if (ParseGlobalValue(Ty, Init)) >> + ? ? ?return true; >> + >> + ?MetadataCache[MetadataID] = Init; >> + ?return false; >> +} >> + >> ?/// ParseAlias: >> ?/// ? ::= GlobalVar '=' OptionalVisibility 'alias' OptionalLinkage Aliasee >> ?/// Aliasee >> @@ -1596,6 +1625,17 @@ >> ? ? ? ?return false; >> ? ? ?} >> >> + ? ?// Standalone metadata reference >> + ? ?// !{ ..., !42, ... } >> + ? ?unsigned MID = 0; >> + ? ?if (!ParseUInt32(MID)) { >> + ? ? ?std::map::iterator I = MetadataCache.find(MID); >> + ? ? ?if (I == MetadataCache.end()) >> + ? ? return TokError("Unknown metadata reference"); >> + ? ? ?ID.ConstantVal = I->second; >> + ? ? ?return false; >> + ? ?} >> + >> ? ? ?// MDString: >> ? ? ?// ? ::= '!' STRINGCONSTANT >> ? ? ?std::string Str; >> >> Modified: llvm/trunk/lib/AsmParser/LLParser.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=74630&r1=74629&r2=74630&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/AsmParser/LLParser.h (original) >> +++ llvm/trunk/lib/AsmParser/LLParser.h Wed Jul ?1 14:21:12 2009 >> @@ -43,7 +43,8 @@ >> ? ? ?std::map > ForwardRefTypes; >> ? ? ?std::map > ForwardRefTypeIDs; >> ? ? ?std::vector NumberedTypes; >> - >> + ? ?/// MetadataCache - This map keeps track of parsed metadata constants. >> + ? ?std::map MetadataCache; >> ? ? ?struct UpRefRecord { >> ? ? ? ?/// Loc - This is the location of the upref. >> ? ? ? ?LocTy Loc; >> @@ -139,6 +140,7 @@ >> ? ? ?bool ParseGlobal(const std::string &Name, LocTy Loc, unsigned Linkage, >> ? ? ? ? ? ? ? ? ? ? ? bool HasLinkage, unsigned Visibility); >> ? ? ?bool ParseAlias(const std::string &Name, LocTy Loc, unsigned Visibility); >> + ? ?bool ParseStandaloneMetadata(); >> >> ? ? ?// Type Parsing. >> ? ? ?bool ParseType(PATypeHolder &Result, bool AllowVoid = false); >> >> Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=74630&r1=74629&r2=74630&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) >> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Jul ?1 14:21:12 2009 >> @@ -35,6 +35,7 @@ >> ?#include "llvm/Support/raw_ostream.h" >> ?#include >> ?#include >> +#include >> ?using namespace llvm; >> >> ?// Make virtual table appear in this compilation unit. >> @@ -945,25 +946,6 @@ >> ? ? ?return; >> ? ?} >> >> - ?if (const MDNode *N = dyn_cast(CV)) { >> - ? ?Out << "!{"; >> - ? ?for (MDNode::const_elem_iterator I = N->elem_begin(), E = N->elem_end(); >> - ? ? ? ? I != E;) { >> - ? ? ?if (!*I) { >> - ? ? ? ?Out << "null"; >> - ? ? ?} else { >> - ? ? ? ?TypePrinter.print((*I)->getType(), Out); >> - ? ? ? ?Out << ' '; >> - ? ? ? ?WriteAsOperandInternal(Out, *I, TypePrinter, Machine); >> - ? ? ?} >> - >> - ? ? ?if (++I != E) >> - ? ? ? ?Out << ", "; >> - ? ?} >> - ? ?Out << "}"; >> - ? ?return; >> - ?} >> - >> ? ?if (const ConstantExpr *CE = dyn_cast(CV)) { >> ? ? ?Out << CE->getOpcodeName(); >> ? ? ?if (CE->isCompare()) >> @@ -1092,10 +1074,14 @@ >> ? ?TypePrinting TypePrinter; >> ? ?AssemblyAnnotationWriter *AnnotationWriter; >> ? ?std::vector NumberedTypes; >> + >> + ?// Each MDNode is assigned unique MetadataIDNo. >> + ?std::map MDNodes; >> + ?unsigned MetadataIDNo; >> ?public: >> ? ?inline AssemblyWriter(raw_ostream &o, SlotTracker &Mac, const Module *M, >> ? ? ? ? ? ? ? ? ? ? ? ? ?AssemblyAnnotationWriter *AAW) >> - ? ?: Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) { >> + ? ?: Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW), MetadataIDNo(0) { >> ? ? ?AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M); >> ? ?} >> >> @@ -1124,6 +1110,7 @@ >> ? ?void printModule(const Module *M); >> ? ?void printTypeSymbolTable(const TypeSymbolTable &ST); >> ? ?void printGlobal(const GlobalVariable *GV); >> + ?void printMDNode(const MDNode *Node, bool StandAlone); >> ? ?void printAlias(const GlobalAlias *GV); >> ? ?void printFunction(const Function *F); >> ? ?void printArgument(const Argument *FA, Attributes Attrs); >> @@ -1264,6 +1251,28 @@ >> ?} >> >> ?void AssemblyWriter::printGlobal(const GlobalVariable *GV) { >> + ?if (GV->hasInitializer()) >> + ? ?// If GV is initialized using Metadata then separate out metadata >> + ? ?// operands used by the initializer. Note, MDNodes are not cyclic. >> + ? ?if (MDNode *N = dyn_cast(GV->getInitializer())) { >> + ? ? ?SmallVector WorkList; >> + ? ? ?// Collect MDNodes used by the initializer. >> + ? ? ?for (MDNode::const_elem_iterator I = N->elem_begin(), E = N->elem_end(); >> + ? ? ? ?I != E; ++I) { >> + ? ? const Value *TV = *I; >> + ? ? if (TV) >> + ? ? ? if (const MDNode *NN = dyn_cast(TV)) >> + ? ? ? ? WorkList.push_back(NN); >> + ? ? ?} >> + >> + ? ? ?// Print MDNodes used by the initializer. >> + ? ? ?while (!WorkList.empty()) { >> + ? ? const MDNode *N = WorkList.back(); WorkList.pop_back(); >> + ? ? printMDNode(N, true); >> + ? ? Out << '\n'; >> + ? ? ?} >> + ? ?} >> + >> ? ?if (GV->hasName()) { >> ? ? ?PrintLLVMName(Out, GV); >> ? ? ?Out << " = "; >> @@ -1283,7 +1292,10 @@ >> >> ? ?if (GV->hasInitializer()) { >> ? ? ?Out << ' '; >> - ? ?writeOperand(GV->getInitializer(), false); >> + ? ?if (MDNode *N = dyn_cast(GV->getInitializer())) >> + ? ? ?printMDNode(N, false); >> + ? ?else >> + ? ? ?writeOperand(GV->getInitializer(), false); >> ? ?} >> >> ? ?if (GV->hasSection()) >> @@ -1295,6 +1307,42 @@ >> ? ?Out << '\n'; >> ?} >> >> +void AssemblyWriter::printMDNode(const MDNode *Node, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool StandAlone) { >> + ?std::map::iterator MI = MDNodes.find(Node); >> + ?// If this node is already printed then just refer it using its Metadata >> + ?// id number. >> + ?if (MI != MDNodes.end()) { >> + ? ?Out << "metadata !" << MI->second; >> + ? ?return; >> + ?} >> + >> + ?if (StandAlone) { >> + ? ?// Print standalone MDNode. >> + ? ?// !42 = !{ ... } >> + ? ?Out << "!" << MetadataIDNo << " = "; >> + ? ?Out << "constant metadata "; >> + ?} >> + ?Out << "!{"; >> + ?for (MDNode::const_elem_iterator I = Node->elem_begin(), E = Node->elem_end(); >> + ? ? ? I != E;) { >> + ? ?const Value *TV = *I; >> + ? ?if (!TV) >> + ? ? ?Out << "null"; >> + ? ?else if (const MDNode *N = dyn_cast(TV)) >> + ? ? ?printMDNode(N, StandAlone); >> + ? ?else if (!*I) >> + ? ? ?Out << "null"; >> + ? ?else >> + ? ? ?writeOperand(*I, true); >> + ? ?if (++I != E) >> + ? ? ?Out << ", "; >> + ?} >> + ?Out << "}"; >> + >> + ?MDNodes[Node] = MetadataIDNo++; >> +} >> + >> ?void AssemblyWriter::printAlias(const GlobalAlias *GA) { >> ? ?// Don't crash when dumping partially built GA >> ? ?if (!GA->hasName()) >> >> Added: llvm/trunk/test/Feature/mdnode2.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/mdnode2.ll?rev=74630&view=auto >> >> ============================================================================== >> --- llvm/trunk/test/Feature/mdnode2.ll (added) >> +++ llvm/trunk/test/Feature/mdnode2.ll Wed Jul ?1 14:21:12 2009 >> @@ -0,0 +1,7 @@ >> +; RUN: llvm-as < %s | llvm-dis > %t.ll >> +; RUN: grep "!0 = constant metadata !{i32 21, i32 22}" %t.ll >> +; RUN: grep "!1 = constant metadata !{i32 23, i32 24}" %t.ll >> +; RUN: grep "@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !1, metadata !0}" %t.ll >> +!0 = constant metadata !{i32 21, i32 22} >> +!1 = constant metadata !{i32 23, i32 24} >> + at llvm.blah = constant metadata !{i32 1000, i16 200, metadata !1, metadata !0} >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- - Devang From devang.patel at gmail.com Thu Jul 2 01:18:15 2009 From: devang.patel at gmail.com (Devang Patel) Date: Wed, 1 Jul 2009 23:18:15 -0700 Subject: [llvm-commits] [llvm] r74630 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/AsmWriter.cpp test/Feature/mdnode2.ll In-Reply-To: References: <200907011921.n61JLCfq021170@zion.cs.uiuc.edu> <31D1282E-9B3F-42C5-87B5-32FC0AC7F4E3@apple.com> <352a1fb20907011637x3ef8db68o5e52c778f6e07b58@mail.gmail.com> Message-ID: <352a1fb20907012318g12a9725eke5c739652f4d525e@mail.gmail.com> On Wed, Jul 1, 2009 at 6:19 PM, Chris Lattner wrote: > > On Jul 1, 2009, at 4:37 PM, Devang Patel wrote: > >>> >>> On Jul 1, 2009, at 12:21 PM, Devang Patel wrote: >>> >>>> Author: dpatel >>>> Date: Wed Jul ?1 14:21:12 2009 >>>> New Revision: 74630 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=74630&view=rev >>>> Log: >>>> Support stand alone metadata syntax. >>>> >>>> !0 = constant metadata !{i32 21, i32 22} >>> >>> Why "constant"? >> >> There is no need IMO. What do you say ? > > I think it should just be: !0 = metadata ... ok - Devang From evan.cheng at apple.com Thu Jul 2 01:38:41 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 02 Jul 2009 06:38:41 -0000 Subject: [llvm-commits] [llvm] r74692 - in /llvm/trunk/lib/Target/ARM: ARMInstrFormats.td ARMInstrInfo.td ARMInstrThumb2.td ARMSubtarget.h Message-ID: <200907020638.n626cfGf009021@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jul 2 01:38:40 2009 New Revision: 74692 URL: http://llvm.org/viewvc/llvm-project?rev=74692&view=rev Log: Change the meaning of predicate hasThumb2 to mean thumb2 ISA is available, not that it's in thumb mode and thumb2 is available. Added isThumb2 predicate to replace the old predicate. Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/lib/Target/ARM/ARMSubtarget.h Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=74692&r1=74691&r2=74692&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Thu Jul 2 01:38:40 2009 @@ -823,7 +823,7 @@ let InOperandList = !con(iops, (ops pred:$p)); let AsmString = !strconcat(opc, !strconcat("${p}", asm)); let Pattern = pattern; - list Predicates = [IsThumb, HasThumb2]; + list Predicates = [IsThumb2]; } // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as @@ -838,7 +838,7 @@ let InOperandList = !con(iops, (ops pred:$p, cc_out:$s)); let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm)); let Pattern = pattern; - list Predicates = [IsThumb, HasThumb2]; + list Predicates = [IsThumb2]; } // Special cases @@ -849,7 +849,7 @@ let InOperandList = iops; let AsmString = asm; let Pattern = pattern; - list Predicates = [IsThumb, HasThumb2]; + list Predicates = [IsThumb2]; } class T2I pattern> @@ -875,7 +875,7 @@ // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode. class T2Pat : Pat { - list Predicates = [IsThumb, HasThumb2]; + list Predicates = [IsThumb2]; } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=74692&r1=74691&r2=74692&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Thu Jul 2 01:38:40 2009 @@ -99,7 +99,7 @@ def HasNEON : Predicate<"Subtarget->hasNEON()">; def IsThumb : Predicate<"Subtarget->isThumb()">; def IsThumb1Only : Predicate<"Subtarget->isThumb1Only()">; -def HasThumb2 : Predicate<"Subtarget->hasThumb2()">; +def IsThumb2 : Predicate<"Subtarget->isThumb2()">; def IsARM : Predicate<"!Subtarget->isThumb()">; def IsDarwin : Predicate<"Subtarget->isTargetDarwin()">; def IsNotDarwin : Predicate<"!Subtarget->isTargetDarwin()">; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74692&r1=74691&r2=74692&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Thu Jul 2 01:38:40 2009 @@ -270,32 +270,32 @@ def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), opc, " $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUnused]>; + Requires<[IsThumb2, CarryDefIsUnused]>; // register def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), opc, " $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUnused]> { + Requires<[IsThumb2, CarryDefIsUnused]> { let isCommutable = Commutable; } // shifted register def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), opc, " $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUnused]>; + Requires<[IsThumb2, CarryDefIsUnused]>; // Carry setting variants // shifted imm def Sri : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), !strconcat(opc, "s $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUsed]> { + Requires<[IsThumb2, CarryDefIsUsed]> { let Defs = [CPSR]; } // register def Srr : T2XI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), !strconcat(opc, "s $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUsed]> { + Requires<[IsThumb2, CarryDefIsUsed]> { let Defs = [CPSR]; let isCommutable = Commutable; } @@ -303,7 +303,7 @@ def Srs : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), !strconcat(opc, "s $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUsed]> { + Requires<[IsThumb2, CarryDefIsUsed]> { let Defs = [CPSR]; } } @@ -318,24 +318,24 @@ def ri : T2sI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs), opc, " $dst, $rhs, $lhs", [(set GPR:$dst, (opnode t2_so_imm:$lhs, GPR:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUnused]>; + Requires<[IsThumb2, CarryDefIsUnused]>; // shifted register def rs : T2sI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs), opc, " $dst, $rhs, $lhs", [(set GPR:$dst, (opnode t2_so_reg:$lhs, GPR:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUnused]>; + Requires<[IsThumb2, CarryDefIsUnused]>; // shifted imm def Sri : T2XI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs), !strconcat(opc, "s $dst, $rhs, $lhs"), [(set GPR:$dst, (opnode t2_so_imm:$lhs, GPR:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUsed]> { + Requires<[IsThumb2, CarryDefIsUsed]> { let Defs = [CPSR]; } // shifted register def Srs : T2XI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs), !strconcat(opc, "s $dst, $rhs, $lhs"), [(set GPR:$dst, (opnode t2_so_reg:$lhs, GPR:$rhs))]>, - Requires<[IsThumb, HasThumb2, CarryDefIsUsed]> { + Requires<[IsThumb2, CarryDefIsUsed]> { let Defs = [CPSR]; } } Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=74692&r1=74691&r2=74692&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Thu Jul 2 01:38:40 2009 @@ -108,7 +108,8 @@ bool isThumb() const { return IsThumb; } bool isThumb1Only() const { return IsThumb && (ThumbMode == Thumb1); } - bool hasThumb2() const { return IsThumb && (ThumbMode >= Thumb2); } + bool isThumb2() const { return IsThumb && (ThumbMode >= Thumb2); } + bool hasThumb2() const { return ThumbMode >= Thumb2; } bool isR9Reserved() const { return IsR9Reserved; } From isanbard at gmail.com Thu Jul 2 01:38:40 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 1 Jul 2009 23:38:40 -0700 Subject: [llvm-commits] [llvm] r74624 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/ In-Reply-To: References: <6a8523d60907011840k41d8459cxad55aab6122bf0f9@mail.gmail.com> Message-ID: <252DA4B8-51A5-406E-B3DA-12D84EDBF064@gmail.com> On Jul 1, 2009, at 8:18 PM, Chris Lattner wrote: > On Jul 1, 2009, at 6:40 PM, Daniel Dunbar wrote: > >> I probably missed the backstory here, but wouldn't it be better for >> us >> to consistently use byte alignment? >> >> Some contexts will always need non-power of two alignment, and I >> think >> there is value in standardizing on one form. The situation now is we >> have code like TargetData::get...Alignment which returns bytes, and >> MachineFunction::get...Alignment which returns log2. Alternately we >> could include Log2 in the name... > > I vote for keeping it in log2 and standardizing on log2 form. The > reason is that it takes less space to represent, it is impossible to > store something that is not a pow2, and it is cheaper to convert from > log2 -> bytes than from bytes->log2. > I vote for whatever causes me the least amount of work. :-) Just kidding. I would love to have it standardized. And I agree with Chris's assessment. Going from log2 to bytes is much easier. -bw From evan.cheng at apple.com Thu Jul 2 01:44:41 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 02 Jul 2009 06:44:41 -0000 Subject: [llvm-commits] [llvm] r74693 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200907020644.n626if0Q009237@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jul 2 01:44:30 2009 New Revision: 74693 URL: http://llvm.org/viewvc/llvm-project?rev=74693&view=rev Log: 80 col violation. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=74693&r1=74692&r2=74693&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Thu Jul 2 01:44:30 2009 @@ -3004,8 +3004,8 @@ return false; bool isInc; - bool isLegal = getIndexedAddressParts(Ptr.getNode(), VT, isSEXTLoad, Base, Offset, - isInc, DAG); + bool isLegal = getIndexedAddressParts(Ptr.getNode(), VT, isSEXTLoad, Base, + Offset, isInc, DAG); if (isLegal) { AM = isInc ? ISD::PRE_INC : ISD::PRE_DEC; return true; From tilmann.scheller at googlemail.com Thu Jul 2 02:12:43 2009 From: tilmann.scheller at googlemail.com (Tilmann Scheller) Date: Thu, 2 Jul 2009 09:12:43 +0200 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> Message-ID: Hi Dale, On Wed, Jul 1, 2009 at 11:26 PM, Dale Johannesen wrote: > OK, I've looked these over. ?They do not break any of the compatibility > tests on Darwin, and I'm pretty sure none of the code changes will break > Darwin. ?I haven't looked over the SVR4-specific bits too carefully, but > didn't see anything obviously wrong. ?PPCCallingConv.td and > PPCRegisterInfo.td say they have no newline at EOF, please fix those. Ok > One thing I'm concerned about is that you're replacing the existing "ELF" > ABI with the "SVR4" ABI. ?They seem to be different in a few areas, like > callee-saved register usage. ?Are you sure it is OK to destroy the older > one? ?It looks to me like somebody familiar with a spec had set up the > register usage to be correct for their "ELF" target. ?Nicolas Geoffray seems > to have done most of what I'm talking about, so I think he should comment. > ?I think these might need to coexist as subdivisions of "elf", as on x86-32. Actually the old ELF ABI already was the SVR4 ABI, as mentioned by Nicolas in http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-February/007911.html All differences are due to missing or incorrect things in the original implementation. As ELF is not really an ABI but an object file format and there are other ELF-based ABIs for PowerPC, like the EABI or the AIX ABI for linux/ppc64, I did the rename from ELF to SVR4 to make this clear. Just to be sure, did you take a look at the llvm-gcc patch as well? Thanks for the fast review! Greetings, Tilmann From resistor at mac.com Thu Jul 2 02:17:58 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 07:17:58 -0000 Subject: [llvm-commits] [llvm] r74694 - in /llvm/trunk: include/llvm-c/BitReader.h include/llvm-c/Core.h lib/Bitcode/Reader/BitReader.cpp lib/VMCore/Core.cpp Message-ID: <200907020717.n627Hwoe010377@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 02:17:57 2009 New Revision: 74694 URL: http://llvm.org/viewvc/llvm-project?rev=74694&view=rev Log: Restore other bits of the C API that I tore up. All pre-existing APIs default to using the default global context, while new *InContext() APIs have been added that take a LLVMContextRef parameter. Apologies to anyone affected by this breakage. Modified: llvm/trunk/include/llvm-c/BitReader.h llvm/trunk/include/llvm-c/Core.h llvm/trunk/lib/Bitcode/Reader/BitReader.cpp llvm/trunk/lib/VMCore/Core.cpp Modified: llvm/trunk/include/llvm-c/BitReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/BitReader.h?rev=74694&r1=74693&r2=74694&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/BitReader.h (original) +++ llvm/trunk/include/llvm-c/BitReader.h Thu Jul 2 02:17:57 2009 @@ -29,17 +29,25 @@ /* Builds a module from the bitcode in the specified memory buffer, returning a reference to the module via the OutModule parameter. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ -int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMContextRef ContextRef, +int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, char **OutMessage); +int LLVMParseBitcodeInContext(LLVMMemoryBufferRef MemBuf, + LLVMContextRef ContextRef, + LLVMModuleRef *OutModule, char **OutMessage); + /* Reads a module from the specified path, returning via the OutMP parameter a module provider which performs lazy deserialization. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, - LLVMContextRef ContextRef, LLVMModuleProviderRef *OutMP, char **OutMessage); +int LLVMGetBitcodeModuleProviderInContext(LLVMMemoryBufferRef MemBuf, + LLVMContextRef ContextRef, + LLVMModuleProviderRef *OutMP, + char **OutMessage); + #ifdef __cplusplus } Modified: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=74694&r1=74693&r2=74694&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (original) +++ llvm/trunk/include/llvm-c/Core.h Thu Jul 2 02:17:57 2009 @@ -201,6 +201,8 @@ /* Create and destroy modules. */ /** See llvm::Module::Module. */ LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID); +LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, + LLVMContextRef C); /** See llvm::Module::~Module. */ void LLVMDisposeModule(LLVMModuleRef M); Modified: llvm/trunk/lib/Bitcode/Reader/BitReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitReader.cpp?rev=74694&r1=74693&r2=74694&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Thu Jul 2 02:17:57 2009 @@ -9,6 +9,7 @@ #include "llvm-c/BitReader.h" #include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/LLVMContext.h" #include "llvm/Support/MemoryBuffer.h" #include #include @@ -18,10 +19,26 @@ /* Builds a module from the bitcode in the specified memory buffer, returning a reference to the module via the OutModule parameter. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ -int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMContextRef ContextRef, +int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, char **OutMessage) { std::string Message; + *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), getGlobalContext(), + &Message)); + if (!*OutModule) { + if (OutMessage) + *OutMessage = strdup(Message.c_str()); + return 1; + } + + return 0; +} + +int LLVMParseBitcodeInContext(LLVMMemoryBufferRef MemBuf, + LLVMContextRef ContextRef, + LLVMModuleRef *OutModule, char **OutMessage) { + std::string Message; + *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), *unwrap(ContextRef), &Message)); if (!*OutModule) { @@ -39,7 +56,25 @@ int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, LLVMContextRef ContextRef, LLVMModuleProviderRef *OutMP, - char **OutMessage) { + char **OutMessage) { + std::string Message; + + *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), getGlobalContext(), + &Message)); + + if (!*OutMP) { + if (OutMessage) + *OutMessage = strdup(Message.c_str()); + return 1; + } + + return 0; +} + +int LLVMGetBitcodeModuleProviderInContext(LLVMMemoryBufferRef MemBuf, + LLVMContextRef ContextRef, + LLVMModuleProviderRef *OutMP, + char **OutMessage) { std::string Message; *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), *unwrap(ContextRef), Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=74694&r1=74693&r2=74694&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Thu Jul 2 02:17:57 2009 @@ -56,7 +56,12 @@ /*===-- Operations on modules ---------------------------------------------===*/ -LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID, LLVMContextRef C) { +LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID) { + return wrap(new Module(ModuleID, getGlobalContext())); +} + +LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, + LLVMContextRef C) { return wrap(new Module(ModuleID, *unwrap(C))); } From isanbard at gmail.com Thu Jul 2 02:18:18 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 2 Jul 2009 00:18:18 -0700 Subject: [llvm-commits] [llvm] r74564 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/IA64/ lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/X... In-Reply-To: <67A5DA74-7D6E-44EA-8541-DC57E9A99955@apple.com> References: <200906302238.n5UMcY5I031037@zion.cs.uiuc.edu> <67A5DA74-7D6E-44EA-8541-DC57E9A99955@apple.com> Message-ID: <07C9CA55-791F-48AB-AC67-FA8B2EDF13BD@gmail.com> On Jun 30, 2009, at 10:31 PM, Chris Lattner wrote: > On Jun 30, 2009, at 3:38 PM, Bill Wendling wrote: > >> Author: void >> Date: Tue Jun 30 17:38:32 2009 >> New Revision: 74564 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74564&view=rev >> Log: >> Add an "alignment" field to the MachineFunction object. It makes >> more sense to >> have the alignment be calculated up front, and have the back-ends >> obey whatever >> alignment is decided upon. > > Nice, thank you for doing this Bill. Please document very clearly > in the APIs that the alignment is the log2 of the alignment, not the > alignment in bytes. > I added comments to this affect. Given that people are going to read the method name more than the comments, should I also put Log2 in the name of the methods? I'm not sure if that would be too redundant or superfluous. :-) -bw From resistor at mac.com Thu Jul 2 02:21:49 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 07:21:49 -0000 Subject: [llvm-commits] [llvm] r74695 - /llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Message-ID: <200907020721.n627Lo47010491@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 02:21:49 2009 New Revision: 74695 URL: http://llvm.org/viewvc/llvm-project?rev=74695&view=rev Log: Ack, missed one incompatibility. Modified: llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Modified: llvm/trunk/lib/Bitcode/Reader/BitReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitReader.cpp?rev=74695&r1=74694&r2=74695&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Thu Jul 2 02:21:49 2009 @@ -54,7 +54,6 @@ a module provider which performs lazy deserialization. Returns 0 on success. Optionally returns a human-readable error message via OutMessage. */ int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, - LLVMContextRef ContextRef, LLVMModuleProviderRef *OutMP, char **OutMessage) { std::string Message; From evan.cheng at apple.com Thu Jul 2 02:28:31 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 02 Jul 2009 07:28:31 -0000 Subject: [llvm-commits] [llvm] r74696 - in /llvm/trunk: lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMInstrFormats.td lib/Target/ARM/ARMInstrThumb2.td lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/Thumb2/thumb2-ldr_post.ll test/CodeGen/Thumb2/thumb2-ldr_pre.ll Message-ID: <200907020728.n627SVwA010677@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jul 2 02:28:31 2009 New Revision: 74696 URL: http://llvm.org/viewvc/llvm-project?rev=74696&view=rev Log: Thumb2 pre/post indexed loads. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_post.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_pre.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=74696&r1=74695&r2=74696&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Jul 2 02:28:31 2009 @@ -102,6 +102,8 @@ SDValue &OffImm); bool SelectT2AddrModeImm8(SDValue Op, SDValue N, SDValue &Base, SDValue &OffImm); + bool SelectT2AddrModeImm8Offset(SDValue Op, SDValue N, + SDValue &OffImm); bool SelectT2AddrModeImm8s4(SDValue Op, SDValue N, SDValue &Base, SDValue &OffImm); bool SelectT2AddrModeSoReg(SDValue Op, SDValue N, SDValue &Base, @@ -111,7 +113,11 @@ #include "ARMGenDAGISel.inc" private: + /// SelectARMIndexedLoad - Indexed (pre/post inc/dec) load matching code for + /// ARM. SDNode *SelectARMIndexedLoad(SDValue Op); + SDNode *SelectT2IndexedLoad(SDValue Op); + /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for /// inline asm expressions. @@ -628,6 +634,25 @@ return false; } +bool ARMDAGToDAGISel::SelectT2AddrModeImm8Offset(SDValue Op, SDValue N, + SDValue &OffImm){ + unsigned Opcode = Op.getOpcode(); + ISD::MemIndexedMode AM = (Opcode == ISD::LOAD) + ? cast(Op)->getAddressingMode() + : cast(Op)->getAddressingMode(); + if (ConstantSDNode *RHS = dyn_cast(N)) { + int RHSC = (int)RHS->getZExtValue(); + if (RHSC >= 0 && RHSC < 0x100) { // 8 bits. + OffImm = (AM == ISD::PRE_INC) + ? CurDAG->getTargetConstant(RHSC, MVT::i32) + : CurDAG->getTargetConstant(-RHSC, MVT::i32); + return true; + } + } + + return false; +} + bool ARMDAGToDAGISel::SelectT2AddrModeImm8s4(SDValue Op, SDValue N, SDValue &Base, SDValue &OffImm) { if (N.getOpcode() == ISD::ADD) { @@ -762,6 +787,46 @@ return NULL; } +SDNode *ARMDAGToDAGISel::SelectT2IndexedLoad(SDValue Op) { + LoadSDNode *LD = cast(Op); + ISD::MemIndexedMode AM = LD->getAddressingMode(); + if (AM == ISD::UNINDEXED) + return NULL; + + MVT LoadedVT = LD->getMemoryVT(); + SDValue Offset; + bool isPre = (AM == ISD::PRE_INC) || (AM == ISD::PRE_DEC); + unsigned Opcode = 0; + bool Match = false; + if (SelectT2AddrModeImm8Offset(Op, LD->getOffset(), Offset)) { + switch (LoadedVT.getSimpleVT()) { + case MVT::i32: + Opcode = isPre ? ARM::t2LDR_PRE : ARM::t2LDR_POST; + break; + case MVT::i16: + Opcode = isPre ? ARM::t2LDRH_PRE : ARM::t2LDRH_POST; + break; + case MVT::i8: + Opcode = isPre ? ARM::t2LDRB_PRE : ARM::t2LDRB_POST; + break; + default: + return NULL; + } + Match = true; + } + + if (Match) { + SDValue Chain = LD->getChain(); + SDValue Base = LD->getBasePtr(); + SDValue Ops[]= { Base, Offset, getAL(CurDAG), + CurDAG->getRegister(0, MVT::i32), Chain }; + return CurDAG->getTargetNode(Opcode, Op.getDebugLoc(), MVT::i32, MVT::i32, + MVT::Other, Ops, 5); + } + + return NULL; +} + SDNode *ARMDAGToDAGISel::Select(SDValue Op) { SDNode *N = Op.getNode(); @@ -892,7 +957,11 @@ return CurDAG->getTargetNode(ARM::SMULL, dl, MVT::i32, MVT::i32, Ops, 5); } case ISD::LOAD: { - SDNode *ResNode = SelectARMIndexedLoad(Op); + SDNode *ResNode = 0; + if (Subtarget->isThumb2()) + ResNode = SelectT2IndexedLoad(Op); + else + ResNode = SelectARMIndexedLoad(Op); if (ResNode) return ResNode; // Other cases are autogenerated. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=74696&r1=74695&r2=74696&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Thu Jul 2 02:28:31 2009 @@ -231,16 +231,18 @@ setLoadExtAction(ISD::SEXTLOAD, MVT::i1, Promote); // ARM supports all 4 flavors of integer indexed load / store. - for (unsigned im = (unsigned)ISD::PRE_INC; - im != (unsigned)ISD::LAST_INDEXED_MODE; ++im) { - setIndexedLoadAction(im, MVT::i1, Legal); - setIndexedLoadAction(im, MVT::i8, Legal); - setIndexedLoadAction(im, MVT::i16, Legal); - setIndexedLoadAction(im, MVT::i32, Legal); - setIndexedStoreAction(im, MVT::i1, Legal); - setIndexedStoreAction(im, MVT::i8, Legal); - setIndexedStoreAction(im, MVT::i16, Legal); - setIndexedStoreAction(im, MVT::i32, Legal); + if (!Subtarget->isThumb1Only()) { + for (unsigned im = (unsigned)ISD::PRE_INC; + im != (unsigned)ISD::LAST_INDEXED_MODE; ++im) { + setIndexedLoadAction(im, MVT::i1, Legal); + setIndexedLoadAction(im, MVT::i8, Legal); + setIndexedLoadAction(im, MVT::i16, Legal); + setIndexedLoadAction(im, MVT::i32, Legal); + setIndexedStoreAction(im, MVT::i1, Legal); + setIndexedStoreAction(im, MVT::i8, Legal); + setIndexedStoreAction(im, MVT::i16, Legal); + setIndexedStoreAction(im, MVT::i32, Legal); + } } // i64 operation support. @@ -2923,10 +2925,10 @@ return true; } -static bool getIndexedAddressParts(SDNode *Ptr, MVT VT, - bool isSEXTLoad, SDValue &Base, - SDValue &Offset, bool &isInc, - SelectionDAG &DAG) { +static bool getARMIndexedAddressParts(SDNode *Ptr, MVT VT, + bool isSEXTLoad, SDValue &Base, + SDValue &Offset, bool &isInc, + SelectionDAG &DAG) { if (Ptr->getOpcode() != ISD::ADD && Ptr->getOpcode() != ISD::SUB) return false; @@ -2936,6 +2938,7 @@ if (ConstantSDNode *RHS = dyn_cast(Ptr->getOperand(1))) { int RHSC = (int)RHS->getZExtValue(); if (RHSC < 0 && RHSC > -256) { + assert(Ptr->getOpcode() == ISD::ADD); isInc = false; Offset = DAG.getConstant(-RHSC, RHS->getValueType(0)); return true; @@ -2949,6 +2952,7 @@ if (ConstantSDNode *RHS = dyn_cast(Ptr->getOperand(1))) { int RHSC = (int)RHS->getZExtValue(); if (RHSC < 0 && RHSC > -0x1000) { + assert(Ptr->getOpcode() == ISD::ADD); isInc = false; Offset = DAG.getConstant(-RHSC, RHS->getValueType(0)); Base = Ptr->getOperand(0); @@ -2979,6 +2983,31 @@ return false; } +static bool getT2IndexedAddressParts(SDNode *Ptr, MVT VT, + bool isSEXTLoad, SDValue &Base, + SDValue &Offset, bool &isInc, + SelectionDAG &DAG) { + if (Ptr->getOpcode() != ISD::ADD && Ptr->getOpcode() != ISD::SUB) + return false; + + Base = Ptr->getOperand(0); + if (ConstantSDNode *RHS = dyn_cast(Ptr->getOperand(1))) { + int RHSC = (int)RHS->getZExtValue(); + if (RHSC < 0 && RHSC > -0x100) { // 8 bits. + assert(Ptr->getOpcode() == ISD::ADD); + isInc = false; + Offset = DAG.getConstant(-RHSC, RHS->getValueType(0)); + return true; + } else if (RHSC > 0 && RHSC < 0x100) { // 8 bit, no zero. + isInc = Ptr->getOpcode() == ISD::ADD; + Offset = DAG.getConstant(RHSC, RHS->getValueType(0)); + return true; + } + } + + return false; +} + /// getPreIndexedAddressParts - returns true by value, base pointer and /// offset pointer and addressing mode by reference if the node's address /// can be legally represented as pre-indexed load / store address. @@ -2987,7 +3016,7 @@ SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const { - if (Subtarget->isThumb()) + if (Subtarget->isThumb1Only()) return false; MVT VT; @@ -3004,13 +3033,18 @@ return false; bool isInc; - bool isLegal = getIndexedAddressParts(Ptr.getNode(), VT, isSEXTLoad, Base, + bool isLegal = false; + if (Subtarget->isThumb2()) + isLegal = getT2IndexedAddressParts(Ptr.getNode(), VT, isSEXTLoad, Base, + Offset, isInc, DAG); + else + isLegal = getARMIndexedAddressParts(Ptr.getNode(), VT, isSEXTLoad, Base, Offset, isInc, DAG); - if (isLegal) { - AM = isInc ? ISD::PRE_INC : ISD::PRE_DEC; - return true; - } - return false; + if (!isLegal) + return false; + + AM = isInc ? ISD::PRE_INC : ISD::PRE_DEC; + return true; } /// getPostIndexedAddressParts - returns true by value, base pointer and @@ -3021,7 +3055,7 @@ SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const { - if (Subtarget->isThumb()) + if (Subtarget->isThumb1Only()) return false; MVT VT; @@ -3036,13 +3070,18 @@ return false; bool isInc; - bool isLegal = getIndexedAddressParts(Op, VT, isSEXTLoad, Base, Offset, + bool isLegal = false; + if (Subtarget->isThumb2()) + isLegal = getT2IndexedAddressParts(Op, VT, isSEXTLoad, Base, Offset, isInc, DAG); - if (isLegal) { - AM = isInc ? ISD::POST_INC : ISD::POST_DEC; - return true; - } - return false; + else + isLegal = getARMIndexedAddressParts(Op, VT, isSEXTLoad, Base, Offset, + isInc, DAG); + if (!isLegal) + return false; + + AM = isInc ? ISD::POST_INC : ISD::POST_DEC; + return true; } void ARMTargetLowering::computeMaskedBitsForTargetNode(const SDValue Op, Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=74696&r1=74695&r2=74696&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Thu Jul 2 02:28:31 2009 @@ -873,6 +873,18 @@ class T2JTI pattern> : Thumb2XI; +// T2Iidxldst - Thumb2 indexed load / store instructions. +class T2Iidxldst pattern> + : InstARM { + let OutOperandList = oops; + let InOperandList = !con(iops, (ops pred:$p)); + let AsmString = !strconcat(opc, !strconcat("${p}", asm)); + let Pattern = pattern; + list Predicates = [IsThumb2]; +} + + // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode. class T2Pat : Pat { list Predicates = [IsThumb2]; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=74696&r1=74695&r2=74696&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Thu Jul 2 02:28:31 2009 @@ -89,7 +89,6 @@ return (uint32_t)N->getZExtValue() < 65536; }]>; - /// bf_inv_mask_imm predicate - An AND mask to clear an arbitrary width bitfield /// e.g., 0xf000ffff def bf_inv_mask_imm : Operand, @@ -136,13 +135,17 @@ let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm); } -// t2addrmode_imm8 := reg - imm8 (also reg + imm8 for some instructions) +// t2addrmode_imm8 := reg - imm8 def t2addrmode_imm8 : Operand, ComplexPattern { let PrintMethod = "printT2AddrModeImm8Operand"; let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm); } +def t2am_imm8_offset : Operand { + let PrintMethod = "printT2AddrModeImm8OffsetOperand"; +} + // t2addrmode_imm8s4 := reg + (imm8 << 2) def t2addrmode_imm8s4 : Operand, ComplexPattern { @@ -541,10 +544,45 @@ def : T2Pat<(extloadi16 (ARMWrapper tconstpool:$addr)), (t2LDRHpci tconstpool:$addr)>; +// Indexed loads +def t2LDR_PRE : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), + (ins t2addrmode_imm8:$addr), + AddrModeT2_i8, IndexModePre, + "ldr", " $dst, $addr!", "$addr.base = $base_wb", + []>; + +def t2LDR_POST : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), + (ins GPR:$base, t2am_imm8_offset:$offset), + AddrModeT2_i8, IndexModePost, + "ldr", " $dst, [$base], $offset", "$base = $base_wb", + []>; + +def t2LDRB_PRE : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), + (ins t2addrmode_imm8:$addr), + AddrModeT2_i8, IndexModePre, + "ldrb", " $dst, $addr!", "$addr.base = $base_wb", + []>; +def t2LDRB_POST : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), + (ins GPR:$base, t2am_imm8_offset:$offset), + AddrModeT2_i8, IndexModePost, + "ldrb", " $dst, [$base], $offset", "$base = $base_wb", + []>; + +def t2LDRH_PRE : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), + (ins t2addrmode_imm8:$addr), + AddrModeT2_i8, IndexModePre, + "ldrh", " $dst, $addr!", "$addr.base = $base_wb", + []>; +def t2LDRH_POST : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), + (ins GPR:$base, t2am_imm8_offset:$offset), + AddrModeT2_i8, IndexModePost, + "ldrh", " $dst, [$base], $offset", "$base = $base_wb", + []>; + // Store -defm t2STR : T2I_st<"str", BinOpFrag<(store node:$LHS, node:$RHS)>>; -defm t2STRB : T2I_st<"strb", BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>; -defm t2STRH : T2I_st<"strh", BinOpFrag<(truncstorei16 node:$LHS, node:$RHS)>>; +defm t2STR : T2I_st<"str", BinOpFrag<(store node:$LHS, node:$RHS)>>; +defm t2STRB : T2I_st<"strb", BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>; +defm t2STRH : T2I_st<"strh", BinOpFrag<(truncstorei16 node:$LHS, node:$RHS)>>; // Store doubleword let mayLoad = 1 in Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=74696&r1=74695&r2=74696&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Thu Jul 2 02:28:31 2009 @@ -122,6 +122,7 @@ void printT2SOOperand(const MachineInstr *MI, int OpNum); void printT2AddrModeImm12Operand(const MachineInstr *MI, int OpNum); void printT2AddrModeImm8Operand(const MachineInstr *MI, int OpNum); + void printT2AddrModeImm8OffsetOperand(const MachineInstr *MI, int OpNum); void printT2AddrModeSoRegOperand(const MachineInstr *MI, int OpNum); void printPredicateOperand(const MachineInstr *MI, int OpNum); @@ -747,6 +748,17 @@ O << "]"; } +void ARMAsmPrinter::printT2AddrModeImm8OffsetOperand(const MachineInstr *MI, + int OpNum) { + const MachineOperand &MO1 = MI->getOperand(OpNum); + int32_t OffImm = (int32_t)MO1.getImm(); + // Don't print +0. + if (OffImm < 0) + O << "#-" << -OffImm; + else if (OffImm > 0) + O << "#+" << OffImm; +} + void ARMAsmPrinter::printT2AddrModeSoRegOperand(const MachineInstr *MI, int OpNum) { const MachineOperand &MO1 = MI->getOperand(OpNum); Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_post.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_post.ll?rev=74696&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_post.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_post.ll Thu Jul 2 02:28:31 2009 @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | \ +; RUN: grep {ldr.*\\\[.*\],} | count 1 + +define i32 @test(i32 %a, i32 %b, i32 %c) { + %tmp1 = mul i32 %a, %b ; [#uses=2] + %tmp2 = inttoptr i32 %tmp1 to i32* ; [#uses=1] + %tmp3 = load i32* %tmp2 ; [#uses=1] + %tmp4 = sub i32 %tmp1, 8 ; [#uses=1] + %tmp5 = mul i32 %tmp4, %tmp3 ; [#uses=1] + ret i32 %tmp5 +} + Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_pre.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_pre.ll?rev=74696&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_pre.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr_pre.ll Thu Jul 2 02:28:31 2009 @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | \ +; RUN: grep {ldr.*\\!} | count 2 + +define i32* @test1(i32* %X, i32* %dest) { + %Y = getelementptr i32* %X, i32 4 ; [#uses=2] + %A = load i32* %Y ; [#uses=1] + store i32 %A, i32* %dest + ret i32* %Y +} + +define i32 @test2(i32 %a, i32 %b) { + %tmp1 = sub i32 %a, 64 ; [#uses=2] + %tmp2 = inttoptr i32 %tmp1 to i32* ; [#uses=1] + %tmp3 = load i32* %tmp2 ; [#uses=1] + %tmp4 = sub i32 %tmp1, %b ; [#uses=1] + %tmp5 = add i32 %tmp4, %tmp3 ; [#uses=1] + ret i32 %tmp5 +} + From nicolas.geoffray at lip6.fr Thu Jul 2 03:48:25 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 02 Jul 2009 10:48:25 +0200 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> Message-ID: <4A4C7459.90401@lip6.fr> Tilmann Scheller wrote: > Actually the old ELF ABI already was the SVR4 ABI, as mentioned by > Nicolas in http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-February/007911.html > I concur, naming it ELF was incorrect, and SVR4 should be the right name. I was following the SVR4 ABI when implementing the linux/ppc backend bits. Cheers, Nicolas From howard0su at gmail.com Thu Jul 2 06:35:48 2009 From: howard0su at gmail.com (Howard Su) Date: Thu, 2 Jul 2009 19:35:48 +0800 Subject: [llvm-commits] [llvm] r74621 - in /llvm/trunk: autoconf/configure.ac cmake/config-ix.cmake include/llvm/Config/config.h.cmake include/llvm/System/Errno.h lib/System/CMakeLists.txt lib/System/Errno.cpp lib/System/Unix/Unix.h tools/gold/gold-plugin Message-ID: this break windows build. Please apply the following patch:Index: Errno.cpp =================================================================== --- Errno.cpp (revision 74696) +++ Errno.cpp (working copy) @@ -47,10 +47,10 @@ # else strerror_r(errnum,buffer,MaxErrStrLen-1); # endif -#elif HAVE_STRERROR_S // Windows. +#elif defined(HAVE_STRERROR_S) // Windows. if (errnum) strerror_s(buffer, errnum); -#elif HAVE_STRERROR +#elif defined(HAVE_STRERROR) // Copy the thread un-safe result of strerror into // the buffer as fast as possible to minimize impact // of collision of strerror in multiple threads. On Thu, Jul 2, 2009 at 2:11 AM, Jeffrey Yasskin wrote: > Author: jyasskin > Date: Wed Jul 1 13:11:20 2009 > New Revision: 74621 > > URL: http://llvm.org/viewvc/llvm-project?rev=74621&view=rev > Log: > Add a portable strerror*() wrapper, llvm::sys::StrError(). This includes > the > Windows variant, strerror_s, but I couldn't test that. > > I'll update configure and config.h.in in a subsequent patch. > > Added: > llvm/trunk/include/llvm/System/Errno.h > llvm/trunk/lib/System/Errno.cpp > Modified: > llvm/trunk/autoconf/configure.ac > llvm/trunk/cmake/config-ix.cmake > llvm/trunk/include/llvm/Config/config.h.cmake > llvm/trunk/lib/System/CMakeLists.txt > llvm/trunk/lib/System/Unix/Unix.h > llvm/trunk/tools/gold/gold-plugin.cpp > > Modified: llvm/trunk/autoconf/configure.ac > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=74621&r1=74620&r2=74621&view=diff > > > ============================================================================== > --- llvm/trunk/autoconf/configure.ac (original) > +++ llvm/trunk/autoconf/configure.ac Wed Jul 1 13:11:20 2009 > @@ -914,7 +914,8 @@ > AC_CHECK_FUNCS([powf fmodf strtof round ]) > AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) > AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) > -AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup strerror strerror_r > ]) > +AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup ]) > +AC_CHECK_FUNCS([strerror strerror_r strerror_s ]) > AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) > AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp]) > AC_C_PRINTF_A > > Modified: llvm/trunk/cmake/config-ix.cmake > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=74621&r1=74620&r2=74621&view=diff > > > ============================================================================== > --- llvm/trunk/cmake/config-ix.cmake (original) > +++ llvm/trunk/cmake/config-ix.cmake Wed Jul 1 13:11:20 2009 > @@ -67,6 +67,9 @@ > HAVE_MALLOC_ZONE_STATISTICS) > check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) > check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) > +check_symbol_exists(strerror string.h HAVE_STRERROR) > +check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) > +check_symbol_exists(strerror_s string.h HAVE_STRERROR_S) > > check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) > if( LLVM_USING_GLIBC ) > > Modified: llvm/trunk/include/llvm/Config/config.h.cmake > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=74621&r1=74620&r2=74621&view=diff > > > ============================================================================== > --- llvm/trunk/include/llvm/Config/config.h.cmake (original) > +++ llvm/trunk/include/llvm/Config/config.h.cmake Wed Jul 1 13:11:20 2009 > @@ -364,10 +364,13 @@ > #undef HAVE_STRDUP > > /* Define to 1 if you have the `strerror' function. */ > -#undef HAVE_STRERROR > +#cmakedefine HAVE_STRERROR > > /* Define to 1 if you have the `strerror_r' function. */ > -#undef HAVE_STRERROR_R > +#cmakedefine HAVE_STRERROR_R > + > +/* Define to 1 if you have the `strerror_s' function. */ > +#cmakedefine HAVE_STRERROR_S > > /* Define to 1 if you have the header file. */ > #undef HAVE_STRINGS_H > > Added: llvm/trunk/include/llvm/System/Errno.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Errno.h?rev=74621&view=auto > > > ============================================================================== > --- llvm/trunk/include/llvm/System/Errno.h (added) > +++ llvm/trunk/include/llvm/System/Errno.h Wed Jul 1 13:11:20 2009 > @@ -0,0 +1,34 @@ > +//===- llvm/System/Errno.h - Portable+convenient errno handling -*- C++ > -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > > +//===----------------------------------------------------------------------===// > +// > +// This file declares some portable and convenient functions to deal with > errno. > +// > > +//===----------------------------------------------------------------------===// > + > +#ifndef LLVM_SYSTEM_ERRNO_H > +#define LLVM_SYSTEM_ERRNO_H > + > +#include > + > +namespace llvm { > +namespace sys { > + > +/// Returns a string representation of the errno value, using whatever > +/// thread-safe variant of strerror() is available. Be sure to call this > +/// immediately after the function that set errno, or errno may have been > +/// overwritten by an intervening call. > +std::string StrError(); > + > +/// Like the no-argument version above, but uses \p errnum instead of > errno. > +std::string StrError(int errnum); > + > +} // namespace sys > +} // namespace llvm > + > +#endif // LLVM_SYSTEM_ERRNO_H > > Modified: llvm/trunk/lib/System/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/CMakeLists.txt?rev=74621&r1=74620&r2=74621&view=diff > > > ============================================================================== > --- llvm/trunk/lib/System/CMakeLists.txt (original) > +++ llvm/trunk/lib/System/CMakeLists.txt Wed Jul 1 13:11:20 2009 > @@ -3,6 +3,7 @@ > Atomic.cpp > Disassembler.cpp > DynamicLibrary.cpp > + Errno.cpp > Host.cpp > IncludeFile.cpp > Memory.cpp > > Added: llvm/trunk/lib/System/Errno.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Errno.cpp?rev=74621&view=auto > > > ============================================================================== > --- llvm/trunk/lib/System/Errno.cpp (added) > +++ llvm/trunk/lib/System/Errno.cpp Wed Jul 1 13:11:20 2009 > @@ -0,0 +1,71 @@ > +//===- Errno.cpp - errno support --------------------------------*- C++ > -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > > +//===----------------------------------------------------------------------===// > +// > +// This file implements the errno wrappers. > +// > > +//===----------------------------------------------------------------------===// > + > +#include "llvm/System/Errno.h" > +#include "llvm/Config/config.h" // Get autoconf configuration settings > + > +#if HAVE_STRING_H > +#include > + > > +//===----------------------------------------------------------------------===// > +//=== WARNING: Implementation here must contain only TRULY operating > system > +//=== independent code. > > +//===----------------------------------------------------------------------===// > + > +namespace llvm { > +namespace sys { > + > +#if HAVE_ERRNO_H > +#include > +std::string StrError() { > + return StrError(errno); > +} > +#endif // HAVE_ERRNO_H > + > +std::string StrError(int errnum) { > + const int MaxErrStrLen = 2000; > + char buffer[MaxErrStrLen]; > + buffer[0] = '\0'; > + char* str = buffer; > +#ifdef HAVE_STRERROR_R > + // strerror_r is thread-safe. > + if (errnum) > +# if defined(__GLIBC__) && defined(_GNU_SOURCE) > + // glibc defines its own incompatible version of strerror_r > + // which may not use the buffer supplied. > + str = strerror_r(errnum,buffer,MaxErrStrLen-1); > +# else > + strerror_r(errnum,buffer,MaxErrStrLen-1); > +# endif > +#elif HAVE_STRERROR_S // Windows. > + if (errnum) > + strerror_s(buffer, errnum); > +#elif HAVE_STRERROR > + // Copy the thread un-safe result of strerror into > + // the buffer as fast as possible to minimize impact > + // of collision of strerror in multiple threads. > + if (errnum) > + strncpy(buffer,strerror(errnum),MaxErrStrLen-1); > + buffer[MaxErrStrLen-1] = '\0'; > +#else > + // Strange that this system doesn't even have strerror > + // but, oh well, just use a generic message > + sprintf(buffer, "Error #%d", errnum); > +#endif > + return str; > +} > + > +} // namespace sys > +} // namespace llvm > + > +#endif // HAVE_STRING_H > > Modified: llvm/trunk/lib/System/Unix/Unix.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Unix.h?rev=74621&r1=74620&r2=74621&view=diff > > > ============================================================================== > --- llvm/trunk/lib/System/Unix/Unix.h (original) > +++ llvm/trunk/lib/System/Unix/Unix.h Wed Jul 1 13:11:20 2009 > @@ -20,6 +20,7 @@ > > //===----------------------------------------------------------------------===// > > #include "llvm/Config/config.h" // Get autoconf configuration settings > +#include "llvm/System/Errno.h" > #include > #include > #include > @@ -77,34 +78,9 @@ > std::string* ErrMsg, const std::string& prefix, int errnum = -1) { > if (!ErrMsg) > return true; > - char buffer[MAXPATHLEN]; > - buffer[0] = 0; > - char* str = buffer; > if (errnum == -1) > errnum = errno; > -#ifdef HAVE_STRERROR_R > - // strerror_r is thread-safe. > - if (errnum) > -# if defined(__GLIBC__) && defined(_GNU_SOURCE) > - // glibc defines its own incompatible version of strerror_r > - // which may not use the buffer supplied. > - str = strerror_r(errnum,buffer,MAXPATHLEN-1); > -# else > - strerror_r(errnum,buffer,MAXPATHLEN-1); > -# endif > -#elif HAVE_STRERROR > - // Copy the thread un-safe result of strerror into > - // the buffer as fast as possible to minimize impact > - // of collision of strerror in multiple threads. > - if (errnum) > - strncpy(buffer,strerror(errnum),MAXPATHLEN-1); > - buffer[MAXPATHLEN-1] = 0; > -#else > - // Strange that this system doesn't even have strerror > - // but, oh well, just use a generic message > - sprintf(buffer, "Error #%d", errnum); > -#endif > - *ErrMsg = prefix + ": " + str; > + *ErrMsg = prefix + ": " + llvm::sys::StrError(errnum); > return true; > } > > > Modified: llvm/trunk/tools/gold/gold-plugin.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=74621&r1=74620&r2=74621&view=diff > > > ============================================================================== > --- llvm/trunk/tools/gold/gold-plugin.cpp (original) > +++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Jul 1 13:11:20 2009 > @@ -17,6 +17,7 @@ > #include "llvm-c/lto.h" > > #include "llvm/Support/raw_ostream.h" > +#include "llvm/System/Errno.h" > #include "llvm/System/Path.h" > #include "llvm/System/Program.h" > > @@ -183,7 +184,7 @@ > (*message)(LDPL_ERROR, > "Failed to seek to archive member of %s at offset %d: > %s\n", > file->name, > - file->offset, strerror(errno)); > + file->offset, sys::StrError(errno).c_str()); > return LDPS_ERR; > } > buf = malloc(file->filesize); > @@ -198,7 +199,7 @@ > "Failed to read archive member of %s at offset %d: %s\n", > file->name, > file->offset, > - strerror(errno)); > + sys::StrError(errno).c_str()); > free(buf); > return LDPS_ERR; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- -Howard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090702/e89cc312/attachment.html From baldrick at free.fr Thu Jul 2 07:03:41 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 02 Jul 2009 14:03:41 +0200 Subject: [llvm-commits] [llvm] r74624 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/ In-Reply-To: References: <6a8523d60907011840k41d8459cxad55aab6122bf0f9@mail.gmail.com> Message-ID: <4A4CA21D.5030101@free.fr> Hi Chris, > I vote for keeping it in log2 and standardizing on log2 form. The > reason is that it takes less space to represent, it is impossible to > store something that is not a pow2, and it is cheaper to convert from > log2 -> bytes than from bytes->log2. several places already secretly store alignment internally in log2 form, but provide it in bytes to users. I like this scheme. Since alignments are typically only stored once but read many times, I doubt there's any worry about the cost of the initial bytes -> log2 conversion when the alignment is first initialized. Ciao, Duncan. From baldrick at free.fr Thu Jul 2 07:03:46 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 02 Jul 2009 14:03:46 +0200 Subject: [llvm-commits] [llvm] r74680 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp In-Reply-To: <200907020115.n621FPlE032298@zion.cs.uiuc.edu> References: <200907020115.n621FPlE032298@zion.cs.uiuc.edu> Message-ID: <4A4CA222.5040108@free.fr> Hi Devang, > + /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug > + /// info intrisic. intrisic -> intrinsic (happens several times). Ciao, Duncan. From baldrick at free.fr Thu Jul 2 07:09:59 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 02 Jul 2009 12:09:59 -0000 Subject: [llvm-commits] [llvm] r74697 - /llvm/trunk/lib/System/Errno.cpp Message-ID: <200907021210.n62CA09Z005574@zion.cs.uiuc.edu> Author: baldrick Date: Thu Jul 2 07:09:50 2009 New Revision: 74697 URL: http://llvm.org/viewvc/llvm-project?rev=74697&view=rev Log: Fix windows build, patch by Howard Su. Modified: llvm/trunk/lib/System/Errno.cpp Modified: llvm/trunk/lib/System/Errno.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Errno.cpp?rev=74697&r1=74696&r2=74697&view=diff ============================================================================== --- llvm/trunk/lib/System/Errno.cpp (original) +++ llvm/trunk/lib/System/Errno.cpp Thu Jul 2 07:09:50 2009 @@ -47,10 +47,10 @@ # else strerror_r(errnum,buffer,MaxErrStrLen-1); # endif -#elif HAVE_STRERROR_S // Windows. +#elif defined(HAVE_STRERROR_S) // Windows. if (errnum) strerror_s(buffer, errnum); -#elif HAVE_STRERROR +#elif defined(HAVE_STRERROR) // Copy the thread un-safe result of strerror into // the buffer as fast as possible to minimize impact // of collision of strerror in multiple threads. From sabre at nondot.org Thu Jul 2 10:39:55 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 15:39:55 -0000 Subject: [llvm-commits] [llvm] r74698 - /llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Message-ID: <200907021540.n62Fe0Dm012360@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 10:39:39 2009 New Revision: 74698 URL: http://llvm.org/viewvc/llvm-project?rev=74698&view=rev Log: fix inverted logic pointed out by John McCall, noticed by inspection. This was considering vector intrinsics to have cost 2, but non-vector intrinsics to have cost 1, which is backward. Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=74698&r1=74697&r2=74698&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Thu Jul 2 10:39:39 2009 @@ -207,7 +207,7 @@ if (const CallInst *CI = dyn_cast(I)) { if (!isa(CI)) Size += 3; - else if (isa(CI->getType())) + else if (!isa(CI->getType())) Size += 1; } } From sabre at nondot.org Thu Jul 2 11:04:11 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 16:04:11 -0000 Subject: [llvm-commits] [llvm] r74699 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll Message-ID: <200907021604.n62G4CS1013131@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 11:04:08 2009 New Revision: 74699 URL: http://llvm.org/viewvc/llvm-project?rev=74699&view=rev Log: do not try to analyze bitcasts from i64 to <2 x i32> in ComputedMaskedBits. While we could do this, doing so requires adjusting the demanded mask and the code isn't doing that yet. This fixes PR4495 Added: llvm/trunk/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=74699&r1=74698&r2=74699&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Thu Jul 2 11:04:08 2009 @@ -249,7 +249,10 @@ } case Instruction::BitCast: { const Type *SrcTy = I->getOperand(0)->getType(); - if (SrcTy->isInteger() || isa(SrcTy)) { + if ((SrcTy->isInteger() || isa(SrcTy)) && + // TODO: For now, not handling conversions like: + // (bitcast i64 %x to <2 x i32>) + !isa(I->getType())) { ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, TD, Depth+1); return; Added: llvm/trunk/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll?rev=74699&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll Thu Jul 2 11:04:08 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; PR4495 + +define i32 @test(i64 %test) { +entry: + %0 = bitcast <4 x i32> undef to <16 x i8> ; <<16 x i8>> [#uses=1] + %t12 = shufflevector <16 x i8> %0, <16 x i8> zeroinitializer, <16 x i32> ; <<16 x i8>> [#uses=1] + %t11 = bitcast <16 x i8> %t12 to <2 x i64> ; <<2 x i64>> [#uses=1] + %t9 = extractelement <2 x i64> %t11, i32 0 ; [#uses=1] + %t10 = bitcast i64 %t9 to <2 x i32> ; <<2 x i32>> [#uses=1] + %t7 = bitcast i64 %test to <2 x i32> ; <<2 x i32>> [#uses=1] + %t6 = xor <2 x i32> %t10, %t7 ; <<2 x i32>> [#uses=1] + %t1 = extractelement <2 x i32> %t6, i32 0 ; [#uses=1] + ret i32 %t1 +} From clattner at apple.com Thu Jul 2 11:06:21 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 2 Jul 2009 09:06:21 -0700 Subject: [llvm-commits] [llvm] r74564 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/IA64/ lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/X... In-Reply-To: <07C9CA55-791F-48AB-AC67-FA8B2EDF13BD@gmail.com> References: <200906302238.n5UMcY5I031037@zion.cs.uiuc.edu> <67A5DA74-7D6E-44EA-8541-DC57E9A99955@apple.com> <07C9CA55-791F-48AB-AC67-FA8B2EDF13BD@gmail.com> Message-ID: <40A3D7AA-353B-4236-93A5-ADA0C89CC484@apple.com> On Jul 2, 2009, at 12:18 AM, Bill Wendling wrote: >> >> Nice, thank you for doing this Bill. Please document very clearly >> in the APIs that the alignment is the log2 of the alignment, not >> the alignment in bytes. >> > I added comments to this affect. Thanks! > Given that people are going to read the method name more than the > comments, should I also put Log2 in the name of the methods? I'm not > sure if that would be too redundant or superfluous. :-) No, we don't need hungarian notation :) -Chris From sabre at nondot.org Thu Jul 2 11:08:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 16:08:53 -0000 Subject: [llvm-commits] [llvm] r74700 - /llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Message-ID: <200907021608.n62G8rjg013287@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 11:08:53 2009 New Revision: 74700 URL: http://llvm.org/viewvc/llvm-project?rev=74700&view=rev Log: simplify some logic by using isWeakForLinker(). Thanks to Anton for pointing this out. Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=74700&r1=74699&r2=74700&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Thu Jul 2 11:08:53 2009 @@ -188,9 +188,7 @@ if (TM.getRelocationModel() != Reloc::Static) { if (MO.getType() == MachineOperand::MO_GlobalAddress) { GlobalValue *GV = MO.getGlobal(); - if (((GV->isDeclaration() || GV->hasWeakLinkage() || - GV->hasLinkOnceLinkage() || GV->hasCommonLinkage() || - GV->hasAvailableExternallyLinkage()))) { + if (GV->isDeclaration() || GV->isWeakForLinker()) { // Dynamically-resolved functions need a stub for the function. std::string Name = Mang->getValueName(GV); FnStubs.insert(Name); @@ -383,8 +381,7 @@ // External or weakly linked global variables need non-lazily-resolved stubs if (TM.getRelocationModel() != Reloc::Static) { - if (GV->isDeclaration() || GV->isWeakForLinker() || - GV->hasAvailableExternallyLinkage()) { + if (GV->isDeclaration() || GV->isWeakForLinker()) { if (GV->hasHiddenVisibility()) { if (GV->isDeclaration() || GV->hasCommonLinkage() || GV->hasAvailableExternallyLinkage()) { From resistor at mac.com Thu Jul 2 11:48:45 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 16:48:45 -0000 Subject: [llvm-commits] [llvm] r74701 - /llvm/trunk/docs/ReleaseNotes-2.6.html Message-ID: <200907021648.n62GmlXH014576@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 11:48:38 2009 New Revision: 74701 URL: http://llvm.org/viewvc/llvm-project?rev=74701&view=rev Log: Describe the LLVMContext API change. Modified: llvm/trunk/docs/ReleaseNotes-2.6.html Modified: llvm/trunk/docs/ReleaseNotes-2.6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes-2.6.html?rev=74701&r1=74700&r2=74701&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes-2.6.html (original) +++ llvm/trunk/docs/ReleaseNotes-2.6.html Thu Jul 2 11:48:38 2009 @@ -419,7 +419,7 @@

    If you're already an LLVM user or developer with out-of-tree changes based -on LLVM 2.4, this section lists some "gotchas" that you may run into upgrading +on LLVM 2.5, this section lists some "gotchas" that you may run into upgrading from the previous release.

      @@ -433,6 +433,13 @@ API changes are:

        +
      • LLVM's global uniquing tables for Types and Constants have + been privatized into members of an LLVMContext. A number of APIs + now take an LLVMContext as a parameter. To smooth the transition + for clients that will only ever use a single context, the new + getGlobalContext() API can be used to access a default global + context which can be passed in any and all cases where a context is + required.
      • The getABITypeSize methods are now called getAllocSize.
      From resistor at mac.com Thu Jul 2 11:51:52 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 16:51:52 -0000 Subject: [llvm-commits] [llvm] r74702 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp Message-ID: <200907021651.n62Gpqoe014742@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 11:51:51 2009 New Revision: 74702 URL: http://llvm.org/viewvc/llvm-project?rev=74702&view=rev Log: Add accessor for getting UndefValue's. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74702&r1=74701&r2=74702&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Thu Jul 2 11:51:51 2009 @@ -30,6 +30,7 @@ class ConstantArray; class ConstantFP; class ConstantVector; +class UndefValue; class IntegerType; class PointerType; class StructType; @@ -57,6 +58,9 @@ Constant* getNullValue(const Type* Ty); Constant* getAllOnesValue(const Type* Ty); + // UndefValue accessors + UndefValue* getUndef(const Type* Ty); + // ConstantInt accessors ConstantInt* getConstantIntTrue(); ConstantInt* getConstantIntFalse(); Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74702&r1=74701&r2=74702&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Thu Jul 2 11:51:51 2009 @@ -38,6 +38,11 @@ return Constant::getAllOnesValue(Ty); } +// UndefValue accessors. +UndefValue* LLVMContext::getUndef(const Type* Ty) { + return UndefValue::get(Ty); +} + // ConstantInt accessors. ConstantInt* LLVMContext::getConstantIntTrue() { return ConstantInt::getTrue(); From aaronngray.lists at googlemail.com Thu Jul 2 11:57:46 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Thu, 2 Jul 2009 17:57:46 +0100 Subject: [llvm-commits] OT: How do I revert a single revision locally Message-ID: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP> Hi, I cannot seem to find it on the web and I have left my SVN book at home. How do I revert a single revision locally ? Is this possible ? I tried svn revert and svn co but neither seemed to work properly. Aaron From dalej at apple.com Thu Jul 2 11:59:02 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 2 Jul 2009 09:59:02 -0700 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> Message-ID: <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> On Jul 2, 2009, at 12:12 AMPDT, Tilmann Scheller wrote: > Hi Dale, > > On Wed, Jul 1, 2009 at 11:26 PM, Dale Johannesen > wrote: >> OK, I've looked these over. They do not break any of the >> compatibility >> tests on Darwin, and I'm pretty sure none of the code changes will >> break >> Darwin. I haven't looked over the SVR4-specific bits too >> carefully, but >> didn't see anything obviously wrong. PPCCallingConv.td and >> PPCRegisterInfo.td say they have no newline at EOF, please fix those. > Ok > >> One thing I'm concerned about is that you're replacing the existing >> "ELF" >> ABI with the "SVR4" ABI. They seem to be different in a few areas, >> like >> callee-saved register usage. Are you sure it is OK to destroy the >> older >> one? It looks to me like somebody familiar with a spec had set up >> the >> register usage to be correct for their "ELF" target. Nicolas >> Geoffray seems >> to have done most of what I'm talking about, so I think he should >> comment. >> I think these might need to coexist as subdivisions of "elf", as >> on x86-32. > Actually the old ELF ABI already was the SVR4 ABI, as mentioned by > Nicolas in http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-February/007911.html > > All differences are due to missing or incorrect things in the original > implementation. OK. Register usage seemed like a surprising thing to get wrong, but if Nicolas is happy so am I. > As ELF is not really an ABI but an object file format and there are > other ELF-based ABIs for PowerPC, like the EABI or the AIX ABI for > linux/ppc64, I did the rename from ELF to SVR4 to make this clear. Right, I agree that's a good idea. I suspect other ABIs that use ELF will have some things in common with this one, and an ELF abstraction might be useful, but we can leave that for whoever does such a port. > Just to be sure, did you take a look at the llvm-gcc patch as well? Yes I did. Do you have commit access? > Thanks for the fast review! > > Greetings, > > Tilmann > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Thu Jul 2 12:04:11 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 17:04:11 -0000 Subject: [llvm-commits] [llvm] r74703 - in /llvm/trunk/lib/AsmParser: LLParser.cpp LLParser.h Message-ID: <200907021704.n62H4Caw015104@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 12:04:01 2009 New Revision: 74703 URL: http://llvm.org/viewvc/llvm-project?rev=74703&view=rev Log: Use LLVMContext for generating UndefValue constants too! Modified: llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74703&r1=74702&r2=74703&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Jul 2 12:04:01 2009 @@ -1374,8 +1374,8 @@ for (std::map >::iterator I = ForwardRefVals.begin(), E = ForwardRefVals.end(); I != E; ++I) if (!isa(I->second.first)) { - I->second.first->replaceAllUsesWith(UndefValue::get(I->second.first - ->getType())); + I->second.first->replaceAllUsesWith( + P.getContext().getUndef(I->second.first->getType())); delete I->second.first; I->second.first = 0; } @@ -1383,8 +1383,8 @@ for (std::map >::iterator I = ForwardRefValIDs.begin(), E = ForwardRefValIDs.end(); I != E; ++I) if (!isa(I->second.first)) { - I->second.first->replaceAllUsesWith(UndefValue::get(I->second.first - ->getType())); + I->second.first->replaceAllUsesWith( + P.getContext().getUndef(I->second.first->getType())); delete I->second.first; I->second.first = 0; } @@ -2074,12 +2074,12 @@ if ((!Ty->isFirstClassType() || Ty == Type::LabelTy) && !isa(Ty)) return Error(ID.Loc, "invalid type for undef constant"); - V = UndefValue::get(Ty); + V = Context.getUndef(Ty); return false; case ValID::t_EmptyArray: if (!isa(Ty) || cast(Ty)->getNumElements() != 0) return Error(ID.Loc, "invalid empty array initializer"); - V = UndefValue::get(Ty); + V = Context.getUndef(Ty); return false; case ValID::t_Zero: // FIXME: LabelTy should not be a first-class type. @@ -2604,7 +2604,7 @@ RVs.push_back(RV); } - RV = UndefValue::get(PFS.getFunction().getReturnType()); + RV = Context.getUndef(PFS.getFunction().getReturnType()); for (unsigned i = 0, e = RVs.size(); i != e; ++i) { Instruction *I = InsertValueInst::Create(RV, RVs[i], i, "mrv"); BB->getInstList().push_back(I); Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=74703&r1=74702&r2=74703&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Thu Jul 2 12:04:01 2009 @@ -77,6 +77,8 @@ Context(m->getContext()), Lex(F, Err), M(m) {} bool Run(); + LLVMContext& getContext() { return Context; } + private: bool Error(LocTy L, const std::string &Msg) const { From resistor at mac.com Thu Jul 2 12:12:52 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 17:12:52 -0000 Subject: [llvm-commits] [llvm] r74705 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp Message-ID: <200907021712.n62HCr7m015773@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 12:12:48 2009 New Revision: 74705 URL: http://llvm.org/viewvc/llvm-project?rev=74705&view=rev Log: Add accessor for MDNode. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74705&r1=74704&r2=74705&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Thu Jul 2 12:12:48 2009 @@ -31,6 +31,7 @@ class ConstantFP; class ConstantVector; class UndefValue; +class MDNode; class IntegerType; class PointerType; class StructType; @@ -176,6 +177,9 @@ Constant* getConstantVector(Constant* const* Vals, unsigned NumVals); ConstantVector* getConstantVectorAllOnes(const VectorType* Ty); + // MDNode accessors + MDNode* getMDNode(Value* const* Vals, unsigned NumVals); + // FunctionType accessors FunctionType* getFunctionType(const Type* Result, const std::vector& Params, Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74705&r1=74704&r2=74705&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Thu Jul 2 12:12:48 2009 @@ -15,6 +15,7 @@ #include "llvm/LLVMContext.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +#include "llvm/MDNode.h" #include "llvm/Support/ManagedStatic.h" #include "LLVMContextImpl.h" @@ -405,6 +406,11 @@ return ConstantVector::getAllOnesValue(Ty); } +// MDNode accessors +MDNode* LLVMContext::getMDNode(Value* const* Vals, unsigned NumVals) { + return MDNode::get(Vals, NumVals); +} + // FunctionType accessors FunctionType* LLVMContext::getFunctionType(const Type* Result, const std::vector& Params, From dalej at apple.com Thu Jul 2 12:15:38 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 2 Jul 2009 10:15:38 -0700 Subject: [llvm-commits] OT: How do I revert a single revision locally In-Reply-To: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP> References: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP> Message-ID: <7CCC39D8-54CB-4F41-B14C-A250BD81BAB2@apple.com> On Jul 2, 2009, at 9:57 AMPDT, Aaron Gray wrote: > Hi, > > I cannot seem to find it on the web and I have left my SVN book at > home. > > How do I revert a single revision locally ? Is this possible ? > > I tried svn revert and svn co but neither seemed to work properly. One way: svn diff -r: > patchfile patch -p0 -R < patchfile From resistor at mac.com Thu Jul 2 12:17:20 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 10:17:20 -0700 Subject: [llvm-commits] OT: How do I revert a single revision locally In-Reply-To: <7CCC39D8-54CB-4F41-B14C-A250BD81BAB2@apple.com> References: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP> <7CCC39D8-54CB-4F41-B14C-A250BD81BAB2@apple.com> Message-ID: <55F22733-3136-411E-90B2-7E7FA57C0D2E@mac.com> On Jul 2, 2009, at 10:15 AM, Dale Johannesen wrote: > One way: > svn diff -r: > patchfile > patch -p0 -R < patchfile Even simpler: svn diff -r: | patch -p0 --Owen From dpatel at apple.com Thu Jul 2 12:17:33 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 02 Jul 2009 17:17:33 -0000 Subject: [llvm-commits] [llvm] r74706 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp Message-ID: <200907021717.n62HHd2N015934@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 2 12:17:03 2009 New Revision: 74706 URL: http://llvm.org/viewvc/llvm-project?rev=74706&view=rev Log: Fix typo. Thanks Duncan! Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=74706&r1=74705&r2=74706&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Thu Jul 2 12:17:03 2009 @@ -554,27 +554,27 @@ SmallVector &Subprograms); /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI, CodeGenOpt::Level OptLev); /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI, CodeGenOpt::Level OptLev); /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI, CodeGenOpt::Level OptLev); /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI, CodeGenOpt::Level OptLev); /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI, CodeGenOpt::Level OptLev); Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=74706&r1=74705&r2=74706&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Thu Jul 2 12:17:03 2009 @@ -1053,28 +1053,28 @@ } /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLev); } /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(FSI.getSubprogram(), OptLev); } /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLev); } /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(REI.getContext(), OptLev); @@ -1082,7 +1082,7 @@ /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug - /// info intrisic. + /// info intrinsic. bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI, CodeGenOpt::Level OptLev) { return DIDescriptor::ValidDebugInfo(DI.getVariable(), OptLev); From resistor at mac.com Thu Jul 2 12:19:51 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 17:19:51 -0000 Subject: [llvm-commits] [llvm] r74707 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp Message-ID: <200907021719.n62HJq3x016009@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 12:19:47 2009 New Revision: 74707 URL: http://llvm.org/viewvc/llvm-project?rev=74707&view=rev Log: Add accessors for metadata constants. Modified: llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74707&r1=74706&r2=74707&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Thu Jul 2 12:19:47 2009 @@ -32,6 +32,7 @@ class ConstantVector; class UndefValue; class MDNode; +class MDString; class IntegerType; class PointerType; class StructType; @@ -180,6 +181,10 @@ // MDNode accessors MDNode* getMDNode(Value* const* Vals, unsigned NumVals); + // MDString accessors + MDString* getMDString(const char *StrBegin, const char *StrEnd); + MDString* getMDString(const std::string &Str); + // FunctionType accessors FunctionType* getFunctionType(const Type* Result, const std::vector& Params, Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74707&r1=74706&r2=74707&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Thu Jul 2 12:19:47 2009 @@ -411,6 +411,15 @@ return MDNode::get(Vals, NumVals); } +// MDString accessors +MDString* LLVMContext::getMDString(const char *StrBegin, const char *StrEnd) { + return MDString::get(StrBegin, StrEnd); +} + +MDString* LLVMContext::getMDString(const std::string &Str) { + return MDString::get(Str); +} + // FunctionType accessors FunctionType* LLVMContext::getFunctionType(const Type* Result, const std::vector& Params, From resistor at mac.com Thu Jul 2 12:20:39 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 17:20:39 -0000 Subject: [llvm-commits] [llvm] r74708 - /llvm/trunk/lib/AsmParser/LLParser.cpp Message-ID: <200907021720.n62HKdEr016066@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 12:20:28 2009 New Revision: 74708 URL: http://llvm.org/viewvc/llvm-project?rev=74708&view=rev Log: Use LLVMContext to generate metadata constants. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74708&r1=74707&r2=74708&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Jul 2 12:20:28 2009 @@ -1623,7 +1623,7 @@ ParseToken(lltok::rbrace, "expected end of metadata node")) return true; - ID.ConstantVal = MDNode::get(Elts.data(), Elts.size()); + ID.ConstantVal = Context.getMDNode(Elts.data(), Elts.size()); return false; } From resistor at mac.com Thu Jul 2 12:28:41 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 17:28:41 -0000 Subject: [llvm-commits] [llvm] r74710 - /llvm/trunk/lib/AsmParser/LLParser.cpp Message-ID: <200907021728.n62HShEB016321@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 12:28:30 2009 New Revision: 74710 URL: http://llvm.org/viewvc/llvm-project?rev=74710&view=rev Log: Use LLVMContext for generating MDStrings too. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=74710&r1=74709&r2=74710&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Jul 2 12:28:30 2009 @@ -1643,7 +1643,7 @@ std::string Str; if (ParseStringConstant(Str)) return true; - ID.ConstantVal = MDString::get(Str.data(), Str.data() + Str.size()); + ID.ConstantVal = Context.getMDString(Str.data(), Str.data() + Str.size()); return false; } case lltok::APSInt: From stefanus.dutoit at rapidmind.com Thu Jul 2 12:29:18 2009 From: stefanus.dutoit at rapidmind.com (Stefanus Du Toit) Date: Thu, 2 Jul 2009 13:29:18 -0400 Subject: [llvm-commits] OT: How do I revert a single revision locally In-Reply-To: <55F22733-3136-411E-90B2-7E7FA57C0D2E@mac.com> References: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP> <7CCC39D8-54CB-4F41-B14C-A250BD81BAB2@apple.com> <55F22733-3136-411E-90B2-7E7FA57C0D2E@mac.com> Message-ID: <27DE1C01-23EC-4F92-ABF5-635575858954@rapidmind.com> On 2-Jul-09, at 1:17 PM, Owen Anderson wrote: > On Jul 2, 2009, at 10:15 AM, Dale Johannesen wrote: >> One way: >> svn diff -r: > patchfile >> patch -p0 -R < patchfile > > Even simpler: > > svn diff -r: | patch -p0 Even simpler: svn merge -c badrev . -- Stefanus Du Toit RapidMind Inc. phone: +1 519 885 5455 x116 -- fax: +1 519 885 1463 From stefanus.dutoit at rapidmind.com Thu Jul 2 12:32:23 2009 From: stefanus.dutoit at rapidmind.com (Stefanus Du Toit) Date: Thu, 2 Jul 2009 13:32:23 -0400 Subject: [llvm-commits] OT: How do I revert a single revision locally In-Reply-To: <27DE1C01-23EC-4F92-ABF5-635575858954@rapidmind.com> References: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP> <7CCC39D8-54CB-4F41-B14C-A250BD81BAB2@apple.com> <55F22733-3136-411E-90B2-7E7FA57C0D2E@mac.com> <27DE1C01-23EC-4F92-ABF5-635575858954@rapidmind.com> Message-ID: On 2-Jul-09, at 1:29 PM, Stefanus Du Toit wrote: > svn merge -c badrev . Woops, that should have been: svn merge -c -badrev . E.g. if you want to remove the changes from revision 42: svn merge -c -42 . -- Stefanus Du Toit RapidMind Inc. phone: +1 519 885 5455 x116 -- fax: +1 519 885 1463 From sanjiv.gupta at microchip.com Thu Jul 2 12:35:54 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Thu, 02 Jul 2009 17:35:54 -0000 Subject: [llvm-commits] [llvm] r74711 - in /llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base: PIC16Base.td PluginMain.cpp Message-ID: <200907021735.n62HZw0u016708@zion.cs.uiuc.edu> Author: sgupta Date: Thu Jul 2 12:35:38 2009 New Revision: 74711 URL: http://llvm.org/viewvc/llvm-project?rev=74711&view=rev Log: Fixed handling of -c option.wq Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td?rev=74711&r1=74710&r2=74711&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td (original) +++ llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td Thu Jul 2 12:35:38 2009 @@ -13,6 +13,8 @@ (help "Enable Debugging")), (switch_option "S", (help "Stop after compilation, do not assemble")), + (switch_option "c", + (help "Stop after assemble, do not link")), (parameter_option "I", (help "Add a directory to include path")), (parameter_option "pre-RA-sched", @@ -43,7 +45,7 @@ (in_language "llvm-bitcode"), (out_language "llvm-bitcode"), (output_suffix "bc"), - (cmd_line "llvm-ld -f -link-as-library $INFILE -o $OUTFILE"), + (cmd_line "llvm-ld -link-as-library $INFILE -o $OUTFILE"), (actions (case (switch_on "g"), (append_cmd "-disable-opt"), (not_empty "Wo,"), (unpack_values "Wo,"))) @@ -75,8 +77,9 @@ (in_language "assembler"), (out_language "object-code"), (output_suffix "o"), - (cmd_line "gpasm -I $CALL(GetStdAsmHeadersDir) $INFILE -o $OUTFILE"), + (cmd_line "gpasm -r decimal -p p16F1937 -I $CALL(GetStdAsmHeadersDir) -C -c $INFILE -o $OUTFILE"), (actions (case + (switch_on "c"), (stop_compilation), (not_empty "Wa,"), (unpack_values "Wa,"))) ]>; @@ -84,7 +87,7 @@ (in_language "object-code"), (out_language "executable"), (output_suffix "out"), - (cmd_line "mplink /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) $INFILE -o $OUTFILE"), + (cmd_line "mplink.exe /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) 16f1937.lkr intrinsics.lib std.lib $INFILE -o $OUTFILE"), (actions (case (not_empty "Wl,"), (unpack_values "Wl,"))), (join) @@ -109,7 +112,9 @@ Edge<"root", "clang_cc">, Edge<"clang_cc", "llvm_ld_lto">, Edge<"llvm_ld_lto", "llc">, - OptionalEdge<"clang_cc", "llvm_ld", (case (switch_on "S"), (inc_weight))>, + OptionalEdge<"clang_cc", "llvm_ld", (case + (switch_on "S"), (inc_weight), + (switch_on "c"), (inc_weight))>, Edge<"llvm_ld", "llc">, Edge<"llc", "gpasm">, Edge<"gpasm", "mplink"> Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp?rev=74711&r1=74710&r2=74711&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp (original) +++ llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp Thu Jul 2 12:35:38 2009 @@ -1,5 +1,9 @@ #include "AutoGenerated.inc" + #include "llvm/System/Path.h" +#include "llvm/Support/raw_ostream.h" + +using namespace llvm; namespace llvmc { extern char *ProgramName; @@ -11,19 +15,23 @@ } namespace hooks { +// Get the dir where c16 executables reside. std::string GetBinDir (void) { // Construct a Path object from the program name. - llvm::sys::Path ProgramFullName(llvmc::ProgramName, - strlen(llvmc::ProgramName)); + void *P = (void*) (intptr_t) GetBinDir; + sys::Path ProgramFullPath + = sys::Path::GetMainExecutable(llvmc::ProgramName, P); // Get the dir name for the program. It's last component should be 'bin'. - std::string BinDir = ProgramFullName.getDirname(); + std::string BinDir = ProgramFullPath.getDirname(); + // llvm::errs() << "BinDir: " << BinDir << '\n'; return BinDir + GetDirSeparator(); } +// Get the Top-level Installation dir for c16. std::string GetInstallDir (void) { - llvm::sys::Path BinDirPath = llvm::sys::Path(GetBinDir()); + sys::Path BinDirPath = sys::Path(GetBinDir()); // Go one more level up to get the install dir. std::string InstallDir = BinDirPath.getDirname(); @@ -31,17 +39,22 @@ return InstallDir + GetDirSeparator(); } +// Get the dir where the c16 header files reside. std::string GetStdHeadersDir (void) { return GetInstallDir() + "include"; } +// Get the dir where the assembler header files reside. std::string GetStdAsmHeadersDir (void) { return GetInstallDir() + "inc"; } + +// Get the dir where the linker scripts reside. std::string GetStdLinkerScriptsDir (void) { return GetInstallDir() + "lkr"; } +// Get the dir where startup code, intrinsics and lib reside. std::string GetStdLibsDir (void) { return GetInstallDir() + "lib"; } From devang.patel at gmail.com Thu Jul 2 12:38:58 2009 From: devang.patel at gmail.com (Devang Patel) Date: Thu, 2 Jul 2009 10:38:58 -0700 Subject: [llvm-commits] [llvm] r74628 - in /llvm/trunk/include/llvm/CodeGen: MachineInstrBuilder.h MachineOperand.h In-Reply-To: <4A4C32DD.8020408@mxc.ca> References: <200907011908.n61J8Dua020706@zion.cs.uiuc.edu> <4A4C32DD.8020408@mxc.ca> Message-ID: <352a1fb20907021038v705f632am1adba680c998b505@mail.gmail.com> Fixed On Wed, Jul 1, 2009 at 9:09 PM, Nick Lewycky wrote: > Devang Patel wrote: >> Author: dpatel >> Date: Wed Jul ?1 14:08:07 2009 >> New Revision: 74628 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=74628&view=rev >> Log: >> Add machine operand for MDNodes. This will be used to communicate debug info. >> >> Modified: >> ? ? llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h >> ? ? llvm/trunk/include/llvm/CodeGen/MachineOperand.h >> >> Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=74628&r1=74627&r2=74628&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Wed Jul ?1 14:08:07 2009 >> @@ -107,6 +107,13 @@ >> ? ? ?return *this; >> ? ?} >> >> + ?const MachineInstrBuilder &addMetadata(MDNode *N, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int64_t Offset = 0, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char TargetFlags = 0) const { >> + ? ?MI->addOperand(MachineOperand::CreateMDNode(N, Offset, TargetFlags)); >> + ? ?return *this; >> + ?} >> + >> ? ?const MachineInstrBuilder &addExternalSymbol(const char *FnName, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int64_t Offset = 0, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char TargetFlags = 0) const { >> >> Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=74628&r1=74627&r2=74628&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Wed Jul ?1 14:08:07 2009 >> @@ -23,6 +23,7 @@ >> ?class ConstantFP; >> ?class MachineBasicBlock; >> ?class GlobalValue; >> +class MDNode; >> ?class MachineInstr; >> ?class TargetMachine; >> ?class MachineRegisterInfo; >> @@ -41,7 +42,8 @@ >> ? ? ?MO_ConstantPoolIndex, ? ? ?///< Address of indexed Constant in Constant Pool >> ? ? ?MO_JumpTableIndex, ? ? ? ? ///< Address of indexed Jump Table for switch >> ? ? ?MO_ExternalSymbol, ? ? ? ? ///< Name of external global symbol >> - ? ?MO_GlobalAddress ? ? ? ? ? ///< Address of a global value >> + ? ?MO_GlobalAddress, ? ? ? ? ?///< Address of a global value >> + ? ?MO_Metadata ? ? ? ? ? ? ? ?///< Metadata info >> ? ?}; >> >> ?private: >> @@ -107,6 +109,7 @@ >> ? ? ? ? ?int Index; ? ? ? ? ? ? ? ?// For MO_*Index - The index itself. >> ? ? ? ? ?const char *SymbolName; ? // For MO_ExternalSymbol. >> ? ? ? ? ?GlobalValue *GV; ? ? ? ? ?// For MO_GlobalAddress. >> + ? ? MDNode *Node; ? ? ? ? ? ? // For MO_Metadata. > > Tab. > >> ? ? ? ?} Val; >> ? ? ? ?int64_t Offset; ? // An offset from the object. >> ? ? ?} OffsetedInfo; >> @@ -423,6 +426,14 @@ >> ? ? ?Op.setTargetFlags(TargetFlags); >> ? ? ?return Op; >> ? ?} >> + ?static MachineOperand CreateMDNode(MDNode *N, int64_t Offset, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned char TargetFlags = 0) { > > Tabs. > > Nick > >> + ? ?MachineOperand Op(MachineOperand::MO_Metadata); >> + ? ?Op.Contents.OffsetedInfo.Val.Node = N; >> + ? ?Op.setOffset(Offset); >> + ? ?Op.setTargetFlags(TargetFlags); >> + ? ?return Op; >> + ?} >> ? ?static MachineOperand CreateES(const char *SymName, int64_t Offset = 0, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned char TargetFlags = 0) { >> ? ? ?MachineOperand Op(MachineOperand::MO_ExternalSymbol); >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- - Devang From aaronngray.lists at googlemail.com Thu Jul 2 12:39:20 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Thu, 2 Jul 2009 18:39:20 +0100 Subject: [llvm-commits] OT: How do I revert a single revision locally References: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP><7CCC39D8-54CB-4F41-B14C-A250BD81BAB2@apple.com><55F22733-3136-411E-90B2-7E7FA57C0D2E@mac.com><27DE1C01-23EC-4F92-ABF5-635575858954@rapidmind.com> Message-ID: <3FAB41F1FB604F1DA85E7178BE05D546@HPLAPTOP> > On 2-Jul-09, at 1:29 PM, Stefanus Du Toit wrote: >> svn merge -c badrev . > > Woops, that should have been: > > svn merge -c -badrev . > > E.g. if you want to remove the changes from revision 42: > > svn merge -c -42 . Oh well tahnks anyway, it did not work as there were too many other changes in later revisions :( Aaron From dpatel at apple.com Thu Jul 2 12:39:50 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 02 Jul 2009 17:39:50 -0000 Subject: [llvm-commits] [llvm] r74712 - /llvm/trunk/include/llvm/CodeGen/MachineOperand.h Message-ID: <200907021739.n62HdqM1016849@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 2 12:39:40 2009 New Revision: 74712 URL: http://llvm.org/viewvc/llvm-project?rev=74712&view=rev Log: Remove tabs. Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=74712&r1=74711&r2=74712&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Thu Jul 2 12:39:40 2009 @@ -109,7 +109,7 @@ int Index; // For MO_*Index - The index itself. const char *SymbolName; // For MO_ExternalSymbol. GlobalValue *GV; // For MO_GlobalAddress. - MDNode *Node; // For MO_Metadata. + MDNode *Node; // For MO_Metadata. } Val; int64_t Offset; // An offset from the object. } OffsetedInfo; @@ -431,7 +431,7 @@ return Op; } static MachineOperand CreateMDNode(MDNode *N, int64_t Offset, - unsigned char TargetFlags = 0) { + unsigned char TargetFlags = 0) { MachineOperand Op(MachineOperand::MO_Metadata); Op.Contents.OffsetedInfo.Val.Node = N; Op.setOffset(Offset); From sanjiv.gupta at microchip.com Thu Jul 2 12:51:46 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Thu, 02 Jul 2009 17:51:46 -0000 Subject: [llvm-commits] [llvm] r74713 - /llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td Message-ID: <200907021751.n62HpoXe017300@zion.cs.uiuc.edu> Author: sgupta Date: Thu Jul 2 12:51:09 2009 New Revision: 74713 URL: http://llvm.org/viewvc/llvm-project?rev=74713&view=rev Log: Prefix bin dir to executables. Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td?rev=74713&r1=74712&r2=74713&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td (original) +++ llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td Thu Jul 2 12:51:09 2009 @@ -45,7 +45,7 @@ (in_language "llvm-bitcode"), (out_language "llvm-bitcode"), (output_suffix "bc"), - (cmd_line "llvm-ld -link-as-library $INFILE -o $OUTFILE"), + (cmd_line "$CALL(GetBinDir)llvm-ld -link-as-library $INFILE -o $OUTFILE"), (actions (case (switch_on "g"), (append_cmd "-disable-opt"), (not_empty "Wo,"), (unpack_values "Wo,"))) @@ -55,7 +55,7 @@ (in_language "llvm-bitcode"), (out_language "llvm-bitcode"), (output_suffix "bc"), - (cmd_line "llvm-ld -link-as-library $INFILE -o $OUTFILE"), + (cmd_line "$CALL(GetBinDir)llvm-ld -link-as-library $INFILE -o $OUTFILE"), (actions (case (switch_on "g"), (append_cmd "-disable-opt"), (not_empty "Wo,"), (unpack_values "Wo,"))), @@ -66,7 +66,7 @@ (in_language "llvm-bitcode"), (out_language "assembler"), (output_suffix "s"), - (cmd_line "llc -march=pic16 -f $INFILE -o $OUTFILE"), + (cmd_line "$CALL(GetBinDir)llc -march=pic16 -f $INFILE -o $OUTFILE"), (actions (case (switch_on "S"), (stop_compilation), (not_empty "Wllc,"), (unpack_values "Wllc,"), @@ -77,7 +77,7 @@ (in_language "assembler"), (out_language "object-code"), (output_suffix "o"), - (cmd_line "gpasm -r decimal -p p16F1937 -I $CALL(GetStdAsmHeadersDir) -C -c $INFILE -o $OUTFILE"), + (cmd_line "$CALL(GetBinDir)gpasm -r decimal -p p16F1937 -I $CALL(GetStdAsmHeadersDir) -C -c $INFILE -o $OUTFILE"), (actions (case (switch_on "c"), (stop_compilation), (not_empty "Wa,"), (unpack_values "Wa,"))) @@ -87,7 +87,7 @@ (in_language "object-code"), (out_language "executable"), (output_suffix "out"), - (cmd_line "mplink.exe /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) 16f1937.lkr intrinsics.lib std.lib $INFILE -o $OUTFILE"), + (cmd_line "$CALL(GetBinDir)mplink.exe /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) 16f1937.lkr intrinsics.lib std.lib $INFILE -o $OUTFILE"), (actions (case (not_empty "Wl,"), (unpack_values "Wl,"))), (join) From devang.patel at gmail.com Thu Jul 2 12:59:57 2009 From: devang.patel at gmail.com (Devang Patel) Date: Thu, 2 Jul 2009 10:59:57 -0700 Subject: [llvm-commits] [llvm] r74668 - /llvm/trunk/docs/WritingAnLLVMPass.html In-Reply-To: <200907012338.n61NciZT029532@zion.cs.uiuc.edu> References: <200907012338.n61NciZT029532@zion.cs.uiuc.edu> Message-ID: <352a1fb20907021059r2a2706bch9974bcfbf714657f@mail.gmail.com> Thanks! - Devang On Wed, Jul 1, 2009 at 4:38 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Wed Jul ?1 18:38:44 2009 > New Revision: 74668 > > URL: http://llvm.org/viewvc/llvm-project?rev=74668&view=rev > Log: > Try to clarify a point about getting DominatorTree info from a module pass. > > Modified: > ? ?llvm/trunk/docs/WritingAnLLVMPass.html > > Modified: llvm/trunk/docs/WritingAnLLVMPass.html > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMPass.html?rev=74668&r1=74667&r2=74668&view=diff > > ============================================================================== > --- llvm/trunk/docs/WritingAnLLVMPass.html (original) > +++ llvm/trunk/docs/WritingAnLLVMPass.html Wed Jul ?1 18:38:44 2009 > @@ -491,10 +491,15 @@ > ?ModulePass indicates that your pass uses the entire program as a unit, > ?refering to function bodies in no predictable order, or adding and removing > ?functions. ?Because nothing is known about the behavior of ModulePass > -subclasses, no optimization can be done for their execution. A module pass > -can use function level passes (e.g. dominators) using getAnalysis interface > - getAnalysis<DominatorTree>(Function), if the function pass > -does not require any module passes.

      > +subclasses, no optimization can be done for their execution.

      > + > +

      A module pass can use function level passes (e.g. dominators) using > +the getAnalysis interface > +getAnalysis<DominatorTree>(llvm::Function *) to provide the > +function to retrieve analysis result for, if the function pass does not require > +any module passes. Note that this can only be done for functions for which the > +analysis ran, e.g. in the case of dominators you should only ask for the > +DominatorTree for function definitions, not declarations.

      > > ?

      To write a correct ModulePass subclass, derive from > ?ModulePass and overload the runOnModule method with the > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- - Devang From nicolas.geoffray at lip6.fr Thu Jul 2 13:00:46 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 02 Jul 2009 20:00:46 +0200 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> Message-ID: <4A4CF5CE.7040504@lip6.fr> Dale Johannesen wrote: > > OK. Register usage seemed like a surprising thing to get wrong, but > if Nicolas is happy so am I. > > I haven't looked at the patch actually, Tilmann, where did I get things wrong? Nicolas From resistor at mac.com Thu Jul 2 13:04:09 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 18:04:09 -0000 Subject: [llvm-commits] [llvm] r74714 - in /llvm/trunk: include/llvm/Function.h lib/VMCore/Function.cpp Message-ID: <200907021804.n62I4DaM017670@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 13:03:58 2009 New Revision: 74714 URL: http://llvm.org/viewvc/llvm-project?rev=74714&view=rev Log: Add an accessor to Function so that Passes can easily get access to the context. Modified: llvm/trunk/include/llvm/Function.h llvm/trunk/lib/VMCore/Function.cpp Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=74714&r1=74713&r2=74714&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Thu Jul 2 13:03:58 2009 @@ -27,6 +27,7 @@ namespace llvm { class FunctionType; +class LLVMContext; // Traits for intrusive list of basic blocks... template<> struct ilist_traits @@ -126,6 +127,10 @@ const Type *getReturnType() const; // Return the type of the ret val const FunctionType *getFunctionType() const; // Return the FunctionType for me + /// getContext - Return a pointer to the LLVMContext associated with this + /// function, or NULL if this function is not bound to a context yet. + LLVMContext* getContext(); + /// isVarArg - Return true if this function takes a variable number of /// arguments. bool isVarArg() const; Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=74714&r1=74713&r2=74714&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Thu Jul 2 13:03:58 2009 @@ -114,6 +114,12 @@ // Helper Methods in Function //===----------------------------------------------------------------------===// +LLVMContext* Function::getContext() { + Module* M = getParent(); + if (M) return &M->getContext(); + return 0; +} + const FunctionType *Function::getFunctionType() const { return cast(getType()->getElementType()); } From tilmann.scheller at googlemail.com Thu Jul 2 13:16:12 2009 From: tilmann.scheller at googlemail.com (Tilmann Scheller) Date: Thu, 2 Jul 2009 20:16:12 +0200 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: <4A4CF5CE.7040504@lip6.fr> References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> <4A4CF5CE.7040504@lip6.fr> Message-ID: Hi Nicolas, On Thu, Jul 2, 2009 at 8:00 PM, Nicolas Geoffray wrote: > I haven't looked at the patch actually, Tilmann, where did I get things > wrong? F9 - F13 were marked as non-volatile registers, they are volatile though. After changing them to volatile, 52 additional tests in the nightly tester passed which were failing before :) Greetings, Tilmann From dalej at apple.com Thu Jul 2 13:18:43 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 2 Jul 2009 11:18:43 -0700 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> <4A4CF5CE.7040504@lip6.fr> Message-ID: On Jul 2, 2009, at 11:16 AMPDT, Tilmann Scheller wrote: > Hi Nicolas, > > On Thu, Jul 2, 2009 at 8:00 PM, Nicolas > Geoffray wrote: >> I haven't looked at the patch actually, Tilmann, where did I get >> things >> wrong? > F9 - F13 were marked as non-volatile registers, they are volatile > though. > > After changing them to volatile, 52 additional tests in the nightly > tester passed which were failing before :) The usage of R13 also changed. Yes, this is what got my attention. From tilmann.scheller at googlemail.com Thu Jul 2 13:21:31 2009 From: tilmann.scheller at googlemail.com (Tilmann Scheller) Date: Thu, 2 Jul 2009 20:21:31 +0200 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> Message-ID: Hi Dale, On Thu, Jul 2, 2009 at 6:59 PM, Dale Johannesen wrote: > Right, I agree that's a good idea. ?I suspect other ABIs that use ELF > will have some things in common with this one, and an ELF abstraction > might be useful, but we can leave that for whoever does such a port. Yeah, I agree. >> Just to be sure, did you take a look at the llvm-gcc patch as well? > Yes I did. > Do you have commit access? Yes, I'll rebase and commit soon. Thanks again for the review! Greetings, Tilmann From tilmann.scheller at googlemail.com Thu Jul 2 13:23:31 2009 From: tilmann.scheller at googlemail.com (Tilmann Scheller) Date: Thu, 2 Jul 2009 20:23:31 +0200 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> <4A4CF5CE.7040504@lip6.fr> Message-ID: On Thu, Jul 2, 2009 at 8:18 PM, Dale Johannesen wrote: > The usage of R13 also changed. ?Yes, this is what got my attention. Correct, R13 is reserved for the Small Data Area pointer. Greetings, Tilmann From bruno.cardoso at gmail.com Thu Jul 2 13:29:28 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Thu, 02 Jul 2009 18:29:28 -0000 Subject: [llvm-commits] [llvm] r74718 - in /llvm/trunk/lib/CodeGen: ELF.h ELFCodeEmitter.cpp ELFCodeEmitter.h ELFWriter.cpp ELFWriter.h Message-ID: <200907021829.n62ITTlf018741@zion.cs.uiuc.edu> Author: bruno Date: Thu Jul 2 13:29:24 2009 New Revision: 74718 URL: http://llvm.org/viewvc/llvm-project?rev=74718&view=rev Log: shrinking down #includes Modified: llvm/trunk/lib/CodeGen/ELF.h llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp llvm/trunk/lib/CodeGen/ELFCodeEmitter.h llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/ELFWriter.h Modified: llvm/trunk/lib/CodeGen/ELF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELF.h?rev=74718&r1=74717&r2=74718&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELF.h (original) +++ llvm/trunk/lib/CodeGen/ELF.h Thu Jul 2 13:29:24 2009 @@ -20,14 +20,12 @@ #ifndef CODEGEN_ELF_H #define CODEGEN_ELF_H -#include "llvm/GlobalVariable.h" #include "llvm/CodeGen/BinaryObject.h" #include "llvm/CodeGen/MachineRelocation.h" #include "llvm/Support/DataTypes.h" -#include namespace llvm { - class BinaryObject; + class GlobalValue; // Identification Indexes enum { @@ -172,41 +170,25 @@ IsConstant(false), NameIdx(0), Value(0), Size(0), Info(0), Other(STV_DEFAULT), SectionIdx(ELFSection::SHN_UNDEF), - SymTabIdx(0) { - if (!GV) - return; - - switch (GV->getVisibility()) { - default: - assert(0 && "unknown visibility type"); - case GlobalValue::DefaultVisibility: - Other = STV_DEFAULT; - break; - case GlobalValue::HiddenVisibility: - Other = STV_HIDDEN; - break; - case GlobalValue::ProtectedVisibility: - Other = STV_PROTECTED; - break; - } - } - - unsigned getBind() { - return (Info >> 4) & 0xf; - } + SymTabIdx(0) {} - unsigned getType() { - return Info & 0xf; - } + unsigned getBind() { return (Info >> 4) & 0xf; } + unsigned getType() { return Info & 0xf; } void setBind(unsigned X) { assert(X == (X & 0xF) && "Bind value out of range!"); Info = (Info & 0x0F) | (X << 4); } + void setType(unsigned X) { assert(X == (X & 0xF) && "Type value out of range!"); Info = (Info & 0xF0) | X; } + + void setVisibility(unsigned V) { + assert(V == (V & 0x3) && "Type value out of range!"); + Other = V; + } }; /// ELFRelocation - This class contains all the information necessary to Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp?rev=74718&r1=74717&r2=74718&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Thu Jul 2 13:29:24 2009 @@ -9,6 +9,8 @@ #define DEBUG_TYPE "elfce" +#include "ELF.h" +#include "ELFWriter.h" #include "ELFCodeEmitter.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -16,8 +18,10 @@ #include "llvm/CodeGen/BinaryObject.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" +#include "llvm/CodeGen/MachineRelocation.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Support/Debug.h" //===----------------------------------------------------------------------===// @@ -67,42 +71,27 @@ /// finishFunction - This callback is invoked after the function is completely /// finished. bool ELFCodeEmitter::finishFunction(MachineFunction &MF) { - // Add a symbol to represent the function. - ELFSym FnSym(MF.getFunction()); - // Update Section Size ES->Size = CurBufferPtr - BufferBegin; - // Set the symbol type as a function + // Add a symbol to represent the function. + const Function *F = MF.getFunction(); + ELFSym FnSym(F); FnSym.setType(ELFSym::STT_FUNC); + FnSym.setBind(EW.getGlobalELFLinkage(F)); + FnSym.setVisibility(EW.getGlobalELFVisibility(F)); FnSym.SectionIdx = ES->SectionIdx; FnSym.Size = CurBufferPtr-FnStartPtr; // Offset from start of Section FnSym.Value = FnStartPtr-BufferBegin; - // Figure out the binding (linkage) of the symbol. - switch (MF.getFunction()->getLinkage()) { - default: - // appending linkage is illegal for functions. - assert(0 && "Unknown linkage type!"); - case GlobalValue::ExternalLinkage: - FnSym.setBind(ELFSym::STB_GLOBAL); - EW.SymbolList.push_back(FnSym); - break; - case GlobalValue::LinkOnceAnyLinkage: - case GlobalValue::LinkOnceODRLinkage: - case GlobalValue::WeakAnyLinkage: - case GlobalValue::WeakODRLinkage: - FnSym.setBind(ELFSym::STB_WEAK); - EW.SymbolList.push_back(FnSym); - break; - case GlobalValue::PrivateLinkage: - assert (0 && "PrivateLinkage should not be in the symbol table."); - case GlobalValue::InternalLinkage: - FnSym.setBind(ELFSym::STB_LOCAL); - EW.SymbolList.push_front(FnSym); - break; + // Locals should go on the symbol list front + if (!F->hasPrivateLinkage()) { + if (FnSym.getBind() == ELFSym::STB_LOCAL) + EW.SymbolList.push_front(FnSym); + else + EW.SymbolList.push_back(FnSym); } // Emit constant pool to appropriate section(s) Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.h?rev=74718&r1=74717&r2=74718&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFCodeEmitter.h (original) +++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.h Thu Jul 2 13:29:24 2009 @@ -10,11 +10,12 @@ #ifndef ELFCODEEMITTER_H #define ELFCODEEMITTER_H -#include "ELFWriter.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include namespace llvm { + class ELFWriter; + class ELFSection; /// ELFCodeEmitter - This class is used by the ELFWriter to /// emit the code for functions to the ELF file. Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=74718&r1=74717&r2=74718&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Thu Jul 2 13:29:24 2009 @@ -30,9 +30,9 @@ #define DEBUG_TYPE "elfwriter" +#include "ELF.h" #include "ELFWriter.h" #include "ELFCodeEmitter.h" -#include "ELF.h" #include "llvm/Constants.h" #include "llvm/Module.h" #include "llvm/PassManager.h" @@ -41,14 +41,14 @@ #include "llvm/CodeGen/FileWriters.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/CodeGen/MachineConstantPool.h" -#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetELFWriterInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/Streams.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Debug.h" -#include using namespace llvm; char ELFWriter::ID = 0; @@ -141,7 +141,22 @@ return false; } -unsigned ELFWriter::getGlobalELFLinkage(const GlobalVariable *GV) { +unsigned ELFWriter::getGlobalELFVisibility(const GlobalValue *GV) { + switch (GV->getVisibility()) { + default: + assert(0 && "unknown visibility type"); + case GlobalValue::DefaultVisibility: + return ELFSym::STV_DEFAULT; + case GlobalValue::HiddenVisibility: + return ELFSym::STV_HIDDEN; + case GlobalValue::ProtectedVisibility: + return ELFSym::STV_PROTECTED; + } + + return 0; +} + +unsigned ELFWriter::getGlobalELFLinkage(const GlobalValue *GV) { if (GV->hasInternalLinkage()) return ELFSym::STB_LOCAL; @@ -213,6 +228,7 @@ ELFSym GblSym(F); GblSym.setBind(ELFSym::STB_GLOBAL); GblSym.setType(ELFSym::STT_NOTYPE); + GblSym.setVisibility(ELFSym::STV_DEFAULT); GblSym.SectionIdx = ELFSection::SHN_UNDEF; SymbolList.push_back(GblSym); } @@ -222,6 +238,7 @@ unsigned Align=0, Size=0; ELFSym GblSym(GV); GblSym.setBind(SymBind); + GblSym.setVisibility(getGlobalELFVisibility(GV)); if (GV->hasInitializer()) { GblSym.setType(ELFSym::STT_OBJECT); @@ -402,6 +419,7 @@ SectionSym.Size = 0; SectionSym.setBind(ELFSym::STB_LOCAL); SectionSym.setType(ELFSym::STT_SECTION); + SectionSym.setVisibility(ELFSym::STV_DEFAULT); // Local symbols go in the list front SymbolList.push_front(SectionSym); @@ -443,7 +461,8 @@ // Get the relocation section for section 'I' bool HasRelA = TEW->hasRelocationAddend(); - ELFSection &RelSec = getRelocSection(I->getName(), HasRelA); + ELFSection &RelSec = getRelocSection(I->getName(), HasRelA, + TEW->getPrefELFAlignment()); // 'Link' - Section hdr idx of the associated symbol table // 'Info' - Section hdr idx of the section to which the relocation applies Modified: llvm/trunk/lib/CodeGen/ELFWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.h?rev=74718&r1=74717&r2=74718&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.h (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.h Thu Jul 2 13:29:24 2009 @@ -16,21 +16,23 @@ #include "llvm/ADT/SetVector.h" #include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/Support/Debug.h" -#include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/TargetELFWriterInfo.h" -#include "ELF.h" #include #include namespace llvm { class BinaryObject; + class Constant; class ConstantStruct; class ELFCodeEmitter; class GlobalVariable; class Mangler; class MachineCodeEmitter; + class TargetAsmInfo; + class TargetELFWriterInfo; class raw_ostream; + class ELFSection; + class ELFSym; + class ELFRelocation; /// ELFWriter - This class implements the common target-independent code for /// writing ELF files. Targets should derive a class from this to @@ -155,14 +157,14 @@ /// Return the relocation section of section 'S'. 'RelA' is true /// if the relocation section contains entries with addends. - ELFSection &getRelocSection(std::string SName, bool RelA) { + ELFSection &getRelocSection(std::string SName, bool RelA, unsigned Align) { std::string RelSName(".rel"); unsigned SHdrTy = RelA ? ELFSection::SHT_RELA : ELFSection::SHT_REL; if (RelA) RelSName.append("a"); RelSName.append(SName); - return getSection(RelSName, SHdrTy, 0, TEW->getPrefELFAlignment()); + return getSection(RelSName, SHdrTy, 0, Align); } ELFSection &getNonExecStackSection() { @@ -195,6 +197,10 @@ return getSection("", ELFSection::SHT_NULL, 0); } + // Helpers for obtaining ELF specific Linkage and Visibility info. + unsigned getGlobalELFLinkage(const GlobalValue *GV); + unsigned getGlobalELFVisibility(const GlobalValue *GV); + // As we complete the ELF file, we need to update fields in the ELF header // (e.g. the location of the section table). These members keep track of // the offset in ELFHeader of these various pieces to update and other @@ -209,7 +215,6 @@ void EmitGlobalConstant(const Constant *C, ELFSection &GblS); void EmitGlobalConstantStruct(const ConstantStruct *CVS, ELFSection &GblS); - unsigned getGlobalELFLinkage(const GlobalVariable *GV); ELFSection &getGlobalSymELFSection(const GlobalVariable *GV, ELFSym &Sym); void EmitRelocations(); void EmitRelocation(BinaryObject &RelSec, ELFRelocation &Rel, bool HasRelA); From nicolas.geoffray at lip6.fr Thu Jul 2 13:35:55 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 02 Jul 2009 20:35:55 +0200 Subject: [llvm-commits] [PATCH] SVR4 ABI support for the PowerPC backend In-Reply-To: References: <3686027D-D032-4C00-954B-366D865E4BA0@apple.com> <82DCCFD8-8B98-4560-8F02-AF0DB5D01D14@apple.com> <4A4CF5CE.7040504@lip6.fr> Message-ID: <4A4CFE0B.9090806@lip6.fr> Tilmann Scheller wrote: > Hi Nicolas, > > On Thu, Jul 2, 2009 at 8:00 PM, Nicolas > Geoffray wrote: > >> I haven't looked at the patch actually, Tilmann, where did I get things >> wrong? >> > F9 - F13 were marked as non-volatile registers, they are volatile though. > Ah OK, I think I didn't look at FP registers conventions, and did a stupid copy-paste with Macho. Thanks for fixing it Tilmann! Cheers, Nicolas From isanbard at gmail.com Thu Jul 2 13:39:16 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 2 Jul 2009 11:39:16 -0700 Subject: [llvm-commits] [llvm] r74701 - /llvm/trunk/docs/ReleaseNotes-2.6.html In-Reply-To: <200907021648.n62GmlXH014576@zion.cs.uiuc.edu> References: <200907021648.n62GmlXH014576@zion.cs.uiuc.edu> Message-ID: <16e5fdf90907021139k3adf8c12r6f3b3e906d6614e4@mail.gmail.com> On Thu, Jul 2, 2009 at 9:48 AM, Owen Anderson wrote: > Author: resistor > Date: Thu Jul ?2 11:48:38 2009 > New Revision: 74701 > > URL: http://llvm.org/viewvc/llvm-project?rev=74701&view=rev > Log: > Describe the LLVMContext API change. > > Modified: > ? ?llvm/trunk/docs/ReleaseNotes-2.6.html > > Modified: llvm/trunk/docs/ReleaseNotes-2.6.html > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes-2.6.html?rev=74701&r1=74700&r2=74701&view=diff > > ============================================================================== > --- llvm/trunk/docs/ReleaseNotes-2.6.html (original) > +++ llvm/trunk/docs/ReleaseNotes-2.6.html Thu Jul ?2 11:48:38 2009 > @@ -419,7 +419,7 @@ > ?

      > > ?

      If you're already an LLVM user or developer with out-of-tree changes based > -on LLVM 2.4, this section lists some "gotchas" that you may run into upgrading > +on LLVM 2.5, this section lists some "gotchas" that you may run into upgrading > ?from the previous release.

      > > ?
        > @@ -433,6 +433,13 @@ > ?API changes are:

        > > ?
          > +
        • LLVM's global uniquing tables for Types and Constants have > + ? ?been privatized into members of an LLVMContext. ?A number of APIs > + ? ?now take an LLVMContext as a parameter. ?To smooth the transition > + ? ?for clients that will only ever use a single context, the new > + ? ?getGlobalContext() API can be used to access a default global > + ? ?context which can be passed in any and all cases where a context is > + ? ?required. Please add a
        • at the end of this item. -bw From andreas.bolka at gmx.net Thu Jul 2 13:42:53 2009 From: andreas.bolka at gmx.net (Andreas Bolka) Date: Thu, 02 Jul 2009 20:42:53 +0200 Subject: [llvm-commits] [llvm] r74499 - in /llvm/trunk: lib/Analysis/LoopDependenceAnalysis.cpp test/Analysis/LoopDependenceAnalysis/local-array.ll test/Analysis/LoopDependenceAnalysis/no-array.ll test/Analysis/LoopDependenceAnalysis/siv-strong1.ll test/A In-Reply-To: References: Message-ID: <1246560059-sup-9899@strider> On Tue Jun 30 05:47:25 +0200 2009, Eli Friedman wrote: > On Mon, Jun 29, 2009 at 7:12 PM, Andreas Bolka wrote: > > + ?// For now, we only work on (pointers to) global or stack-allocated array > > + ?// values, as we know that their underlying memory areas will not overlap. > > + ?// MAYBE: relax this and test for aliasing? > > + ?if (!((isa(srcObj) || isa(srcObj)) && > > + ? ? ? ?(isa(dstObj) || isa(dstObj)) && > > + ? ? ? ?isa(srcTy) && > > + ? ? ? ?isa(dstTy) && > > + ? ? ? ?isa(cast(srcTy)->getElementType()) && > > + ? ? ? ?isa(cast(dstTy)->getElementType()))) > > + ? ?return true; > > How does the type affect aliasing? Seems I missed this comment earlier; this should be fixed by r74647. -- Andreas From isanbard at gmail.com Thu Jul 2 13:43:29 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 2 Jul 2009 11:43:29 -0700 Subject: [llvm-commits] OT: How do I revert a single revision locally In-Reply-To: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP> References: <0991B7EBA7B249C584F4A25C23BD16F8@HPLAPTOP> Message-ID: <16e5fdf90907021143w793d5987q21ee35606468efa1@mail.gmail.com> On Thu, Jul 2, 2009 at 9:57 AM, Aaron Gray wrote: > Hi, > > I cannot seem to find it on the web and I have left my SVN book at home. > > How do I revert a single revision locally ? Is this possible ? > > I tried svn revert and svn co but neither seemed to work properly. > I do this from inside the checked-out svn tree: svn merge -c - . -bw From dgregor at apple.com Thu Jul 2 13:54:00 2009 From: dgregor at apple.com (Douglas Gregor) Date: Thu, 02 Jul 2009 18:54:00 -0000 Subject: [llvm-commits] [llvm] r74720 - in /llvm/trunk/lib: CodeGen/CMakeLists.txt CodeGen/SelectionDAG/CMakeLists.txt Target/ARM/CMakeLists.txt Target/Alpha/CMakeLists.txt Target/CellSPU/CMakeLists.txt Target/IA64/CMakeLists.txt Target/Mips/CMakeLists.txt Target/PowerPC/CMakeLists.txt Target/Sparc/CMakeLists.txt Target/X86/CMakeLists.txt Message-ID: <200907021854.n62Is47x019567@zion.cs.uiuc.edu> Author: dgregor Date: Thu Jul 2 13:53:52 2009 New Revision: 74720 URL: http://llvm.org/viewvc/llvm-project?rev=74720&view=rev Log: CMake build fixes, from Xerxes Ranby Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt llvm/trunk/lib/Target/ARM/CMakeLists.txt llvm/trunk/lib/Target/Alpha/CMakeLists.txt llvm/trunk/lib/Target/CellSPU/CMakeLists.txt llvm/trunk/lib/Target/IA64/CMakeLists.txt llvm/trunk/lib/Target/Mips/CMakeLists.txt llvm/trunk/lib/Target/PowerPC/CMakeLists.txt llvm/trunk/lib/Target/Sparc/CMakeLists.txt llvm/trunk/lib/Target/X86/CMakeLists.txt Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CMakeLists.txt (original) +++ llvm/trunk/lib/CodeGen/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -64,4 +64,4 @@ VirtRegRewriter.cpp ) -target_link_libraries (LLVMCodeGen LLVMCore) +target_link_libraries (LLVMCodeGen LLVMCore LLVMScalarOpts) Modified: llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -20,3 +20,5 @@ SelectionDAGPrinter.cpp TargetLowering.cpp ) + +target_link_libraries (LLVMSelectionDAG LLVMAnalysis LLVMAsmPrinter LLVMCodeGen) Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/ARM/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -27,3 +27,5 @@ ThumbInstrInfo.cpp ThumbRegisterInfo.cpp ) + +target_link_libraries (LLVMARMCodeGen LLVMSelectionDAG) Modified: llvm/trunk/lib/Target/Alpha/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Alpha/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -23,3 +23,5 @@ AlphaTargetAsmInfo.cpp AlphaTargetMachine.cpp ) + +target_link_libraries (LLVMAlphaCodeGen LLVMSelectionDAG) Modified: llvm/trunk/lib/Target/CellSPU/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/CellSPU/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -22,3 +22,5 @@ SPUTargetAsmInfo.cpp SPUTargetMachine.cpp ) + +target_link_libraries (LLVMCellSPUCodeGen LLVMSelectionDAG) Modified: llvm/trunk/lib/Target/IA64/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/IA64/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -18,3 +18,5 @@ IA64TargetAsmInfo.cpp IA64TargetMachine.cpp ) + +target_link_libraries (LLVMIA64CodeGen LLVMSelectionDAG) Modified: llvm/trunk/lib/Target/Mips/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Mips/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -20,3 +20,5 @@ MipsTargetAsmInfo.cpp MipsTargetMachine.cpp ) + +target_link_libraries (LLVMMipsCodeGen LLVMSelectionDAG) Modified: llvm/trunk/lib/Target/PowerPC/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/PowerPC/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -26,3 +26,5 @@ PPCTargetAsmInfo.cpp PPCTargetMachine.cpp ) + +target_link_libraries (LLVMPowerPCCodeGen LLVMSelectionDAG) Modified: llvm/trunk/lib/Target/Sparc/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/Sparc/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -21,3 +21,5 @@ SparcTargetAsmInfo.cpp SparcTargetMachine.cpp ) + +target_link_libraries (LLVMSparcCodeGen LLVMSelectionDAG) Modified: llvm/trunk/lib/Target/X86/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/CMakeLists.txt?rev=74720&r1=74719&r2=74720&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/X86/CMakeLists.txt Thu Jul 2 13:53:52 2009 @@ -27,3 +27,5 @@ X86TargetMachine.cpp X86FastISel.cpp ) + +target_link_libraries (LLVMX86CodeGen LLVMSelectionDAG) From dalej at apple.com Thu Jul 2 13:57:19 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 02 Jul 2009 18:57:19 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74721 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200907021857.n62IvJQ8019674@zion.cs.uiuc.edu> Author: johannes Date: Thu Jul 2 13:57:15 2009 New Revision: 74721 URL: http://llvm.org/viewvc/llvm-project?rev=74721&view=rev Log: Multiple alternative constraints in asm marches on. Handle matching of hard register operands, and some bug fixes. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74721&r1=74720&r2=74721&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jul 2 13:57:15 2009 @@ -3984,8 +3984,29 @@ /// See if operand "exp" can use the indicated Constraint (which is /// terminated by a null or a comma). /// Returns: -1=no, 0=yes but auxiliary instructions needed, 1=yes and free -int MatchWeight(const char *Constraint, tree exp, bool isInput) { - /// TEMPORARY. This has the effect that alternative 0 is always chosen. +int MatchWeight(const char *Constraint, tree Operand, bool isInput) { + const char *p = Constraint; + // Look for hard register operand. This matches only a constraint of a + // register class that includes that hard register. + if (TREE_CODE(Operand) == VAR_DECL && DECL_HARD_REGISTER(Operand)) { + int RegNum = decode_reg_name(extractRegisterName(Operand)); + if (RegNum >= 0) { + do { + unsigned RegClass; + if (*p == 'r') + RegClass = GENERAL_REGS; + else + RegClass = REG_CLASS_FROM_CONSTRAINT(*p, p); + if (RegClass != NO_REGS && + TEST_HARD_REG_BIT(reg_class_contents[RegClass], RegNum)) + return 0; + ++p; + } while (*p != ',' && *p != 0); + return -1; + } + } + /// TEMPORARY. This has the effect that alternative 0 is always chosen, + /// except in the cases handled above. return 0; } @@ -4027,6 +4048,8 @@ if (i==0) RunningConstraints[j]++; // skip leading = const char* p = RunningConstraints[j]; + while (*p=='*' || *p=='&' || *p=='%') // skip modifiers + p++; if (Weights[i] != -1) { int w = MatchWeight(p, TREE_VALUE(Output), false); // Nonmatch means the entire tuple doesn't match. However, we @@ -4039,8 +4062,11 @@ } while (*p!=0 && *p!=',') p++; - if (*p!=0) - p++; + if (*p!=0) { + p++; // skip comma + while (*p=='*' || *p=='&' || *p=='%') + p++; // skip modifiers + } RunningConstraints[j] = p; } assert(j==NumOutputs); @@ -4048,7 +4074,7 @@ j++, Input = TREE_CHAIN(Input)) { const char* p = RunningConstraints[j]; if (Weights[i] != -1) { - int w = MatchWeight(p, TREE_VALUE(Input), false); + int w = MatchWeight(p, TREE_VALUE(Input), true); if (w < 0) Weights[i] = -1; // As above. else From edwintorok at gmail.com Thu Jul 2 14:11:24 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 02 Jul 2009 22:11:24 +0300 Subject: [llvm-commits] [PATCH] Improve error handling, supersede cerr+abort In-Reply-To: <6a8523d60907010802o84d6bd9k2d19ad928cf1bb1d@mail.gmail.com> References: <4A47D8D4.6060001@gmail.com> <60D5E8C7-05E7-4D68-9D61-E07D83090882@apple.com> <4A4B23CA.2070603@gmail.com> <6a8523d60907010802o84d6bd9k2d19ad928cf1bb1d@mail.gmail.com> Message-ID: <4A4D065C.5080809@gmail.com> On 2009-07-01 18:02, Daniel Dunbar wrote: > 2009/7/1 T?r?k Edwin : > >>> We don't need this. Assertions "can't happen", so assert(0) really is >>> unreachable. >>> >>> >> What if assertions are turned off? Should we just remove the calls to >> abort() after each assert(0)? >> I thought the abort()s were there after the assert(0) so that the >> compiler knows that the codepaths >> never return even with assertions turned off. >> > > The compiler will still know this if we replace such places with a > report_error call, and report_error is marked noreturn. > Yes, llvm_report_error is already marked as noreturn. Can I commit the patch? Best regards, --Edwin -------------- next part -------------- A non-text attachment was scrubbed... Name: error_handling2.patch Type: text/x-diff Size: 6512 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090702/d1dd43d2/attachment.bin From edwintorok at gmail.com Thu Jul 2 14:32:33 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 02 Jul 2009 22:32:33 +0300 Subject: [llvm-commits] [PATCH] New pass: pointer (bounds) tracking! Message-ID: <4A4D0B51.1060302@gmail.com> Hi, The attached patch introduces a new pass that can be queried for allocation size of pointers, and contains a simple solver [*] for (a ult b) inequalities useful in bounds checking. This is based on the bounds checker tool I developed for my undergraduate thesis. If this pass is something that would be accepted in LLVM, I will cleanup the code to conform to LLVM coding style, add testcases, and resubmit the patch. I have just attached the patch now as a preview. I've seen that there is a lot of work being done to support SSI/ABCD. I think my approach is complementary: I try to determine whether the existing bounds checks are sufficient for the safety of a memory access, and not whether any of the bounds checks are redundant and can be removed. I haven't made up by mind whether all this should be in one pass, or I should split it up further: PointerTracking for size information and bounds checking, and SCEVSolver for the SCEV inequality solver? Or maybe the SCEVSolver parts should be integrated directly into ScalarEvolution? [*] The solver uses isLoopGuardedByCond(), but is able to handle more complicated situations by using properties of SCEV expressions, and transitivity of ULT/ULE: - if a SCEVAddRecExpr is monotonic it checks whether the start and exit value is known to be ULT Limit. - for PHI nodes that are SCEVUnknowns it checks whether all parts of the PHI are known to be ULT - if a value is a constant offset away from a PHI: C + X X Author: mai4 Date: Thu Jul 2 15:07:57 2009 New Revision: 74722 URL: http://llvm.org/viewvc/llvm-project?rev=74722&view=rev Log: Confront with latest LLVM API by turning a pointer into a reference Modified: poolalloc/trunk/tools/Pa/pa.cpp Modified: poolalloc/trunk/tools/Pa/pa.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/tools/Pa/pa.cpp?rev=74722&r1=74721&r2=74722&view=diff ============================================================================== --- poolalloc/trunk/tools/Pa/pa.cpp (original) +++ poolalloc/trunk/tools/Pa/pa.cpp Thu Jul 2 15:07:57 2009 @@ -79,7 +79,7 @@ std::string ErrorMessage; if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) { - M.reset(ParseBitcodeFile(Buffer, &Context, &ErrorMessage)); + M.reset(ParseBitcodeFile(Buffer, Context, &ErrorMessage)); delete Buffer; } From dalej at apple.com Thu Jul 2 15:13:17 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 02 Jul 2009 20:13:17 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r74723 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200907022013.n62KDHJc022126@zion.cs.uiuc.edu> Author: johannes Date: Thu Jul 2 15:13:10 2009 New Revision: 74723 URL: http://llvm.org/viewvc/llvm-project?rev=74723&view=rev Log: Make return value of MatchWeight agree with the comment. No functional change (yet). Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=74723&r1=74722&r2=74723&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jul 2 15:13:10 2009 @@ -3999,7 +3999,7 @@ RegClass = REG_CLASS_FROM_CONSTRAINT(*p, p); if (RegClass != NO_REGS && TEST_HARD_REG_BIT(reg_class_contents[RegClass], RegNum)) - return 0; + return 1; ++p; } while (*p != ',' && *p != 0); return -1; From resistor at mac.com Thu Jul 2 15:23:50 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Jul 2009 20:23:50 -0000 Subject: [llvm-commits] [llvm] r74724 - /llvm/trunk/include/llvm/Pass.h Message-ID: <200907022023.n62KNpdV022459@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 2 15:23:41 2009 New Revision: 74724 URL: http://llvm.org/viewvc/llvm-project?rev=74724&view=rev Log: Make the current LLVMContext available to passes. Modified: llvm/trunk/include/llvm/Pass.h Modified: llvm/trunk/include/llvm/Pass.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=74724&r1=74723&r2=74724&view=diff ============================================================================== --- llvm/trunk/include/llvm/Pass.h (original) +++ llvm/trunk/include/llvm/Pass.h Thu Jul 2 15:23:41 2009 @@ -29,6 +29,7 @@ #ifndef LLVM_PASS_H #define LLVM_PASS_H +#include "llvm/Module.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/Streams.h" #include @@ -47,6 +48,7 @@ class PMStack; class AnalysisResolver; class PMDataManager; +class LLVMContext; // AnalysisID - Use the PassInfo to identify a pass... typedef const PassInfo* AnalysisID; @@ -75,6 +77,10 @@ void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT + +protected: + LLVMContext* Context; + public: explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) { assert(pid && "pid cannot be 0"); @@ -275,7 +281,10 @@ /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// - virtual bool doInitialization(Module &) { return false; } + virtual bool doInitialization(Module &M) { + Context = &M.getContext(); + return false; + } /// runOnFunction - Virtual method overriden by subclasses to do the /// per-function processing of the pass. @@ -327,7 +336,10 @@ /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// - virtual bool doInitialization(Module &) { return false; } + virtual bool doInitialization(Module &M) { + Context = &M.getContext(); + return false; + } /// doInitialization - Virtual method overridden by BasicBlockPass subclasses /// to do any necessary per-function initialization. From dgregor at apple.com Thu Jul 2 16:20:15 2009 From: dgregor at apple.com (Douglas Gregor) Date: Thu, 2 Jul 2009 14:20:15 -0700 Subject: [llvm-commits] [patch] cmake target lib dependencies chain update in order to build examples In-Reply-To: <4A4A0990.9020203@zafena.se> References: <4A4A0990.9020203@zafena.se> Message-ID: <845B2921-6CD5-45FB-9096-B4D1BFF458DB@apple.com> On Jun 30, 2009, at 5:48 AM, Xerxes R?nby wrote: > Problem using cmake with -DLLVM_EXAMPLES:BOOL=ON : > [ 99%] Built target HowToUseJIT > Linking CXX executable ../../bin/Kaleidoscope > ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function > `llvm::X86TargetMachine::addInstSelector(llvm::PassManagerBase&, > llvm::CodeGenOpt::Level)': > X86TargetMachine.cpp:(.text+0x720): undefined reference to > `llvm::EnableFastISel' > X86TargetMachine.cpp:(.text+0x733): undefined reference to > `llvm::createDeadMachineInstructionElimPass()' > ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function > `llvm::X86TargetLowering::~X86TargetLowering()': > X86TargetMachine.cpp:(.text._ZN4llvm17X86TargetLoweringD1Ev > [llvm::X86TargetLowering::~X86TargetLowering()]+0x17): undefined > reference to `llvm::TargetLowering::~TargetLowering()' > ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function > `llvm::TargetInstrInfoImpl::~TargetInstrInfoImpl()': > X86TargetMachine.cpp:(.text._ZN4llvm19TargetInstrInfoImplD2Ev > [llvm::TargetInstrInfoImpl::~TargetInstrInfoImpl()]+0x7): undefined > reference to `vtable for llvm::TargetInstrInfoImpl' > ../../lib/libLLVMX86CodeGen.a(X86TargetMachine.cpp.o): In function > `llvm::LLVMTargetMachine::~LLVMTargetMachine()': > X86TargetMachine.cpp:(.text._ZN4llvm17LLVMTargetMachineD2Ev > [llvm::LLVMTargetMachine::~LLVMTargetMachine()]+0x7): undefined > reference to `vtable for llvm::LLVMTargetMachine' > > The patch updates all targets with codegen and asmprinter to deal > with this issue. Okay, I've committed this patch. - Doug From sabre at nondot.org Thu Jul 2 16:29:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 21:29:29 -0000 Subject: [llvm-commits] [compiler-rt] r74725 - /compiler-rt/trunk/www/index.html Message-ID: <200907022129.n62LTWLS024521@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 16:29:19 2009 New Revision: 74725 URL: http://llvm.org/viewvc/llvm-project?rev=74725&view=rev Log: mention the license. Modified: compiler-rt/trunk/www/index.html Modified: compiler-rt/trunk/www/index.html URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/www/index.html?rev=74725&r1=74724&r2=74725&view=diff ============================================================================== --- compiler-rt/trunk/www/index.html (original) +++ compiler-rt/trunk/www/index.html Thu Jul 2 16:29:19 2009 @@ -21,6 +21,10 @@ converting a double to a 64-bit unsigned integer is compiling into a runtime call to the "__fixunsdfdi" function. The compiler-rt library provides optimized implementations of this and other low-level routines.

          + +

          All of the code in the compiler-rt project is available under the standard + LLVM + License, a "BSD-style" license.

          Goals

          From sabre at nondot.org Thu Jul 2 16:34:37 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 21:34:37 -0000 Subject: [llvm-commits] [compiler-rt] r74726 - /compiler-rt/trunk/www/index.html Message-ID: <200907022134.n62LYcBA024718@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 16:34:35 2009 New Revision: 74726 URL: http://llvm.org/viewvc/llvm-project?rev=74726&view=rev Log: test commit Modified: compiler-rt/trunk/www/index.html Modified: compiler-rt/trunk/www/index.html URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/www/index.html?rev=74726&r1=74725&r2=74726&view=diff ============================================================================== --- compiler-rt/trunk/www/index.html (original) +++ compiler-rt/trunk/www/index.html Thu Jul 2 16:34:35 2009 @@ -8,6 +8,7 @@ +
          From sabre at nondot.org Thu Jul 2 16:35:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 21:35:49 -0000 Subject: [llvm-commits] [compiler-rt] r74727 - /compiler-rt/trunk/www/menu.html.incl Message-ID: <200907022135.n62LZoav024765@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 16:35:49 2009 New Revision: 74727 URL: http://llvm.org/viewvc/llvm-project?rev=74727&view=rev Log: fix broken links. Modified: compiler-rt/trunk/www/menu.html.incl Modified: compiler-rt/trunk/www/menu.html.incl URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/www/menu.html.incl?rev=74727&r1=74726&r2=74727&view=diff ============================================================================== --- compiler-rt/trunk/www/menu.html.incl (original) +++ compiler-rt/trunk/www/menu.html.incl Thu Jul 2 16:35:49 2009 @@ -4,7 +4,7 @@
          @@ -13,7 +13,7 @@ llvmdev llvm-commits Bug Reports - Browse SVN - Browse ViewVC + Browse SVN + Browse ViewVC
    From sabre at nondot.org Thu Jul 2 16:53:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 21:53:43 -0000 Subject: [llvm-commits] [llvm] r74728 - /llvm/trunk/tools/llvm-mc/AsmParser.cpp Message-ID: <200907022153.n62Lrhh1025299@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 16:53:43 2009 New Revision: 74728 URL: http://llvm.org/viewvc/llvm-project?rev=74728&view=rev Log: implement error recovery in the llvm-mc parser. Feel the power! Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74728&r1=74727&r2=74728&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Thu Jul 2 16:53:43 2009 @@ -40,11 +40,18 @@ // Prime the lexer. Lexer.Lex(); - while (Lexer.isNot(asmtok::Eof)) - if (ParseStatement()) - return true; + bool HadError = false; - return false; + // While we have input, parse each statement. + while (Lexer.isNot(asmtok::Eof)) { + if (!ParseStatement()) continue; + + // If we had an error, remember it and recover by skipping to the next line. + HadError = true; + EatToEndOfStatement(); + } + + return HadError; } /// EatToEndOfStatement - Throw away the rest of the line for testing purposes. From aaronngray.lists at googlemail.com Thu Jul 2 16:56:26 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Thu, 2 Jul 2009 22:56:26 +0100 Subject: [llvm-commits] [llvm] r74417 - in /llvm/trunk: Makefile.rules include/llvm/CompilerDriver/Main.inc lib/CompilerDriver/BuiltinOptions.cpp lib/CompilerDriver/Makefile lib/CompilerDriver/Tool.cpp In-Reply-To: References: <200906290309.n5T39LPo015790@zion.cs.uiuc.edu> Message-ID: <9719867c0907021456o62853c00qea6579181e63be37@mail.gmail.com> Hi Mikhail, Heres a fix for Cygwin, its been tested on Cygwin and Linux (make check). Aaron 2009/6/29 Mikhail Glushenkov > Hi, > > Howard Su writes: > > > > > > > Great. I can now wait to try. How can I compile a pass as a DLL? > > I guess that you are thinking about *opt* plugins, but this was a *llvmc* > commit. > > Anyway, to compile a dynamic *llvmc* plugin, just cd to the plugin > directory and > run make. > > $ cd tools/llvmc/plugins/Base > $ make > $ cd ../../example/Skeleton > $ make > $ llvmc-skeleton -load $LLVM_DIR/Release/lib/plugin_llvmc_Base.dll --help > > > > Can you include a sample CMakefile? > > No, I don't use cmake. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090702/ceaf3d81/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: CygwinFix.patch Type: application/octet-stream Size: 2660 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090702/ceaf3d81/attachment.obj From david_goodwin at apple.com Thu Jul 2 17:18:36 2009 From: david_goodwin at apple.com (David Goodwin) Date: Thu, 02 Jul 2009 22:18:36 -0000 Subject: [llvm-commits] [llvm] r74731 - in /llvm/trunk/lib/Target/ARM: ARMInstrInfo.cpp ARMInstrInfo.h ARMTargetMachine.cpp ARMTargetMachine.h CMakeLists.txt Thumb1InstrInfo.cpp Thumb1InstrInfo.h Thumb1RegisterInfo.cpp Thumb1RegisterInfo.h Thumb2InstrInfo.cpp Thumb2InstrInfo.h Thumb2RegisterInfo.cpp Thumb2RegisterInfo.h ThumbInstrInfo.cpp ThumbInstrInfo.h ThumbRegisterInfo.cpp ThumbRegisterInfo.h Message-ID: <200907022218.n62MIc4I026264@zion.cs.uiuc.edu> Author: david_goodwin Date: Thu Jul 2 17:18:33 2009 New Revision: 74731 URL: http://llvm.org/viewvc/llvm-project?rev=74731&view=rev Log: Checkpoint refactoring of ThumbInstrInfo and ThumbRegisterInfo into Thumb1InstrInfo, Thumb2InstrInfo, Thumb1RegisterInfo and Thumb2RegisterInfo. Move methods from ARMInstrInfo to ARMBaseInstrInfo to prepare for sharing with Thumb2. Added: llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp - copied, changed from r74702, llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h - copied, changed from r74702, llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp - copied, changed from r74702, llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h - copied, changed from r74702, llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h Removed: llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.h llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.h llvm/trunk/lib/Target/ARM/CMakeLists.txt Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=74731&r1=74730&r2=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Thu Jul 2 17:18:33 2009 @@ -47,91 +47,6 @@ : ARMBaseInstrInfo(STI), RI(*this, STI) { } -/// Return true if the instruction is a register to register move and -/// leave the source and dest operands in the passed parameters. -/// -bool ARMInstrInfo::isMoveInstr(const MachineInstr &MI, - unsigned &SrcReg, unsigned &DstReg, - unsigned& SrcSubIdx, unsigned& DstSubIdx) const { - SrcSubIdx = DstSubIdx = 0; // No sub-registers. - - unsigned oc = MI.getOpcode(); - switch (oc) { - default: - return false; - case ARM::FCPYS: - case ARM::FCPYD: - case ARM::VMOVD: - case ARM::VMOVQ: - SrcReg = MI.getOperand(1).getReg(); - DstReg = MI.getOperand(0).getReg(); - return true; - case ARM::MOVr: - assert(MI.getDesc().getNumOperands() >= 2 && - MI.getOperand(0).isReg() && - MI.getOperand(1).isReg() && - "Invalid ARM MOV instruction"); - SrcReg = MI.getOperand(1).getReg(); - DstReg = MI.getOperand(0).getReg(); - return true; - } -} - -unsigned ARMInstrInfo::isLoadFromStackSlot(const MachineInstr *MI, - int &FrameIndex) const { - switch (MI->getOpcode()) { - default: break; - case ARM::LDR: - if (MI->getOperand(1).isFI() && - MI->getOperand(2).isReg() && - MI->getOperand(3).isImm() && - MI->getOperand(2).getReg() == 0 && - MI->getOperand(3).getImm() == 0) { - FrameIndex = MI->getOperand(1).getIndex(); - return MI->getOperand(0).getReg(); - } - break; - case ARM::FLDD: - case ARM::FLDS: - if (MI->getOperand(1).isFI() && - MI->getOperand(2).isImm() && - MI->getOperand(2).getImm() == 0) { - FrameIndex = MI->getOperand(1).getIndex(); - return MI->getOperand(0).getReg(); - } - break; - } - return 0; -} - -unsigned ARMInstrInfo::isStoreToStackSlot(const MachineInstr *MI, - int &FrameIndex) const { - switch (MI->getOpcode()) { - default: break; - case ARM::STR: - if (MI->getOperand(1).isFI() && - MI->getOperand(2).isReg() && - MI->getOperand(3).isImm() && - MI->getOperand(2).getReg() == 0 && - MI->getOperand(3).getImm() == 0) { - FrameIndex = MI->getOperand(1).getIndex(); - return MI->getOperand(0).getReg(); - } - break; - case ARM::FSTD: - case ARM::FSTS: - if (MI->getOperand(1).isFI() && - MI->getOperand(2).isImm() && - MI->getOperand(2).getImm() == 0) { - FrameIndex = MI->getOperand(1).getIndex(); - return MI->getOperand(0).getReg(); - } - break; - } - - return 0; -} - void ARMInstrInfo::reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, @@ -335,10 +250,10 @@ // Branch analysis. bool - ARMBaseInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, - MachineBasicBlock *&FBB, - SmallVectorImpl &Cond, - bool AllowModify) const { +ARMBaseInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, + MachineBasicBlock *&FBB, + SmallVectorImpl &Cond, + bool AllowModify) const { // If the block has no terminators, it just falls into the block after it. MachineBasicBlock::iterator I = MBB.end(); if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) @@ -478,132 +393,410 @@ return 2; } -bool ARMInstrInfo::copyRegToReg(MachineBasicBlock &MBB, - MachineBasicBlock::iterator I, - unsigned DestReg, unsigned SrcReg, - const TargetRegisterClass *DestRC, - const TargetRegisterClass *SrcRC) const { - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (I != MBB.end()) DL = I->getDebugLoc(); +bool +ARMBaseInstrInfo::BlockHasNoFallThrough(const MachineBasicBlock &MBB) const { + if (MBB.empty()) return false; - if (DestRC != SrcRC) { - // Not yet supported! - return false; + switch (MBB.back().getOpcode()) { + case ARM::BX_RET: // Return. + case ARM::LDM_RET: + case ARM::tBX_RET: + case ARM::tBX_RET_vararg: + case ARM::tPOP_RET: + case ARM::B: + case ARM::tB: + case ARM::t2B: // Uncond branch. + case ARM::tBR_JTr: + case ARM::t2BR_JTr: + case ARM::BR_JTr: // Jumptable branch. + case ARM::t2BR_JTm: + case ARM::BR_JTm: // Jumptable branch through mem. + case ARM::t2BR_JTadd: + case ARM::BR_JTadd: // Jumptable branch add to pc. + return true; + default: return false; } - - if (DestRC == ARM::GPRRegisterClass) - AddDefaultCC(AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::MOVr), DestReg) - .addReg(SrcReg))); - else if (DestRC == ARM::SPRRegisterClass) - AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FCPYS), DestReg) - .addReg(SrcReg)); - else if (DestRC == ARM::DPRRegisterClass) - AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FCPYD), DestReg) - .addReg(SrcReg)); - else if (DestRC == ARM::QPRRegisterClass) - BuildMI(MBB, I, DL, get(ARM::VMOVQ), DestReg).addReg(SrcReg); - else - return false; - - return true; } -void ARMInstrInfo:: -storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - unsigned SrcReg, bool isKill, int FI, - const TargetRegisterClass *RC) const { - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (I != MBB.end()) DL = I->getDebugLoc(); +bool ARMBaseInstrInfo:: +ReverseBranchCondition(SmallVectorImpl &Cond) const { + ARMCC::CondCodes CC = (ARMCC::CondCodes)(int)Cond[0].getImm(); + Cond[0].setImm(ARMCC::getOppositeCondition(CC)); + return false; +} - if (RC == ARM::GPRRegisterClass) { - AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::STR)) - .addReg(SrcReg, getKillRegState(isKill)) - .addFrameIndex(FI).addReg(0).addImm(0)); - } else if (RC == ARM::DPRRegisterClass) { - AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FSTD)) - .addReg(SrcReg, getKillRegState(isKill)) - .addFrameIndex(FI).addImm(0)); - } else { - assert(RC == ARM::SPRRegisterClass && "Unknown regclass!"); - AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FSTS)) - .addReg(SrcReg, getKillRegState(isKill)) - .addFrameIndex(FI).addImm(0)); - } +bool ARMBaseInstrInfo::isPredicated(const MachineInstr *MI) const { + int PIdx = MI->findFirstPredOperandIdx(); + return PIdx != -1 && MI->getOperand(PIdx).getImm() != ARMCC::AL; } -void ARMInstrInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - bool isKill, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const{ - DebugLoc DL = DebugLoc::getUnknownLoc(); - unsigned Opc = 0; - if (RC == ARM::GPRRegisterClass) { - Opc = ARM::STR; - } else if (RC == ARM::DPRRegisterClass) { - Opc = ARM::FSTD; - } else { - assert(RC == ARM::SPRRegisterClass && "Unknown regclass!"); - Opc = ARM::FSTS; +bool ARMBaseInstrInfo:: +PredicateInstruction(MachineInstr *MI, + const SmallVectorImpl &Pred) const { + unsigned Opc = MI->getOpcode(); + if (Opc == ARM::B || Opc == ARM::tB || Opc == ARM::t2B) { + MI->setDesc(get((Opc == ARM::B) ? ARM::Bcc : + ((Opc == ARM::tB) ? ARM::tBcc : ARM::t2Bcc))); + MI->addOperand(MachineOperand::CreateImm(Pred[0].getImm())); + MI->addOperand(MachineOperand::CreateReg(Pred[1].getReg(), false)); + return true; } - MachineInstrBuilder MIB = - BuildMI(MF, DL, get(Opc)).addReg(SrcReg, getKillRegState(isKill)); - for (unsigned i = 0, e = Addr.size(); i != e; ++i) - MIB.addOperand(Addr[i]); - AddDefaultPred(MIB); - NewMIs.push_back(MIB); - return; + int PIdx = MI->findFirstPredOperandIdx(); + if (PIdx != -1) { + MachineOperand &PMO = MI->getOperand(PIdx); + PMO.setImm(Pred[0].getImm()); + MI->getOperand(PIdx+1).setReg(Pred[1].getReg()); + return true; + } + return false; } -void ARMInstrInfo:: -loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - unsigned DestReg, int FI, - const TargetRegisterClass *RC) const { - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (I != MBB.end()) DL = I->getDebugLoc(); +bool ARMBaseInstrInfo:: +SubsumesPredicate(const SmallVectorImpl &Pred1, + const SmallVectorImpl &Pred2) const { + if (Pred1.size() > 2 || Pred2.size() > 2) + return false; - if (RC == ARM::GPRRegisterClass) { - AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::LDR), DestReg) - .addFrameIndex(FI).addReg(0).addImm(0)); - } else if (RC == ARM::DPRRegisterClass) { - AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FLDD), DestReg) - .addFrameIndex(FI).addImm(0)); - } else { - assert(RC == ARM::SPRRegisterClass && "Unknown regclass!"); - AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FLDS), DestReg) - .addFrameIndex(FI).addImm(0)); + ARMCC::CondCodes CC1 = (ARMCC::CondCodes)Pred1[0].getImm(); + ARMCC::CondCodes CC2 = (ARMCC::CondCodes)Pred2[0].getImm(); + if (CC1 == CC2) + return true; + + switch (CC1) { + default: + return false; + case ARMCC::AL: + return true; + case ARMCC::HS: + return CC2 == ARMCC::HI; + case ARMCC::LS: + return CC2 == ARMCC::LO || CC2 == ARMCC::EQ; + case ARMCC::GE: + return CC2 == ARMCC::GT; + case ARMCC::LE: + return CC2 == ARMCC::LT; } } -void ARMInstrInfo:: -loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const { - DebugLoc DL = DebugLoc::getUnknownLoc(); - unsigned Opc = 0; - if (RC == ARM::GPRRegisterClass) { - Opc = ARM::LDR; - } else if (RC == ARM::DPRRegisterClass) { - Opc = ARM::FLDD; - } else { - assert(RC == ARM::SPRRegisterClass && "Unknown regclass!"); - Opc = ARM::FLDS; +bool ARMBaseInstrInfo::DefinesPredicate(MachineInstr *MI, + std::vector &Pred) const { + const TargetInstrDesc &TID = MI->getDesc(); + if (!TID.getImplicitDefs() && !TID.hasOptionalDef()) + return false; + + bool Found = false; + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = MI->getOperand(i); + if (MO.isReg() && MO.getReg() == ARM::CPSR) { + Pred.push_back(MO); + Found = true; + } } - MachineInstrBuilder MIB = BuildMI(MF, DL, get(Opc), DestReg); - for (unsigned i = 0, e = Addr.size(); i != e; ++i) - MIB.addOperand(Addr[i]); - AddDefaultPred(MIB); - NewMIs.push_back(MIB); - return; + return Found; } -MachineInstr *ARMInstrInfo:: -foldMemoryOperandImpl(MachineFunction &MF, MachineInstr *MI, - const SmallVectorImpl &Ops, int FI) const { - if (Ops.size() != 1) return NULL; + +/// FIXME: Works around a gcc miscompilation with -fstrict-aliasing +static unsigned getNumJTEntries(const std::vector &JT, + unsigned JTI) DISABLE_INLINE; +static unsigned getNumJTEntries(const std::vector &JT, + unsigned JTI) { + return JT[JTI].MBBs.size(); +} + +/// GetInstSize - Return the size of the specified MachineInstr. +/// +unsigned ARMBaseInstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const { + const MachineBasicBlock &MBB = *MI->getParent(); + const MachineFunction *MF = MBB.getParent(); + const TargetAsmInfo *TAI = MF->getTarget().getTargetAsmInfo(); + + // Basic size info comes from the TSFlags field. + const TargetInstrDesc &TID = MI->getDesc(); + unsigned TSFlags = TID.TSFlags; + + switch ((TSFlags & ARMII::SizeMask) >> ARMII::SizeShift) { + default: { + // If this machine instr is an inline asm, measure it. + if (MI->getOpcode() == ARM::INLINEASM) + return TAI->getInlineAsmLength(MI->getOperand(0).getSymbolName()); + if (MI->isLabel()) + return 0; + switch (MI->getOpcode()) { + default: + assert(0 && "Unknown or unset size field for instr!"); + break; + case TargetInstrInfo::IMPLICIT_DEF: + case TargetInstrInfo::DECLARE: + case TargetInstrInfo::DBG_LABEL: + case TargetInstrInfo::EH_LABEL: + return 0; + } + break; + } + case ARMII::Size8Bytes: return 8; // Arm instruction x 2. + case ARMII::Size4Bytes: return 4; // Arm instruction. + case ARMII::Size2Bytes: return 2; // Thumb instruction. + case ARMII::SizeSpecial: { + switch (MI->getOpcode()) { + case ARM::CONSTPOOL_ENTRY: + // If this machine instr is a constant pool entry, its size is recorded as + // operand #2. + return MI->getOperand(2).getImm(); + case ARM::Int_eh_sjlj_setjmp: return 12; + case ARM::BR_JTr: + case ARM::BR_JTm: + case ARM::BR_JTadd: + case ARM::t2BR_JTr: + case ARM::t2BR_JTm: + case ARM::t2BR_JTadd: + case ARM::tBR_JTr: { + // These are jumptable branches, i.e. a branch followed by an inlined + // jumptable. The size is 4 + 4 * number of entries. + unsigned NumOps = TID.getNumOperands(); + MachineOperand JTOP = + MI->getOperand(NumOps - (TID.isPredicable() ? 3 : 2)); + unsigned JTI = JTOP.getIndex(); + const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); + const std::vector &JT = MJTI->getJumpTables(); + assert(JTI < JT.size()); + // Thumb instructions are 2 byte aligned, but JT entries are 4 byte + // 4 aligned. The assembler / linker may add 2 byte padding just before + // the JT entries. The size does not include this padding; the + // constant islands pass does separate bookkeeping for it. + // FIXME: If we know the size of the function is less than (1 << 16) *2 + // bytes, we can use 16-bit entries instead. Then there won't be an + // alignment issue. + return getNumJTEntries(JT, JTI) * 4 + + ((MI->getOpcode()==ARM::tBR_JTr) ? 2 : 4); + } + default: + // Otherwise, pseudo-instruction sizes are zero. + return 0; + } + } + } + return 0; // Not reached +} + +/// Return true if the instruction is a register to register move and +/// leave the source and dest operands in the passed parameters. +/// +bool +ARMBaseInstrInfo::isMoveInstr(const MachineInstr &MI, + unsigned &SrcReg, unsigned &DstReg, + unsigned& SrcSubIdx, unsigned& DstSubIdx) const { + SrcSubIdx = DstSubIdx = 0; // No sub-registers. + + unsigned oc = MI.getOpcode(); + switch (oc) { + default: + return false; + case ARM::FCPYS: + case ARM::FCPYD: + case ARM::VMOVD: + case ARM::VMOVQ: + SrcReg = MI.getOperand(1).getReg(); + DstReg = MI.getOperand(0).getReg(); + return true; + case ARM::MOVr: + assert(MI.getDesc().getNumOperands() >= 2 && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && + "Invalid ARM MOV instruction"); + SrcReg = MI.getOperand(1).getReg(); + DstReg = MI.getOperand(0).getReg(); + return true; + } +} + +unsigned +ARMBaseInstrInfo::isLoadFromStackSlot(const MachineInstr *MI, + int &FrameIndex) const { + switch (MI->getOpcode()) { + default: break; + case ARM::LDR: + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isReg() && + MI->getOperand(3).isImm() && + MI->getOperand(2).getReg() == 0 && + MI->getOperand(3).getImm() == 0) { + FrameIndex = MI->getOperand(1).getIndex(); + return MI->getOperand(0).getReg(); + } + break; + case ARM::FLDD: + case ARM::FLDS: + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isImm() && + MI->getOperand(2).getImm() == 0) { + FrameIndex = MI->getOperand(1).getIndex(); + return MI->getOperand(0).getReg(); + } + break; + } + return 0; +} + +unsigned +ARMBaseInstrInfo::isStoreToStackSlot(const MachineInstr *MI, + int &FrameIndex) const { + switch (MI->getOpcode()) { + default: break; + case ARM::STR: + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isReg() && + MI->getOperand(3).isImm() && + MI->getOperand(2).getReg() == 0 && + MI->getOperand(3).getImm() == 0) { + FrameIndex = MI->getOperand(1).getIndex(); + return MI->getOperand(0).getReg(); + } + break; + case ARM::FSTD: + case ARM::FSTS: + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isImm() && + MI->getOperand(2).getImm() == 0) { + FrameIndex = MI->getOperand(1).getIndex(); + return MI->getOperand(0).getReg(); + } + break; + } + + return 0; +} + +bool +ARMBaseInstrInfo::copyRegToReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *DestRC, + const TargetRegisterClass *SrcRC) const { + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (I != MBB.end()) DL = I->getDebugLoc(); + + if (DestRC != SrcRC) { + // Not yet supported! + return false; + } + + if (DestRC == ARM::GPRRegisterClass) + AddDefaultCC(AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::MOVr), DestReg) + .addReg(SrcReg))); + else if (DestRC == ARM::SPRRegisterClass) + AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FCPYS), DestReg) + .addReg(SrcReg)); + else if (DestRC == ARM::DPRRegisterClass) + AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FCPYD), DestReg) + .addReg(SrcReg)); + else if (DestRC == ARM::QPRRegisterClass) + BuildMI(MBB, I, DL, get(ARM::VMOVQ), DestReg).addReg(SrcReg); + else + return false; + + return true; +} + +void ARMBaseInstrInfo:: +storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, + unsigned SrcReg, bool isKill, int FI, + const TargetRegisterClass *RC) const { + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (I != MBB.end()) DL = I->getDebugLoc(); + + if (RC == ARM::GPRRegisterClass) { + AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::STR)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI).addReg(0).addImm(0)); + } else if (RC == ARM::DPRRegisterClass) { + AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FSTD)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI).addImm(0)); + } else { + assert(RC == ARM::SPRRegisterClass && "Unknown regclass!"); + AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FSTS)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI).addImm(0)); + } +} + +void +ARMBaseInstrInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, + bool isKill, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, + SmallVectorImpl &NewMIs) const{ + DebugLoc DL = DebugLoc::getUnknownLoc(); + unsigned Opc = 0; + if (RC == ARM::GPRRegisterClass) { + Opc = ARM::STR; + } else if (RC == ARM::DPRRegisterClass) { + Opc = ARM::FSTD; + } else { + assert(RC == ARM::SPRRegisterClass && "Unknown regclass!"); + Opc = ARM::FSTS; + } + + MachineInstrBuilder MIB = + BuildMI(MF, DL, get(Opc)).addReg(SrcReg, getKillRegState(isKill)); + for (unsigned i = 0, e = Addr.size(); i != e; ++i) + MIB.addOperand(Addr[i]); + AddDefaultPred(MIB); + NewMIs.push_back(MIB); + return; +} + +void ARMBaseInstrInfo:: +loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, + unsigned DestReg, int FI, + const TargetRegisterClass *RC) const { + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (I != MBB.end()) DL = I->getDebugLoc(); + + if (RC == ARM::GPRRegisterClass) { + AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::LDR), DestReg) + .addFrameIndex(FI).addReg(0).addImm(0)); + } else if (RC == ARM::DPRRegisterClass) { + AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FLDD), DestReg) + .addFrameIndex(FI).addImm(0)); + } else { + assert(RC == ARM::SPRRegisterClass && "Unknown regclass!"); + AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::FLDS), DestReg) + .addFrameIndex(FI).addImm(0)); + } +} + +void ARMBaseInstrInfo:: +loadRegFromAddr(MachineFunction &MF, unsigned DestReg, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, + SmallVectorImpl &NewMIs) const { + DebugLoc DL = DebugLoc::getUnknownLoc(); + unsigned Opc = 0; + if (RC == ARM::GPRRegisterClass) { + Opc = ARM::LDR; + } else if (RC == ARM::DPRRegisterClass) { + Opc = ARM::FLDD; + } else { + assert(RC == ARM::SPRRegisterClass && "Unknown regclass!"); + Opc = ARM::FLDS; + } + + MachineInstrBuilder MIB = BuildMI(MF, DL, get(Opc), DestReg); + for (unsigned i = 0, e = Addr.size(); i != e; ++i) + MIB.addOperand(Addr[i]); + AddDefaultPred(MIB); + NewMIs.push_back(MIB); + return; +} + +MachineInstr *ARMBaseInstrInfo:: +foldMemoryOperandImpl(MachineFunction &MF, MachineInstr *MI, + const SmallVectorImpl &Ops, int FI) const { + if (Ops.size() != 1) return NULL; unsigned OpNum = Ops[0]; unsigned Opc = MI->getOpcode(); @@ -688,9 +881,17 @@ return NewMI; } +MachineInstr* +ARMBaseInstrInfo::foldMemoryOperandImpl(MachineFunction &MF, + MachineInstr* MI, + const SmallVectorImpl &Ops, + MachineInstr* LoadMI) const { + return 0; +} + bool -ARMInstrInfo::canFoldMemoryOperand(const MachineInstr *MI, - const SmallVectorImpl &Ops) const { +ARMBaseInstrInfo::canFoldMemoryOperand(const MachineInstr *MI, + const SmallVectorImpl &Ops) const { if (Ops.size() != 1) return false; unsigned Opc = MI->getOpcode(); @@ -710,191 +911,3 @@ return false; } - -bool -ARMBaseInstrInfo::BlockHasNoFallThrough(const MachineBasicBlock &MBB) const { - if (MBB.empty()) return false; - - switch (MBB.back().getOpcode()) { - case ARM::BX_RET: // Return. - case ARM::LDM_RET: - case ARM::tBX_RET: - case ARM::tBX_RET_vararg: - case ARM::tPOP_RET: - case ARM::B: - case ARM::tB: - case ARM::t2B: // Uncond branch. - case ARM::tBR_JTr: - case ARM::t2BR_JTr: - case ARM::BR_JTr: // Jumptable branch. - case ARM::t2BR_JTm: - case ARM::BR_JTm: // Jumptable branch through mem. - case ARM::t2BR_JTadd: - case ARM::BR_JTadd: // Jumptable branch add to pc. - return true; - default: return false; - } -} - -bool ARMBaseInstrInfo:: -ReverseBranchCondition(SmallVectorImpl &Cond) const { - ARMCC::CondCodes CC = (ARMCC::CondCodes)(int)Cond[0].getImm(); - Cond[0].setImm(ARMCC::getOppositeCondition(CC)); - return false; -} - -bool ARMBaseInstrInfo::isPredicated(const MachineInstr *MI) const { - int PIdx = MI->findFirstPredOperandIdx(); - return PIdx != -1 && MI->getOperand(PIdx).getImm() != ARMCC::AL; -} - -bool ARMBaseInstrInfo:: -PredicateInstruction(MachineInstr *MI, - const SmallVectorImpl &Pred) const { - unsigned Opc = MI->getOpcode(); - if (Opc == ARM::B || Opc == ARM::tB || Opc == ARM::t2B) { - MI->setDesc(get((Opc == ARM::B) ? ARM::Bcc : - ((Opc == ARM::tB) ? ARM::tBcc : ARM::t2Bcc))); - MI->addOperand(MachineOperand::CreateImm(Pred[0].getImm())); - MI->addOperand(MachineOperand::CreateReg(Pred[1].getReg(), false)); - return true; - } - - int PIdx = MI->findFirstPredOperandIdx(); - if (PIdx != -1) { - MachineOperand &PMO = MI->getOperand(PIdx); - PMO.setImm(Pred[0].getImm()); - MI->getOperand(PIdx+1).setReg(Pred[1].getReg()); - return true; - } - return false; -} - -bool ARMBaseInstrInfo:: -SubsumesPredicate(const SmallVectorImpl &Pred1, - const SmallVectorImpl &Pred2) const { - if (Pred1.size() > 2 || Pred2.size() > 2) - return false; - - ARMCC::CondCodes CC1 = (ARMCC::CondCodes)Pred1[0].getImm(); - ARMCC::CondCodes CC2 = (ARMCC::CondCodes)Pred2[0].getImm(); - if (CC1 == CC2) - return true; - - switch (CC1) { - default: - return false; - case ARMCC::AL: - return true; - case ARMCC::HS: - return CC2 == ARMCC::HI; - case ARMCC::LS: - return CC2 == ARMCC::LO || CC2 == ARMCC::EQ; - case ARMCC::GE: - return CC2 == ARMCC::GT; - case ARMCC::LE: - return CC2 == ARMCC::LT; - } -} - -bool ARMBaseInstrInfo::DefinesPredicate(MachineInstr *MI, - std::vector &Pred) const { - const TargetInstrDesc &TID = MI->getDesc(); - if (!TID.getImplicitDefs() && !TID.hasOptionalDef()) - return false; - - bool Found = false; - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.getReg() == ARM::CPSR) { - Pred.push_back(MO); - Found = true; - } - } - - return Found; -} - - -/// FIXME: Works around a gcc miscompilation with -fstrict-aliasing -static unsigned getNumJTEntries(const std::vector &JT, - unsigned JTI) DISABLE_INLINE; -static unsigned getNumJTEntries(const std::vector &JT, - unsigned JTI) { - return JT[JTI].MBBs.size(); -} - -/// GetInstSize - Return the size of the specified MachineInstr. -/// -unsigned ARMBaseInstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const { - const MachineBasicBlock &MBB = *MI->getParent(); - const MachineFunction *MF = MBB.getParent(); - const TargetAsmInfo *TAI = MF->getTarget().getTargetAsmInfo(); - - // Basic size info comes from the TSFlags field. - const TargetInstrDesc &TID = MI->getDesc(); - unsigned TSFlags = TID.TSFlags; - - switch ((TSFlags & ARMII::SizeMask) >> ARMII::SizeShift) { - default: { - // If this machine instr is an inline asm, measure it. - if (MI->getOpcode() == ARM::INLINEASM) - return TAI->getInlineAsmLength(MI->getOperand(0).getSymbolName()); - if (MI->isLabel()) - return 0; - switch (MI->getOpcode()) { - default: - assert(0 && "Unknown or unset size field for instr!"); - break; - case TargetInstrInfo::IMPLICIT_DEF: - case TargetInstrInfo::DECLARE: - case TargetInstrInfo::DBG_LABEL: - case TargetInstrInfo::EH_LABEL: - return 0; - } - break; - } - case ARMII::Size8Bytes: return 8; // Arm instruction x 2. - case ARMII::Size4Bytes: return 4; // Arm instruction. - case ARMII::Size2Bytes: return 2; // Thumb instruction. - case ARMII::SizeSpecial: { - switch (MI->getOpcode()) { - case ARM::CONSTPOOL_ENTRY: - // If this machine instr is a constant pool entry, its size is recorded as - // operand #2. - return MI->getOperand(2).getImm(); - case ARM::Int_eh_sjlj_setjmp: return 12; - case ARM::BR_JTr: - case ARM::BR_JTm: - case ARM::BR_JTadd: - case ARM::t2BR_JTr: - case ARM::t2BR_JTm: - case ARM::t2BR_JTadd: - case ARM::tBR_JTr: { - // These are jumptable branches, i.e. a branch followed by an inlined - // jumptable. The size is 4 + 4 * number of entries. - unsigned NumOps = TID.getNumOperands(); - MachineOperand JTOP = - MI->getOperand(NumOps - (TID.isPredicable() ? 3 : 2)); - unsigned JTI = JTOP.getIndex(); - const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); - const std::vector &JT = MJTI->getJumpTables(); - assert(JTI < JT.size()); - // Thumb instructions are 2 byte aligned, but JT entries are 4 byte - // 4 aligned. The assembler / linker may add 2 byte padding just before - // the JT entries. The size does not include this padding; the - // constant islands pass does separate bookkeeping for it. - // FIXME: If we know the size of the function is less than (1 << 16) *2 - // bytes, we can use 16-bit entries instead. Then there won't be an - // alignment issue. - return getNumJTEntries(JT, JTI) * 4 + - ((MI->getOpcode()==ARM::tBR_JTr) ? 2 : 4); - } - default: - // Otherwise, pseudo-instruction sizes are zero. - return 0; - } - } - } - return 0; // Not reached -} Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=74731&r1=74730&r2=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Thu Jul 2 17:18:33 2009 @@ -161,6 +161,8 @@ MachineBasicBlock::iterator &MBBI, LiveVariables *LV) const; + virtual const ARMBaseRegisterInfo &getRegisterInfo() const =0; + // Branch analysis. virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, @@ -198,18 +200,6 @@ /// GetInstSize - Returns the size of the specified MachineInstr. /// virtual unsigned GetInstSizeInBytes(const MachineInstr* MI) const; -}; - -class ARMInstrInfo : public ARMBaseInstrInfo { - ARMRegisterInfo RI; -public: - explicit ARMInstrInfo(const ARMSubtarget &STI); - - /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As - /// such, whenever a client has an instance of instruction info, it should - /// always be able to get register info as well (through this method). - /// - virtual const ARMRegisterInfo &getRegisterInfo() const { return RI; } /// Return true if the instruction is a register to register move and return /// the source and dest operands and their sub-register indices by reference. @@ -247,23 +237,33 @@ const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; - void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, - unsigned DestReg, const MachineInstr *Orig) const; - virtual bool canFoldMemoryOperand(const MachineInstr *MI, const SmallVectorImpl &Ops) const; - + virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, MachineInstr* MI, - const SmallVectorImpl &Ops, + const SmallVectorImpl &Ops, int FrameIndex) const; virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, MachineInstr* MI, - const SmallVectorImpl &Ops, - MachineInstr* LoadMI) const { - return 0; - } + const SmallVectorImpl &Ops, + MachineInstr* LoadMI) const; +}; + +class ARMInstrInfo : public ARMBaseInstrInfo { + ARMRegisterInfo RI; +public: + explicit ARMInstrInfo(const ARMSubtarget &STI); + + /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As + /// such, whenever a client has an instance of instruction info, it should + /// always be able to get register info as well (through this method). + /// + const ARMRegisterInfo &getRegisterInfo() const { return RI; } + + void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, + unsigned DestReg, const MachineInstr *Orig) const; }; } Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=74731&r1=74730&r2=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Thu Jul 2 17:18:33 2009 @@ -95,13 +95,18 @@ } ThumbTargetMachine::ThumbTargetMachine(const Module &M, const std::string &FS) - : ARMBaseTargetMachine(M, FS, true), InstrInfo(Subtarget), + : ARMBaseTargetMachine(M, FS, true), DataLayout(Subtarget.isAPCS_ABI() ? std::string("e-p:32:32-f64:32:32-i64:32:32-" "i16:16:32-i8:8:32-i1:8:32-a:0:32") : std::string("e-p:32:32-f64:64:64-i64:64:64-" "i16:16:32-i8:8:32-i1:8:32-a:0:32")), TLInfo(*this) { + // Create the approriate type of Thumb InstrInfo + if (Subtarget.hasThumb2()) + InstrInfo = new Thumb2InstrInfo(Subtarget); + else + InstrInfo = new Thumb1InstrInfo(Subtarget); } unsigned ARMTargetMachine::getJITMatchQuality() { Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=74731&r1=74730&r2=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Thu Jul 2 17:18:33 2009 @@ -22,7 +22,8 @@ #include "ARMJITInfo.h" #include "ARMSubtarget.h" #include "ARMISelLowering.h" -#include "ThumbInstrInfo.h" +#include "Thumb1InstrInfo.h" +#include "Thumb2InstrInfo.h" namespace llvm { @@ -111,23 +112,27 @@ }; /// ThumbTargetMachine - Thumb target machine. +/// Due to the way architectures are handled, this represents both +/// Thumb-1 and Thumb-2. /// class ThumbTargetMachine : public ARMBaseTargetMachine { - ThumbInstrInfo InstrInfo; - const TargetData DataLayout; // Calculates type size & alignment + ARMBaseInstrInfo *InstrInfo; // either Thumb1InstrInfo or Thumb2InstrInfo + const TargetData DataLayout; // Calculates type size & alignment ARMTargetLowering TLInfo; public: ThumbTargetMachine(const Module &M, const std::string &FS); - virtual const ThumbRegisterInfo *getRegisterInfo() const { - return &InstrInfo.getRegisterInfo(); + /// returns either Thumb1RegisterInfo of Thumb2RegisterInfo + virtual const ARMBaseRegisterInfo *getRegisterInfo() const { + return &InstrInfo->getRegisterInfo(); } - virtual ARMTargetLowering *getTargetLowering() const { + virtual ARMTargetLowering *getTargetLowering() const { return const_cast(&TLInfo); } - virtual const ThumbInstrInfo *getInstrInfo() const { return &InstrInfo; } + /// returns either Thumb1InstrInfo or Thumb2InstrInfo + virtual const ARMBaseInstrInfo *getInstrInfo() const { return InstrInfo; } virtual const TargetData *getTargetData() const { return &DataLayout; } static unsigned getJITMatchQuality(); Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/CMakeLists.txt?rev=74731&r1=74730&r2=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/ARM/CMakeLists.txt Thu Jul 2 17:18:33 2009 @@ -24,8 +24,10 @@ ARMSubtarget.cpp ARMTargetAsmInfo.cpp ARMTargetMachine.cpp - ThumbInstrInfo.cpp - ThumbRegisterInfo.cpp + Thumb1InstrInfo.cpp + Thumb1RegisterInfo.cpp + Thumb2InstrInfo.cpp + Thumb2RegisterInfo.cpp ) target_link_libraries (LLVMARMCodeGen LLVMSelectionDAG) Copied: llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp (from r74702, llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp?p2=llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp&p1=llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp&r1=74702&r2=74731&rev=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp Thu Jul 2 17:18:33 2009 @@ -1,4 +1,4 @@ -//===- ThumbInstrInfo.cpp - Thumb Instruction Information --------*- C++ -*-===// +//===- Thumb1InstrInfo.cpp - Thumb-1 Instruction Information --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file contains the Thumb implementation of the TargetInstrInfo class. +// This file contains the Thumb-1 implementation of the TargetInstrInfo class. // //===----------------------------------------------------------------------===// @@ -18,24 +18,23 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/ADT/SmallVector.h" -#include "ThumbInstrInfo.h" +#include "Thumb1InstrInfo.h" using namespace llvm; -ThumbInstrInfo::ThumbInstrInfo(const ARMSubtarget &STI) +Thumb1InstrInfo::Thumb1InstrInfo(const ARMSubtarget &STI) : ARMBaseInstrInfo(STI), RI(*this, STI) { } -bool ThumbInstrInfo::isMoveInstr(const MachineInstr &MI, - unsigned &SrcReg, unsigned &DstReg, - unsigned& SrcSubIdx, unsigned& DstSubIdx) const { +bool Thumb1InstrInfo::isMoveInstr(const MachineInstr &MI, + unsigned &SrcReg, unsigned &DstReg, + unsigned& SrcSubIdx, unsigned& DstSubIdx) const { SrcSubIdx = DstSubIdx = 0; // No sub-registers. unsigned oc = MI.getOpcode(); switch (oc) { default: return false; - // FIXME: Thumb2 case ARM::tMOVr: case ARM::tMOVhir2lor: case ARM::tMOVlor2hir: @@ -50,11 +49,10 @@ } } -unsigned ThumbInstrInfo::isLoadFromStackSlot(const MachineInstr *MI, - int &FrameIndex) const { +unsigned Thumb1InstrInfo::isLoadFromStackSlot(const MachineInstr *MI, + int &FrameIndex) const { switch (MI->getOpcode()) { default: break; - // FIXME: Thumb2 case ARM::tRestore: if (MI->getOperand(1).isFI() && MI->getOperand(2).isImm() && @@ -67,11 +65,10 @@ return 0; } -unsigned ThumbInstrInfo::isStoreToStackSlot(const MachineInstr *MI, - int &FrameIndex) const { +unsigned Thumb1InstrInfo::isStoreToStackSlot(const MachineInstr *MI, + int &FrameIndex) const { switch (MI->getOpcode()) { default: break; - // FIXME: Thumb2 case ARM::tSpill: if (MI->getOperand(1).isFI() && MI->getOperand(2).isImm() && @@ -84,15 +81,14 @@ return 0; } -bool ThumbInstrInfo::copyRegToReg(MachineBasicBlock &MBB, - MachineBasicBlock::iterator I, - unsigned DestReg, unsigned SrcReg, - const TargetRegisterClass *DestRC, - const TargetRegisterClass *SrcRC) const { +bool Thumb1InstrInfo::copyRegToReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *DestRC, + const TargetRegisterClass *SrcRC) const { DebugLoc DL = DebugLoc::getUnknownLoc(); if (I != MBB.end()) DL = I->getDebugLoc(); - // FIXME: Thumb2 if (DestRC == ARM::GPRRegisterClass) { if (SrcRC == ARM::GPRRegisterClass) { BuildMI(MBB, I, DL, get(ARM::tMOVhir2hir), DestReg).addReg(SrcReg); @@ -114,7 +110,7 @@ return false; } -bool ThumbInstrInfo:: +bool Thumb1InstrInfo:: canFoldMemoryOperand(const MachineInstr *MI, const SmallVectorImpl &Ops) const { if (Ops.size() != 1) return false; @@ -145,7 +141,7 @@ return false; } -void ThumbInstrInfo:: +void Thumb1InstrInfo:: storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned SrcReg, bool isKill, int FI, const TargetRegisterClass *RC) const { @@ -154,7 +150,6 @@ assert(RC == ARM::tGPRRegisterClass && "Unknown regclass!"); - // FIXME: Thumb2 if (RC == ARM::tGPRRegisterClass) { BuildMI(MBB, I, DL, get(ARM::tSpill)) .addReg(SrcReg, getKillRegState(isKill)) @@ -162,15 +157,14 @@ } } -void ThumbInstrInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - bool isKill, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const{ +void Thumb1InstrInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, + bool isKill, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, + SmallVectorImpl &NewMIs) const{ DebugLoc DL = DebugLoc::getUnknownLoc(); unsigned Opc = 0; - // FIXME: Thumb2. Is GPRRegClass here correct? assert(RC == ARM::GPRRegisterClass && "Unknown regclass!"); if (RC == ARM::GPRRegisterClass) { Opc = Addr[0].isFI() ? ARM::tSpill : ARM::tSTR; @@ -184,14 +178,13 @@ return; } -void ThumbInstrInfo:: +void Thumb1InstrInfo:: loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, int FI, const TargetRegisterClass *RC) const { DebugLoc DL = DebugLoc::getUnknownLoc(); if (I != MBB.end()) DL = I->getDebugLoc(); - // FIXME: Thumb2 assert(RC == ARM::tGPRRegisterClass && "Unknown regclass!"); if (RC == ARM::tGPRRegisterClass) { @@ -200,7 +193,7 @@ } } -void ThumbInstrInfo:: +void Thumb1InstrInfo:: loadRegFromAddr(MachineFunction &MF, unsigned DestReg, SmallVectorImpl &Addr, const TargetRegisterClass *RC, @@ -208,7 +201,6 @@ DebugLoc DL = DebugLoc::getUnknownLoc(); unsigned Opc = 0; - // FIXME: Thumb2. Is GPRRegClass ok here? if (RC == ARM::GPRRegisterClass) { Opc = Addr[0].isFI() ? ARM::tRestore : ARM::tLDR; } @@ -220,7 +212,7 @@ return; } -bool ThumbInstrInfo:: +bool Thumb1InstrInfo:: spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector &CSI) const { @@ -240,7 +232,7 @@ return true; } -bool ThumbInstrInfo:: +bool Thumb1InstrInfo:: restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector &CSI) const { @@ -271,7 +263,7 @@ return true; } -MachineInstr *ThumbInstrInfo:: +MachineInstr *Thumb1InstrInfo:: foldMemoryOperandImpl(MachineFunction &MF, MachineInstr *MI, const SmallVectorImpl &Ops, int FI) const { if (Ops.size() != 1) return NULL; Copied: llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h (from r74702, llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h?p2=llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h&p1=llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h&r1=74702&r2=74731&rev=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h Thu Jul 2 17:18:33 2009 @@ -1,4 +1,4 @@ -//===- ThumbInstrInfo.h - Thumb Instruction Information ----------*- C++ -*-===// +//===- Thumb1InstrInfo.h - Thumb-1 Instruction Information ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,89 +7,87 @@ // //===----------------------------------------------------------------------===// // -// This file contains the ARM implementation of the TargetInstrInfo class. +// This file contains the Thumb-1 implementation of the TargetInstrInfo class. // //===----------------------------------------------------------------------===// -#ifndef THUMBINSTRUCTIONINFO_H -#define THUMBINSTRUCTIONINFO_H +#ifndef THUMB1INSTRUCTIONINFO_H +#define THUMB1INSTRUCTIONINFO_H #include "llvm/Target/TargetInstrInfo.h" #include "ARM.h" #include "ARMInstrInfo.h" -#include "ThumbRegisterInfo.h" +#include "Thumb1RegisterInfo.h" namespace llvm { class ARMSubtarget; -class ThumbInstrInfo : public ARMBaseInstrInfo { - ThumbRegisterInfo RI; +class Thumb1InstrInfo : public ARMBaseInstrInfo { + Thumb1RegisterInfo RI; public: - explicit ThumbInstrInfo(const ARMSubtarget &STI); + explicit Thumb1InstrInfo(const ARMSubtarget &STI); /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As /// such, whenever a client has an instance of instruction info, it should /// always be able to get register info as well (through this method). /// - virtual const ThumbRegisterInfo &getRegisterInfo() const { return RI; } + const Thumb1RegisterInfo &getRegisterInfo() const { return RI; } - /// Return true if the instruction is a register to register move and return - /// the source and dest operands and their sub-register indices by reference. - virtual bool isMoveInstr(const MachineInstr &MI, + bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MI, + const std::vector &CSI) const; + bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MI, + const std::vector &CSI) const; + + bool isMoveInstr(const MachineInstr &MI, unsigned &SrcReg, unsigned &DstReg, unsigned &SrcSubIdx, unsigned &DstSubIdx) const; - - virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, + unsigned isLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) const; - virtual unsigned isStoreToStackSlot(const MachineInstr *MI, + unsigned isStoreToStackSlot(const MachineInstr *MI, int &FrameIndex) const; - virtual bool copyRegToReg(MachineBasicBlock &MBB, + bool copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, unsigned SrcReg, const TargetRegisterClass *DestRC, const TargetRegisterClass *SrcRC) const; - virtual void storeRegToStackSlot(MachineBasicBlock &MBB, + void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC) const; - virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, + void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; - virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, + void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC) const; - virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, + void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; - virtual bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, - const std::vector &CSI) const; - virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, - const std::vector &CSI) const; - virtual bool canFoldMemoryOperand(const MachineInstr *MI, + bool canFoldMemoryOperand(const MachineInstr *MI, const SmallVectorImpl &Ops) const; - virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, - MachineInstr* MI, - const SmallVectorImpl &Ops, - MachineInstr* LoadMI) const { + MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, + MachineInstr* MI, + const SmallVectorImpl &Ops, + int FrameIndex) const; + + MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, + MachineInstr* MI, + const SmallVectorImpl &Ops, + MachineInstr* LoadMI) const { return 0; } - - virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, - MachineInstr* MI, - const SmallVectorImpl &Ops, - int FrameIndex) const; }; } -#endif // THUMBINSTRUCTIONINFO_H +#endif // THUMB1INSTRUCTIONINFO_H Copied: llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp (from r74702, llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp?p2=llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp&p1=llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp&r1=74702&r2=74731&rev=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp Thu Jul 2 17:18:33 2009 @@ -1,4 +1,4 @@ -//===- ThumbRegisterInfo.cpp - Thumb Register Information -------*- C++ -*-===// +//===- Thumb1RegisterInfo.cpp - Thumb-1 Register Information -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file contains the ARM implementation of the TargetRegisterInfo class. +// This file contains the Thumb-1 implementation of the TargetRegisterInfo class. // //===----------------------------------------------------------------------===// @@ -15,8 +15,8 @@ #include "ARMAddressingModes.h" #include "ARMMachineFunctionInfo.h" #include "ARMSubtarget.h" -#include "ThumbInstrInfo.h" -#include "ThumbRegisterInfo.h" +#include "Thumb1InstrInfo.h" +#include "Thumb1RegisterInfo.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/CodeGen/MachineConstantPool.h" @@ -37,18 +37,18 @@ cl::Hidden, cl::desc("Enable register scavenging on Thumb")); -ThumbRegisterInfo::ThumbRegisterInfo(const TargetInstrInfo &tii, - const ARMSubtarget &sti) +Thumb1RegisterInfo::Thumb1RegisterInfo(const TargetInstrInfo &tii, + const ARMSubtarget &sti) : ARMBaseRegisterInfo(tii, sti) { } /// emitLoadConstPool - Emits a load from constpool to materialize the /// specified immediate. -void ThumbRegisterInfo::emitLoadConstPool(MachineBasicBlock &MBB, - MachineBasicBlock::iterator &MBBI, - unsigned DestReg, int Val, - const TargetInstrInfo *TII, - DebugLoc dl) const { +void Thumb1RegisterInfo::emitLoadConstPool(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, int Val, + const TargetInstrInfo *TII, + DebugLoc dl) const { MachineFunction &MF = *MBB.getParent(); MachineConstantPool *ConstantPool = MF.getConstantPool(); Constant *C = ConstantInt::get(Type::Int32Ty, Val); @@ -59,7 +59,7 @@ } const TargetRegisterClass* -ThumbRegisterInfo::getPhysicalRegisterRegClass(unsigned Reg, MVT VT) const { +Thumb1RegisterInfo::getPhysicalRegisterRegClass(unsigned Reg, MVT VT) const { if (isARMLowRegister(Reg)) return ARM::tGPRRegisterClass; switch (Reg) { @@ -74,11 +74,11 @@ } bool -ThumbRegisterInfo::requiresRegisterScavenging(const MachineFunction &MF) const { +Thumb1RegisterInfo::requiresRegisterScavenging(const MachineFunction &MF) const { return ThumbRegScavenging; } -bool ThumbRegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { +bool Thumb1RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { const MachineFrameInfo *FFI = MF.getFrameInfo(); unsigned CFSize = FFI->getMaxCallFrameSize(); // It's not always a good idea to include the call frame as part of the @@ -101,7 +101,7 @@ unsigned DestReg, unsigned BaseReg, int NumBytes, bool CanChangeCC, const TargetInstrInfo &TII, - const ThumbRegisterInfo& MRI, + const Thumb1RegisterInfo& MRI, DebugLoc dl) { bool isHigh = !isARMLowRegister(DestReg) || (BaseReg != 0 && !isARMLowRegister(BaseReg)); @@ -175,7 +175,7 @@ MachineBasicBlock::iterator &MBBI, unsigned DestReg, unsigned BaseReg, int NumBytes, const TargetInstrInfo &TII, - const ThumbRegisterInfo& MRI, + const Thumb1RegisterInfo& MRI, DebugLoc dl) { bool isSub = NumBytes < 0; unsigned Bytes = (unsigned)NumBytes; @@ -279,13 +279,13 @@ static void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const TargetInstrInfo &TII, DebugLoc dl, - const ThumbRegisterInfo &MRI, + const Thumb1RegisterInfo &MRI, int NumBytes) { emitThumbRegPlusImmediate(MBB, MBBI, ARM::SP, ARM::SP, NumBytes, TII, MRI, dl); } -void ThumbRegisterInfo:: +void Thumb1RegisterInfo:: eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { if (!hasReservedCallFrame(MF)) { @@ -321,7 +321,7 @@ MachineBasicBlock::iterator &MBBI, unsigned DestReg, int Imm, const TargetInstrInfo &TII, - const ThumbRegisterInfo& MRI, + const Thumb1RegisterInfo& MRI, DebugLoc dl) { bool isSub = Imm < 0; if (isSub) Imm = -Imm; @@ -337,8 +337,8 @@ .addReg(DestReg, RegState::Kill); } -void ThumbRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, - int SPAdj, RegScavenger *RS) const{ +void Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, + int SPAdj, RegScavenger *RS) const{ unsigned i = 0; MachineInstr &MI = *II; MachineBasicBlock &MBB = *MI.getParent(); @@ -566,7 +566,7 @@ assert(false && "Unexpected opcode!"); } -void ThumbRegisterInfo::emitPrologue(MachineFunction &MF) const { +void Thumb1RegisterInfo::emitPrologue(MachineFunction &MF) const { MachineBasicBlock &MBB = MF.front(); MachineBasicBlock::iterator MBBI = MBB.begin(); MachineFrameInfo *MFI = MF.getFrameInfo(); @@ -690,8 +690,8 @@ isCalleeSavedRegister(MI->getOperand(0).getReg(), CSRegs)); } -void ThumbRegisterInfo::emitEpilogue(MachineFunction &MF, - MachineBasicBlock &MBB) const { +void Thumb1RegisterInfo::emitEpilogue(MachineFunction &MF, + MachineBasicBlock &MBB) const { MachineBasicBlock::iterator MBBI = prior(MBB.end()); assert((MBBI->getOpcode() == ARM::tBX_RET || MBBI->getOpcode() == ARM::tPOP_RET) && Copied: llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h (from r74702, llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h?p2=llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h&p1=llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h&r1=74702&r2=74731&rev=74731&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h (original) +++ llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h Thu Jul 2 17:18:33 2009 @@ -1,4 +1,4 @@ -//===- ThumbRegisterInfo.h - Thumb Register Information Impl ----*- C++ -*-===// +//===- Thumb1RegisterInfo.h - Thumb-1 Register Information Impl ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,12 +7,12 @@ // //===----------------------------------------------------------------------===// // -// This file contains the ARM implementation of the TargetRegisterInfo class. +// This file contains the Thumb-1 implementation of the TargetRegisterInfo class. // //===----------------------------------------------------------------------===// -#ifndef THUMBREGISTERINFO_H -#define THUMBREGISTERINFO_H +#ifndef THUMB1REGISTERINFO_H +#define THUMB1REGISTERINFO_H #include "ARM.h" #include "ARMRegisterInfo.h" @@ -23,9 +23,9 @@ class TargetInstrInfo; class Type; -struct ThumbRegisterInfo : public ARMBaseRegisterInfo { +struct Thumb1RegisterInfo : public ARMBaseRegisterInfo { public: - ThumbRegisterInfo(const TargetInstrInfo &tii, const ARMSubtarget &STI); + Thumb1RegisterInfo(const TargetInstrInfo &tii, const ARMSubtarget &STI); /// emitLoadConstPool - Emits a load from constpool to materialize the /// specified immediate. @@ -57,4 +57,4 @@ }; } -#endif // THUMBREGISTERINFO_H +#endif // THUMB1REGISTERINFO_H Added: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=74731&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (added) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Thu Jul 2 17:18:33 2009 @@ -0,0 +1,312 @@ +//===- Thumb2InstrInfo.cpp - Thumb-2 Instruction Information --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains the Thumb-2 implementation of the TargetInstrInfo class. +// +//===----------------------------------------------------------------------===// + +#include "ARMInstrInfo.h" +#include "ARM.h" +#include "ARMGenInstrInfo.inc" +#include "ARMMachineFunctionInfo.h" +#include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/ADT/SmallVector.h" +#include "Thumb2InstrInfo.h" + +using namespace llvm; + +Thumb2InstrInfo::Thumb2InstrInfo(const ARMSubtarget &STI) + : ARMBaseInstrInfo(STI), RI(*this, STI) { +} + +bool Thumb2InstrInfo::isMoveInstr(const MachineInstr &MI, + unsigned &SrcReg, unsigned &DstReg, + unsigned& SrcSubIdx, unsigned& DstSubIdx) const { + SrcSubIdx = DstSubIdx = 0; // No sub-registers. + + unsigned oc = MI.getOpcode(); + switch (oc) { + default: + return false; + // FIXME: Thumb2 + case ARM::tMOVr: + case ARM::tMOVhir2lor: + case ARM::tMOVlor2hir: + case ARM::tMOVhir2hir: + assert(MI.getDesc().getNumOperands() >= 2 && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && + "Invalid Thumb MOV instruction"); + SrcReg = MI.getOperand(1).getReg(); + DstReg = MI.getOperand(0).getReg(); + return true; + } +} + +unsigned Thumb2InstrInfo::isLoadFromStackSlot(const MachineInstr *MI, + int &FrameIndex) const { + switch (MI->getOpcode()) { + default: break; + // FIXME: Thumb2 + case ARM::tRestore: + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isImm() && + MI->getOperand(2).getImm() == 0) { + FrameIndex = MI->getOperand(1).getIndex(); + return MI->getOperand(0).getReg(); + } + break; + } + return 0; +} + +unsigned Thumb2InstrInfo::isStoreToStackSlot(const MachineInstr *MI, + int &FrameIndex) const { + switch (MI->getOpcode()) { + default: break; + // FIXME: Thumb2 + case ARM::tSpill: + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isImm() && + MI->getOperand(2).getImm() == 0) { + FrameIndex = MI->getOperand(1).getIndex(); + return MI->getOperand(0).getReg(); + } + break; + } + return 0; +} + +bool Thumb2InstrInfo::copyRegToReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *DestRC, + const TargetRegisterClass *SrcRC) const { + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (I != MBB.end()) DL = I->getDebugLoc(); + + // FIXME: Thumb2 + if (DestRC == ARM::GPRRegisterClass) { + if (SrcRC == ARM::GPRRegisterClass) { + BuildMI(MBB, I, DL, get(ARM::tMOVhir2hir), DestReg).addReg(SrcReg); + return true; + } else if (SrcRC == ARM::tGPRRegisterClass) { + BuildMI(MBB, I, DL, get(ARM::tMOVlor2hir), DestReg).addReg(SrcReg); + return true; + } + } else if (DestRC == ARM::tGPRRegisterClass) { + if (SrcRC == ARM::GPRRegisterClass) { + BuildMI(MBB, I, DL, get(ARM::tMOVhir2lor), DestReg).addReg(SrcReg); + return true; + } else if (SrcRC == ARM::tGPRRegisterClass) { + BuildMI(MBB, I, DL, get(ARM::tMOVr), DestReg).addReg(SrcReg); + return true; + } + } + + return false; +} + +bool Thumb2InstrInfo:: +canFoldMemoryOperand(const MachineInstr *MI, + const SmallVectorImpl &Ops) const { + if (Ops.size() != 1) return false; + + unsigned OpNum = Ops[0]; + unsigned Opc = MI->getOpcode(); + switch (Opc) { + default: break; + case ARM::tMOVr: + case ARM::tMOVlor2hir: + case ARM::tMOVhir2lor: + case ARM::tMOVhir2hir: { + if (OpNum == 0) { // move -> store + unsigned SrcReg = MI->getOperand(1).getReg(); + if (RI.isPhysicalRegister(SrcReg) && !isARMLowRegister(SrcReg)) + // tSpill cannot take a high register operand. + return false; + } else { // move -> load + unsigned DstReg = MI->getOperand(0).getReg(); + if (RI.isPhysicalRegister(DstReg) && !isARMLowRegister(DstReg)) + // tRestore cannot target a high register operand. + return false; + } + return true; + } + } + + return false; +} + +void Thumb2InstrInfo:: +storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, + unsigned SrcReg, bool isKill, int FI, + const TargetRegisterClass *RC) const { + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (I != MBB.end()) DL = I->getDebugLoc(); + + assert(RC == ARM::tGPRRegisterClass && "Unknown regclass!"); + + // FIXME: Thumb2 + if (RC == ARM::tGPRRegisterClass) { + BuildMI(MBB, I, DL, get(ARM::tSpill)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI).addImm(0); + } +} + +void Thumb2InstrInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, + bool isKill, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, + SmallVectorImpl &NewMIs) const{ + DebugLoc DL = DebugLoc::getUnknownLoc(); + unsigned Opc = 0; + + // FIXME: Thumb2. Is GPRRegClass here correct? + assert(RC == ARM::GPRRegisterClass && "Unknown regclass!"); + if (RC == ARM::GPRRegisterClass) { + Opc = Addr[0].isFI() ? ARM::tSpill : ARM::tSTR; + } + + MachineInstrBuilder MIB = + BuildMI(MF, DL, get(Opc)).addReg(SrcReg, getKillRegState(isKill)); + for (unsigned i = 0, e = Addr.size(); i != e; ++i) + MIB.addOperand(Addr[i]); + NewMIs.push_back(MIB); + return; +} + +void Thumb2InstrInfo:: +loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, + unsigned DestReg, int FI, + const TargetRegisterClass *RC) const { + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (I != MBB.end()) DL = I->getDebugLoc(); + + // FIXME: Thumb2 + assert(RC == ARM::tGPRRegisterClass && "Unknown regclass!"); + + if (RC == ARM::tGPRRegisterClass) { + BuildMI(MBB, I, DL, get(ARM::tRestore), DestReg) + .addFrameIndex(FI).addImm(0); + } +} + +void Thumb2InstrInfo:: +loadRegFromAddr(MachineFunction &MF, unsigned DestReg, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, + SmallVectorImpl &NewMIs) const { + DebugLoc DL = DebugLoc::getUnknownLoc(); + unsigned Opc = 0; + + // FIXME: Thumb2. Is GPRRegClass ok here? + if (RC == ARM::GPRRegisterClass) { + Opc = Addr[0].isFI() ? ARM::tRestore : ARM::tLDR; + } + + MachineInstrBuilder MIB = BuildMI(MF, DL, get(Opc), DestReg); + for (unsigned i = 0, e = Addr.size(); i != e; ++i) + MIB.addOperand(Addr[i]); + NewMIs.push_back(MIB); + return; +} + +bool Thumb2InstrInfo:: +spillCalleeSavedRegisters(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MI, + const std::vector &CSI) const { + if (CSI.empty()) + return false; + + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (MI != MBB.end()) DL = MI->getDebugLoc(); + + MachineInstrBuilder MIB = BuildMI(MBB, MI, DL, get(ARM::tPUSH)); + for (unsigned i = CSI.size(); i != 0; --i) { + unsigned Reg = CSI[i-1].getReg(); + // Add the callee-saved register as live-in. It's killed at the spill. + MBB.addLiveIn(Reg); + MIB.addReg(Reg, RegState::Kill); + } + return true; +} + +bool Thumb2InstrInfo:: +restoreCalleeSavedRegisters(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MI, + const std::vector &CSI) const { + MachineFunction &MF = *MBB.getParent(); + ARMFunctionInfo *AFI = MF.getInfo(); + if (CSI.empty()) + return false; + + bool isVarArg = AFI->getVarArgsRegSaveSize() > 0; + MachineInstr *PopMI = MF.CreateMachineInstr(get(ARM::tPOP),MI->getDebugLoc()); + for (unsigned i = CSI.size(); i != 0; --i) { + unsigned Reg = CSI[i-1].getReg(); + if (Reg == ARM::LR) { + // Special epilogue for vararg functions. See emitEpilogue + if (isVarArg) + continue; + Reg = ARM::PC; + PopMI->setDesc(get(ARM::tPOP_RET)); + MI = MBB.erase(MI); + } + PopMI->addOperand(MachineOperand::CreateReg(Reg, true)); + } + + // It's illegal to emit pop instruction without operands. + if (PopMI->getNumOperands() > 0) + MBB.insert(MI, PopMI); + + return true; +} + +MachineInstr *Thumb2InstrInfo:: +foldMemoryOperandImpl(MachineFunction &MF, MachineInstr *MI, + const SmallVectorImpl &Ops, int FI) const { + if (Ops.size() != 1) return NULL; + + unsigned OpNum = Ops[0]; + unsigned Opc = MI->getOpcode(); + MachineInstr *NewMI = NULL; + switch (Opc) { + default: break; + case ARM::tMOVr: + case ARM::tMOVlor2hir: + case ARM::tMOVhir2lor: + case ARM::tMOVhir2hir: { + if (OpNum == 0) { // move -> store + unsigned SrcReg = MI->getOperand(1).getReg(); + bool isKill = MI->getOperand(1).isKill(); + if (RI.isPhysicalRegister(SrcReg) && !isARMLowRegister(SrcReg)) + // tSpill cannot take a high register operand. + break; + NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::tSpill)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI).addImm(0); + } else { // move -> load + unsigned DstReg = MI->getOperand(0).getReg(); + if (RI.isPhysicalRegister(DstReg) && !isARMLowRegister(DstReg)) + // tRestore cannot target a high register operand. + break; + bool isDead = MI->getOperand(0).isDead(); + NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::tRestore)) + .addReg(DstReg, RegState::Define | getDeadRegState(isDead)) + .addFrameIndex(FI).addImm(0); + } + break; + } + } + + return NewMI; +} Added: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h?rev=74731&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h (added) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h Thu Jul 2 17:18:33 2009 @@ -0,0 +1,93 @@ +//===- Thumb2InstrInfo.h - Thumb-2 Instruction Information ----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains the Thumb-2 implementation of the TargetInstrInfo class. +// +//===----------------------------------------------------------------------===// + +#ifndef THUMB2INSTRUCTIONINFO_H +#define THUMB2INSTRUCTIONINFO_H + +#include "llvm/Target/TargetInstrInfo.h" +#include "ARM.h" +#include "ARMInstrInfo.h" +#include "Thumb2RegisterInfo.h" + +namespace llvm { + class ARMSubtarget; + +class Thumb2InstrInfo : public ARMBaseInstrInfo { + Thumb2RegisterInfo RI; +public: + explicit Thumb2InstrInfo(const ARMSubtarget &STI); + + /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As + /// such, whenever a client has an instance of instruction info, it should + /// always be able to get register info as well (through this method). + /// + const Thumb2RegisterInfo &getRegisterInfo() const { return RI; } + + bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MI, + const std::vector &CSI) const; + bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MI, + const std::vector &CSI) const; + + bool isMoveInstr(const MachineInstr &MI, + unsigned &SrcReg, unsigned &DstReg, + unsigned &SrcSubIdx, unsigned &DstSubIdx) const; + unsigned isLoadFromStackSlot(const MachineInstr *MI, + int &FrameIndex) const; + unsigned isStoreToStackSlot(const MachineInstr *MI, + int &FrameIndex) const; + + bool copyRegToReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *DestRC, + const TargetRegisterClass *SrcRC) const; + void storeRegToStackSlot(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + unsigned SrcReg, bool isKill, int FrameIndex, + const TargetRegisterClass *RC) const; + + void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, + SmallVectorImpl &NewMIs) const; + + void loadRegFromStackSlot(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + unsigned DestReg, int FrameIndex, + const TargetRegisterClass *RC) const; + + void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, + SmallVectorImpl &NewMIs) const; + + bool canFoldMemoryOperand(const MachineInstr *MI, + const SmallVectorImpl &Ops) const; + + MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, + MachineInstr* MI, + const SmallVectorImpl &Ops, + int FrameIndex) const; + + MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, + MachineInstr* MI, + const SmallVectorImpl &Ops, + MachineInstr* LoadMI) const { + return 0; + } +}; +} + +#endif // THUMB2INSTRUCTIONINFO_H Added: llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp?rev=74731&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp (added) +++ llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp Thu Jul 2 17:18:33 2009 @@ -0,0 +1,755 @@ +//===- Thumb2RegisterInfo.cpp - Thumb-2 Register Information -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains the Thumb-2 implementation of the TargetRegisterInfo class. +// +//===----------------------------------------------------------------------===// + +#include "ARM.h" +#include "ARMAddressingModes.h" +#include "ARMMachineFunctionInfo.h" +#include "ARMSubtarget.h" +#include "Thumb2InstrInfo.h" +#include "Thumb2RegisterInfo.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" +#include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineLocation.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/Target/TargetFrameInfo.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/ADT/BitVector.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Support/CommandLine.h" +using namespace llvm; + +static cl::opt +Thumb2RegScavenging("enable-thumb2-reg-scavenging", + cl::Hidden, + cl::desc("Enable register scavenging on Thumb-2")); + +Thumb2RegisterInfo::Thumb2RegisterInfo(const TargetInstrInfo &tii, + const ARMSubtarget &sti) + : ARMBaseRegisterInfo(tii, sti) { +} + +/// emitLoadConstPool - Emits a load from constpool to materialize the +/// specified immediate. +void Thumb2RegisterInfo::emitLoadConstPool(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, int Val, + const TargetInstrInfo *TII, + DebugLoc dl) const { + MachineFunction &MF = *MBB.getParent(); + MachineConstantPool *ConstantPool = MF.getConstantPool(); + Constant *C = ConstantInt::get(Type::Int32Ty, Val); + unsigned Idx = ConstantPool->getConstantPoolIndex(C, 4); + + BuildMI(MBB, MBBI, dl, TII->get(ARM::tLDRcp), DestReg) + .addConstantPoolIndex(Idx); +} + +const TargetRegisterClass* +Thumb2RegisterInfo::getPhysicalRegisterRegClass(unsigned Reg, MVT VT) const { + if (isARMLowRegister(Reg)) + return ARM::tGPRRegisterClass; + switch (Reg) { + default: + break; + case ARM::R8: case ARM::R9: case ARM::R10: case ARM::R11: + case ARM::R12: case ARM::SP: case ARM::LR: case ARM::PC: + return ARM::GPRRegisterClass; + } + + return TargetRegisterInfo::getPhysicalRegisterRegClass(Reg, VT); +} + +bool +Thumb2RegisterInfo::requiresRegisterScavenging(const MachineFunction &MF) const { + return Thumb2RegScavenging; +} + +bool Thumb2RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { + const MachineFrameInfo *FFI = MF.getFrameInfo(); + unsigned CFSize = FFI->getMaxCallFrameSize(); + // It's not always a good idea to include the call frame as part of the + // stack frame. ARM (especially Thumb) has small immediate offset to + // address the stack frame. So a large call frame can cause poor codegen + // and may even makes it impossible to scavenge a register. + if (CFSize >= ((1 << 8) - 1) * 4 / 2) // Half of imm8 * 4 + return false; + + return !MF.getFrameInfo()->hasVarSizedObjects(); +} + +/// emitThumbRegPlusImmInReg - Emits a series of instructions to materialize +/// a destreg = basereg + immediate in Thumb code. Materialize the immediate +/// in a register using mov / mvn sequences or load the immediate from a +/// constpool entry. +static +void emitThumbRegPlusImmInReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, unsigned BaseReg, + int NumBytes, bool CanChangeCC, + const TargetInstrInfo &TII, + const Thumb2RegisterInfo& MRI, + DebugLoc dl) { + bool isHigh = !isARMLowRegister(DestReg) || + (BaseReg != 0 && !isARMLowRegister(BaseReg)); + bool isSub = false; + // Subtract doesn't have high register version. Load the negative value + // if either base or dest register is a high register. Also, if do not + // issue sub as part of the sequence if condition register is to be + // preserved. + if (NumBytes < 0 && !isHigh && CanChangeCC) { + isSub = true; + NumBytes = -NumBytes; + } + unsigned LdReg = DestReg; + if (DestReg == ARM::SP) { + assert(BaseReg == ARM::SP && "Unexpected!"); + LdReg = ARM::R3; + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVlor2hir), ARM::R12) + .addReg(ARM::R3, RegState::Kill); + } + + if (NumBytes <= 255 && NumBytes >= 0) + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVi8), LdReg).addImm(NumBytes); + else if (NumBytes < 0 && NumBytes >= -255) { + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVi8), LdReg).addImm(NumBytes); + BuildMI(MBB, MBBI, dl, TII.get(ARM::tNEG), LdReg) + .addReg(LdReg, RegState::Kill); + } else + MRI.emitLoadConstPool(MBB, MBBI, LdReg, NumBytes, &TII, dl); + + // Emit add / sub. + int Opc = (isSub) ? ARM::tSUBrr : (isHigh ? ARM::tADDhirr : ARM::tADDrr); + const MachineInstrBuilder MIB = BuildMI(MBB, MBBI, dl, + TII.get(Opc), DestReg); + if (DestReg == ARM::SP || isSub) + MIB.addReg(BaseReg).addReg(LdReg, RegState::Kill); + else + MIB.addReg(LdReg).addReg(BaseReg, RegState::Kill); + if (DestReg == ARM::SP) + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVhir2lor), ARM::R3) + .addReg(ARM::R12, RegState::Kill); +} + +/// calcNumMI - Returns the number of instructions required to materialize +/// the specific add / sub r, c instruction. +static unsigned calcNumMI(int Opc, int ExtraOpc, unsigned Bytes, + unsigned NumBits, unsigned Scale) { + unsigned NumMIs = 0; + unsigned Chunk = ((1 << NumBits) - 1) * Scale; + + if (Opc == ARM::tADDrSPi) { + unsigned ThisVal = (Bytes > Chunk) ? Chunk : Bytes; + Bytes -= ThisVal; + NumMIs++; + NumBits = 8; + Scale = 1; // Followed by a number of tADDi8. + Chunk = ((1 << NumBits) - 1) * Scale; + } + + NumMIs += Bytes / Chunk; + if ((Bytes % Chunk) != 0) + NumMIs++; + if (ExtraOpc) + NumMIs++; + return NumMIs; +} + +/// emitThumbRegPlusImmediate - Emits a series of instructions to materialize +/// a destreg = basereg + immediate in Thumb code. +static +void emitThumbRegPlusImmediate(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, unsigned BaseReg, + int NumBytes, const TargetInstrInfo &TII, + const Thumb2RegisterInfo& MRI, + DebugLoc dl) { + bool isSub = NumBytes < 0; + unsigned Bytes = (unsigned)NumBytes; + if (isSub) Bytes = -NumBytes; + bool isMul4 = (Bytes & 3) == 0; + bool isTwoAddr = false; + bool DstNotEqBase = false; + unsigned NumBits = 1; + unsigned Scale = 1; + int Opc = 0; + int ExtraOpc = 0; + + if (DestReg == BaseReg && BaseReg == ARM::SP) { + assert(isMul4 && "Thumb sp inc / dec size must be multiple of 4!"); + NumBits = 7; + Scale = 4; + Opc = isSub ? ARM::tSUBspi : ARM::tADDspi; + isTwoAddr = true; + } else if (!isSub && BaseReg == ARM::SP) { + // r1 = add sp, 403 + // => + // r1 = add sp, 100 * 4 + // r1 = add r1, 3 + if (!isMul4) { + Bytes &= ~3; + ExtraOpc = ARM::tADDi3; + } + NumBits = 8; + Scale = 4; + Opc = ARM::tADDrSPi; + } else { + // sp = sub sp, c + // r1 = sub sp, c + // r8 = sub sp, c + if (DestReg != BaseReg) + DstNotEqBase = true; + NumBits = 8; + Opc = isSub ? ARM::tSUBi8 : ARM::tADDi8; + isTwoAddr = true; + } + + unsigned NumMIs = calcNumMI(Opc, ExtraOpc, Bytes, NumBits, Scale); + unsigned Threshold = (DestReg == ARM::SP) ? 3 : 2; + if (NumMIs > Threshold) { + // This will expand into too many instructions. Load the immediate from a + // constpool entry. + emitThumbRegPlusImmInReg(MBB, MBBI, DestReg, BaseReg, NumBytes, true, TII, + MRI, dl); + return; + } + + if (DstNotEqBase) { + if (isARMLowRegister(DestReg) && isARMLowRegister(BaseReg)) { + // If both are low registers, emit DestReg = add BaseReg, max(Imm, 7) + unsigned Chunk = (1 << 3) - 1; + unsigned ThisVal = (Bytes > Chunk) ? Chunk : Bytes; + Bytes -= ThisVal; + BuildMI(MBB, MBBI, dl,TII.get(isSub ? ARM::tSUBi3 : ARM::tADDi3), DestReg) + .addReg(BaseReg, RegState::Kill).addImm(ThisVal); + } else { + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr), DestReg) + .addReg(BaseReg, RegState::Kill); + } + BaseReg = DestReg; + } + + unsigned Chunk = ((1 << NumBits) - 1) * Scale; + while (Bytes) { + unsigned ThisVal = (Bytes > Chunk) ? Chunk : Bytes; + Bytes -= ThisVal; + ThisVal /= Scale; + // Build the new tADD / tSUB. + if (isTwoAddr) + BuildMI(MBB, MBBI, dl, TII.get(Opc), DestReg) + .addReg(DestReg).addImm(ThisVal); + else { + bool isKill = BaseReg != ARM::SP; + BuildMI(MBB, MBBI, dl, TII.get(Opc), DestReg) + .addReg(BaseReg, getKillRegState(isKill)).addImm(ThisVal); + BaseReg = DestReg; + + if (Opc == ARM::tADDrSPi) { + // r4 = add sp, imm + // r4 = add r4, imm + // ... + NumBits = 8; + Scale = 1; + Chunk = ((1 << NumBits) - 1) * Scale; + Opc = isSub ? ARM::tSUBi8 : ARM::tADDi8; + isTwoAddr = true; + } + } + } + + if (ExtraOpc) + BuildMI(MBB, MBBI, dl, TII.get(ExtraOpc), DestReg) + .addReg(DestReg, RegState::Kill) + .addImm(((unsigned)NumBytes) & 3); +} + +static void emitSPUpdate(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + const TargetInstrInfo &TII, DebugLoc dl, + const Thumb2RegisterInfo &MRI, + int NumBytes) { + emitThumbRegPlusImmediate(MBB, MBBI, ARM::SP, ARM::SP, NumBytes, TII, + MRI, dl); +} + +void Thumb2RegisterInfo:: +eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, + MachineBasicBlock::iterator I) const { + if (!hasReservedCallFrame(MF)) { + // If we have alloca, convert as follows: + // ADJCALLSTACKDOWN -> sub, sp, sp, amount + // ADJCALLSTACKUP -> add, sp, sp, amount + MachineInstr *Old = I; + DebugLoc dl = Old->getDebugLoc(); + unsigned Amount = Old->getOperand(0).getImm(); + if (Amount != 0) { + // We need to keep the stack aligned properly. To do this, we round the + // amount of space needed for the outgoing arguments up to the next + // alignment boundary. + unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment(); + Amount = (Amount+Align-1)/Align*Align; + + // Replace the pseudo instruction with a new instruction... + unsigned Opc = Old->getOpcode(); + if (Opc == ARM::ADJCALLSTACKDOWN || Opc == ARM::tADJCALLSTACKDOWN) { + emitSPUpdate(MBB, I, TII, dl, *this, -Amount); + } else { + assert(Opc == ARM::ADJCALLSTACKUP || Opc == ARM::tADJCALLSTACKUP); + emitSPUpdate(MBB, I, TII, dl, *this, Amount); + } + } + } + MBB.erase(I); +} + +/// emitThumbConstant - Emit a series of instructions to materialize a +/// constant. +static void emitThumbConstant(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, int Imm, + const TargetInstrInfo &TII, + const Thumb2RegisterInfo& MRI, + DebugLoc dl) { + bool isSub = Imm < 0; + if (isSub) Imm = -Imm; + + int Chunk = (1 << 8) - 1; + int ThisVal = (Imm > Chunk) ? Chunk : Imm; + Imm -= ThisVal; + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVi8), DestReg).addImm(ThisVal); + if (Imm > 0) + emitThumbRegPlusImmediate(MBB, MBBI, DestReg, DestReg, Imm, TII, MRI, dl); + if (isSub) + BuildMI(MBB, MBBI, dl, TII.get(ARM::tNEG), DestReg) + .addReg(DestReg, RegState::Kill); +} + +void Thumb2RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, + int SPAdj, RegScavenger *RS) const{ + unsigned i = 0; + MachineInstr &MI = *II; + MachineBasicBlock &MBB = *MI.getParent(); + MachineFunction &MF = *MBB.getParent(); + ARMFunctionInfo *AFI = MF.getInfo(); + DebugLoc dl = MI.getDebugLoc(); + + while (!MI.getOperand(i).isFI()) { + ++i; + assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); + } + + unsigned FrameReg = ARM::SP; + int FrameIndex = MI.getOperand(i).getIndex(); + int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) + + MF.getFrameInfo()->getStackSize() + SPAdj; + + if (AFI->isGPRCalleeSavedArea1Frame(FrameIndex)) + Offset -= AFI->getGPRCalleeSavedArea1Offset(); + else if (AFI->isGPRCalleeSavedArea2Frame(FrameIndex)) + Offset -= AFI->getGPRCalleeSavedArea2Offset(); + else if (hasFP(MF)) { + assert(SPAdj == 0 && "Unexpected"); + // There is alloca()'s in this function, must reference off the frame + // pointer instead. + FrameReg = getFrameRegister(MF); + Offset -= AFI->getFramePtrSpillOffset(); + } + + unsigned Opcode = MI.getOpcode(); + const TargetInstrDesc &Desc = MI.getDesc(); + unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); + + if (Opcode == ARM::tADDrSPi) { + Offset += MI.getOperand(i+1).getImm(); + + // Can't use tADDrSPi if it's based off the frame pointer. + unsigned NumBits = 0; + unsigned Scale = 1; + if (FrameReg != ARM::SP) { + Opcode = ARM::tADDi3; + MI.setDesc(TII.get(ARM::tADDi3)); + NumBits = 3; + } else { + NumBits = 8; + Scale = 4; + assert((Offset & 3) == 0 && + "Thumb add/sub sp, #imm immediate must be multiple of 4!"); + } + + if (Offset == 0) { + // Turn it into a move. + MI.setDesc(TII.get(ARM::tMOVhir2lor)); + MI.getOperand(i).ChangeToRegister(FrameReg, false); + MI.RemoveOperand(i+1); + return; + } + + // Common case: small offset, fits into instruction. + unsigned Mask = (1 << NumBits) - 1; + if (((Offset / Scale) & ~Mask) == 0) { + // Replace the FrameIndex with sp / fp + MI.getOperand(i).ChangeToRegister(FrameReg, false); + MI.getOperand(i+1).ChangeToImmediate(Offset / Scale); + return; + } + + unsigned DestReg = MI.getOperand(0).getReg(); + unsigned Bytes = (Offset > 0) ? Offset : -Offset; + unsigned NumMIs = calcNumMI(Opcode, 0, Bytes, NumBits, Scale); + // MI would expand into a large number of instructions. Don't try to + // simplify the immediate. + if (NumMIs > 2) { + emitThumbRegPlusImmediate(MBB, II, DestReg, FrameReg, Offset, TII, + *this, dl); + MBB.erase(II); + return; + } + + if (Offset > 0) { + // Translate r0 = add sp, imm to + // r0 = add sp, 255*4 + // r0 = add r0, (imm - 255*4) + MI.getOperand(i).ChangeToRegister(FrameReg, false); + MI.getOperand(i+1).ChangeToImmediate(Mask); + Offset = (Offset - Mask * Scale); + MachineBasicBlock::iterator NII = next(II); + emitThumbRegPlusImmediate(MBB, NII, DestReg, DestReg, Offset, TII, + *this, dl); + } else { + // Translate r0 = add sp, -imm to + // r0 = -imm (this is then translated into a series of instructons) + // r0 = add r0, sp + emitThumbConstant(MBB, II, DestReg, Offset, TII, *this, dl); + MI.setDesc(TII.get(ARM::tADDhirr)); + MI.getOperand(i).ChangeToRegister(DestReg, false, false, true); + MI.getOperand(i+1).ChangeToRegister(FrameReg, false); + } + return; + } else { + unsigned ImmIdx = 0; + int InstrOffs = 0; + unsigned NumBits = 0; + unsigned Scale = 1; + switch (AddrMode) { + case ARMII::AddrModeT1_s: { + ImmIdx = i+1; + InstrOffs = MI.getOperand(ImmIdx).getImm(); + NumBits = (FrameReg == ARM::SP) ? 8 : 5; + Scale = 4; + break; + } + default: + assert(0 && "Unsupported addressing mode!"); + abort(); + break; + } + + Offset += InstrOffs * Scale; + assert((Offset & (Scale-1)) == 0 && "Can't encode this offset!"); + + // Common case: small offset, fits into instruction. + MachineOperand &ImmOp = MI.getOperand(ImmIdx); + int ImmedOffset = Offset / Scale; + unsigned Mask = (1 << NumBits) - 1; + if ((unsigned)Offset <= Mask * Scale) { + // Replace the FrameIndex with sp + MI.getOperand(i).ChangeToRegister(FrameReg, false); + ImmOp.ChangeToImmediate(ImmedOffset); + return; + } + + bool isThumSpillRestore = Opcode == ARM::tRestore || Opcode == ARM::tSpill; + if (AddrMode == ARMII::AddrModeT1_s) { + // Thumb tLDRspi, tSTRspi. These will change to instructions that use + // a different base register. + NumBits = 5; + Mask = (1 << NumBits) - 1; + } + // If this is a thumb spill / restore, we will be using a constpool load to + // materialize the offset. + if (AddrMode == ARMII::AddrModeT1_s && isThumSpillRestore) + ImmOp.ChangeToImmediate(0); + else { + // Otherwise, it didn't fit. Pull in what we can to simplify the immed. + ImmedOffset = ImmedOffset & Mask; + ImmOp.ChangeToImmediate(ImmedOffset); + Offset &= ~(Mask*Scale); + } + } + + // If we get here, the immediate doesn't fit into the instruction. We folded + // as much as possible above, handle the rest, providing a register that is + // SP+LargeImm. + assert(Offset && "This code isn't needed if offset already handled!"); + + if (Desc.mayLoad()) { + // Use the destination register to materialize sp + offset. + unsigned TmpReg = MI.getOperand(0).getReg(); + bool UseRR = false; + if (Opcode == ARM::tRestore) { + if (FrameReg == ARM::SP) + emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg, + Offset, false, TII, *this, dl); + else { + emitLoadConstPool(MBB, II, TmpReg, Offset, &TII, dl); + UseRR = true; + } + } else + emitThumbRegPlusImmediate(MBB, II, TmpReg, FrameReg, Offset, TII, + *this, dl); + MI.setDesc(TII.get(ARM::tLDR)); + MI.getOperand(i).ChangeToRegister(TmpReg, false, false, true); + if (UseRR) + // Use [reg, reg] addrmode. + MI.addOperand(MachineOperand::CreateReg(FrameReg, false)); + else // tLDR has an extra register operand. + MI.addOperand(MachineOperand::CreateReg(0, false)); + } else if (Desc.mayStore()) { + // FIXME! This is horrific!!! We need register scavenging. + // Our temporary workaround has marked r3 unavailable. Of course, r3 is + // also a ABI register so it's possible that is is the register that is + // being storing here. If that's the case, we do the following: + // r12 = r2 + // Use r2 to materialize sp + offset + // str r3, r2 + // r2 = r12 + unsigned ValReg = MI.getOperand(0).getReg(); + unsigned TmpReg = ARM::R3; + bool UseRR = false; + if (ValReg == ARM::R3) { + BuildMI(MBB, II, dl, TII.get(ARM::tMOVlor2hir), ARM::R12) + .addReg(ARM::R2, RegState::Kill); + TmpReg = ARM::R2; + } + if (TmpReg == ARM::R3 && AFI->isR3LiveIn()) + BuildMI(MBB, II, dl, TII.get(ARM::tMOVlor2hir), ARM::R12) + .addReg(ARM::R3, RegState::Kill); + if (Opcode == ARM::tSpill) { + if (FrameReg == ARM::SP) + emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg, + Offset, false, TII, *this, dl); + else { + emitLoadConstPool(MBB, II, TmpReg, Offset, &TII, dl); + UseRR = true; + } + } else + emitThumbRegPlusImmediate(MBB, II, TmpReg, FrameReg, Offset, TII, + *this, dl); + MI.setDesc(TII.get(ARM::tSTR)); + MI.getOperand(i).ChangeToRegister(TmpReg, false, false, true); + if (UseRR) // Use [reg, reg] addrmode. + MI.addOperand(MachineOperand::CreateReg(FrameReg, false)); + else // tSTR has an extra register operand. + MI.addOperand(MachineOperand::CreateReg(0, false)); + + MachineBasicBlock::iterator NII = next(II); + if (ValReg == ARM::R3) + BuildMI(MBB, NII, dl, TII.get(ARM::tMOVhir2lor), ARM::R2) + .addReg(ARM::R12, RegState::Kill); + if (TmpReg == ARM::R3 && AFI->isR3LiveIn()) + BuildMI(MBB, NII, dl, TII.get(ARM::tMOVhir2lor), ARM::R3) + .addReg(ARM::R12, RegState::Kill); + } else + assert(false && "Unexpected opcode!"); +} + +void Thumb2RegisterInfo::emitPrologue(MachineFunction &MF) const { + MachineBasicBlock &MBB = MF.front(); + MachineBasicBlock::iterator MBBI = MBB.begin(); + MachineFrameInfo *MFI = MF.getFrameInfo(); + ARMFunctionInfo *AFI = MF.getInfo(); + unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize(); + unsigned NumBytes = MFI->getStackSize(); + const std::vector &CSI = MFI->getCalleeSavedInfo(); + DebugLoc dl = (MBBI != MBB.end() ? + MBBI->getDebugLoc() : DebugLoc::getUnknownLoc()); + + // Check if R3 is live in. It might have to be used as a scratch register. + for (MachineRegisterInfo::livein_iterator I =MF.getRegInfo().livein_begin(), + E = MF.getRegInfo().livein_end(); I != E; ++I) { + if (I->first == ARM::R3) { + AFI->setR3IsLiveIn(true); + break; + } + } + + // Thumb add/sub sp, imm8 instructions implicitly multiply the offset by 4. + NumBytes = (NumBytes + 3) & ~3; + MFI->setStackSize(NumBytes); + + // Determine the sizes of each callee-save spill areas and record which frame + // belongs to which callee-save spill areas. + unsigned GPRCS1Size = 0, GPRCS2Size = 0, DPRCSSize = 0; + int FramePtrSpillFI = 0; + + if (VARegSaveSize) + emitSPUpdate(MBB, MBBI, TII, dl, *this, -VARegSaveSize); + + if (!AFI->hasStackFrame()) { + if (NumBytes != 0) + emitSPUpdate(MBB, MBBI, TII, dl, *this, -NumBytes); + return; + } + + for (unsigned i = 0, e = CSI.size(); i != e; ++i) { + unsigned Reg = CSI[i].getReg(); + int FI = CSI[i].getFrameIdx(); + switch (Reg) { + case ARM::R4: + case ARM::R5: + case ARM::R6: + case ARM::R7: + case ARM::LR: + if (Reg == FramePtr) + FramePtrSpillFI = FI; + AFI->addGPRCalleeSavedArea1Frame(FI); + GPRCS1Size += 4; + break; + case ARM::R8: + case ARM::R9: + case ARM::R10: + case ARM::R11: + if (Reg == FramePtr) + FramePtrSpillFI = FI; + if (STI.isTargetDarwin()) { + AFI->addGPRCalleeSavedArea2Frame(FI); + GPRCS2Size += 4; + } else { + AFI->addGPRCalleeSavedArea1Frame(FI); + GPRCS1Size += 4; + } + break; + default: + AFI->addDPRCalleeSavedAreaFrame(FI); + DPRCSSize += 8; + } + } + + if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH) { + ++MBBI; + if (MBBI != MBB.end()) + dl = MBBI->getDebugLoc(); + } + + // Darwin ABI requires FP to point to the stack slot that contains the + // previous FP. + if (STI.isTargetDarwin() || hasFP(MF)) { + MachineInstrBuilder MIB = + BuildMI(MBB, MBBI, dl, TII.get(ARM::tADDrSPi), FramePtr) + .addFrameIndex(FramePtrSpillFI).addImm(0); + } + + // Determine starting offsets of spill areas. + unsigned DPRCSOffset = NumBytes - (GPRCS1Size + GPRCS2Size + DPRCSSize); + unsigned GPRCS2Offset = DPRCSOffset + DPRCSSize; + unsigned GPRCS1Offset = GPRCS2Offset + GPRCS2Size; + AFI->setFramePtrSpillOffset(MFI->getObjectOffset(FramePtrSpillFI) + NumBytes); + AFI->setGPRCalleeSavedArea1Offset(GPRCS1Offset); + AFI->setGPRCalleeSavedArea2Offset(GPRCS2Offset); + AFI->setDPRCalleeSavedAreaOffset(DPRCSOffset); + + NumBytes = DPRCSOffset; + if (NumBytes) { + // Insert it after all the callee-save spills. + emitSPUpdate(MBB, MBBI, TII, dl, *this, -NumBytes); + } + + if (STI.isTargetELF() && hasFP(MF)) { + MFI->setOffsetAdjustment(MFI->getOffsetAdjustment() - + AFI->getFramePtrSpillOffset()); + } + + AFI->setGPRCalleeSavedArea1Size(GPRCS1Size); + AFI->setGPRCalleeSavedArea2Size(GPRCS2Size); + AFI->setDPRCalleeSavedAreaSize(DPRCSSize); +} + +static bool isCalleeSavedRegister(unsigned Reg, const unsigned *CSRegs) { + for (unsigned i = 0; CSRegs[i]; ++i) + if (Reg == CSRegs[i]) + return true; + return false; +} + +static bool isCSRestore(MachineInstr *MI, const unsigned *CSRegs) { + return (MI->getOpcode() == ARM::tRestore && + MI->getOperand(1).isFI() && + isCalleeSavedRegister(MI->getOperand(0).getReg(), CSRegs)); +} + +void Thumb2RegisterInfo::emitEpilogue(MachineFunction &MF, + MachineBasicBlock &MBB) const { + MachineBasicBlock::iterator MBBI = prior(MBB.end()); + assert((MBBI->getOpcode() == ARM::tBX_RET || + MBBI->getOpcode() == ARM::tPOP_RET) && + "Can only insert epilog into returning blocks"); + DebugLoc dl = MBBI->getDebugLoc(); + MachineFrameInfo *MFI = MF.getFrameInfo(); + ARMFunctionInfo *AFI = MF.getInfo(); + unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize(); + int NumBytes = (int)MFI->getStackSize(); + + if (!AFI->hasStackFrame()) { + if (NumBytes != 0) + emitSPUpdate(MBB, MBBI, TII, dl, *this, NumBytes); + } else { + // Unwind MBBI to point to first LDR / FLDD. + const unsigned *CSRegs = getCalleeSavedRegs(); + if (MBBI != MBB.begin()) { + do + --MBBI; + while (MBBI != MBB.begin() && isCSRestore(MBBI, CSRegs)); + if (!isCSRestore(MBBI, CSRegs)) + ++MBBI; + } + + // Move SP to start of FP callee save spill area. + NumBytes -= (AFI->getGPRCalleeSavedArea1Size() + + AFI->getGPRCalleeSavedArea2Size() + + AFI->getDPRCalleeSavedAreaSize()); + + if (hasFP(MF)) { + NumBytes = AFI->getFramePtrSpillOffset() - NumBytes; + // Reset SP based on frame pointer only if the stack frame extends beyond + // frame pointer stack slot or target is ELF and the function has FP. + if (NumBytes) + emitThumbRegPlusImmediate(MBB, MBBI, ARM::SP, FramePtr, -NumBytes, + TII, *this, dl); + else + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVlor2hir), ARM::SP) + .addReg(FramePtr); + } else { + if (MBBI->getOpcode() == ARM::tBX_RET && + &MBB.front() != MBBI && + prior(MBBI)->getOpcode() == ARM::tPOP) { + MachineBasicBlock::iterator PMBBI = prior(MBBI); + emitSPUpdate(MBB, PMBBI, TII, dl, *this, NumBytes); + } else + emitSPUpdate(MBB, MBBI, TII, dl, *this, NumBytes); + } + } + + if (VARegSaveSize) { + // Epilogue for vararg functions: pop LR to R3 and branch off it. + // FIXME: Verify this is still ok when R3 is no longer being reserved. + BuildMI(MBB, MBBI, dl, TII.get(ARM::tPOP)).addReg(ARM::R3); + + emitSPUpdate(MBB, MBBI, TII, dl, *this, VARegSaveSize); + + BuildMI(MBB, MBBI, dl, TII.get(ARM::tBX_RET_vararg)).addReg(ARM::R3); + MBB.erase(MBBI); + } +} Added: llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h?rev=74731&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h (added) +++ llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h Thu Jul 2 17:18:33 2009 @@ -0,0 +1,60 @@ +//===- Thumb2RegisterInfo.h - Thumb-2 Register Information Impl ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains the Thumb-2 implementation of the TargetRegisterInfo class. +// +//===----------------------------------------------------------------------===// + +#ifndef THUMB2REGISTERINFO_H +#define THUMB2REGISTERINFO_H + +#include "ARM.h" +#include "ARMRegisterInfo.h" +#include "llvm/Target/TargetRegisterInfo.h" + +namespace llvm { + class ARMSubtarget; + class TargetInstrInfo; + class Type; + +struct Thumb2RegisterInfo : public ARMBaseRegisterInfo { +public: + Thumb2RegisterInfo(const TargetInstrInfo &tii, const ARMSubtarget &STI); + + /// emitLoadConstPool - Emits a load from constpool to materialize the + /// specified immediate. + void emitLoadConstPool(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, int Val, + const TargetInstrInfo *TII, + DebugLoc dl) const; + + /// Code Generation virtual methods... + const TargetRegisterClass * + getPhysicalRegisterRegClass(unsigned Reg, MVT VT = MVT::Other) const; + + bool isReservedReg(const MachineFunction &MF, unsigned Reg) const; + + bool requiresRegisterScavenging(const MachineFunction &MF) const; + + bool hasReservedCallFrame(MachineFunction &MF) const; + + void eliminateCallFramePseudoInstr(MachineFunction &MF, + MachineBasicBlock &MBB, + MachineBasicBlock::iterator I) const; + + void eliminateFrameIndex(MachineBasicBlock::iterator II, + int SPAdj, RegScavenger *RS = NULL) const; + + void emitPrologue(MachineFunction &MF) const; + void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; +}; +} + +#endif // THUMB2REGISTERINFO_H Removed: llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp?rev=74730&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ThumbInstrInfo.cpp (removed) @@ -1,312 +0,0 @@ -//===- ThumbInstrInfo.cpp - Thumb Instruction Information --------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the Thumb implementation of the TargetInstrInfo class. -// -//===----------------------------------------------------------------------===// - -#include "ARMInstrInfo.h" -#include "ARM.h" -#include "ARMGenInstrInfo.inc" -#include "ARMMachineFunctionInfo.h" -#include "llvm/CodeGen/MachineFrameInfo.h" -#include "llvm/CodeGen/MachineInstrBuilder.h" -#include "llvm/ADT/SmallVector.h" -#include "ThumbInstrInfo.h" - -using namespace llvm; - -ThumbInstrInfo::ThumbInstrInfo(const ARMSubtarget &STI) - : ARMBaseInstrInfo(STI), RI(*this, STI) { -} - -bool ThumbInstrInfo::isMoveInstr(const MachineInstr &MI, - unsigned &SrcReg, unsigned &DstReg, - unsigned& SrcSubIdx, unsigned& DstSubIdx) const { - SrcSubIdx = DstSubIdx = 0; // No sub-registers. - - unsigned oc = MI.getOpcode(); - switch (oc) { - default: - return false; - // FIXME: Thumb2 - case ARM::tMOVr: - case ARM::tMOVhir2lor: - case ARM::tMOVlor2hir: - case ARM::tMOVhir2hir: - assert(MI.getDesc().getNumOperands() >= 2 && - MI.getOperand(0).isReg() && - MI.getOperand(1).isReg() && - "Invalid Thumb MOV instruction"); - SrcReg = MI.getOperand(1).getReg(); - DstReg = MI.getOperand(0).getReg(); - return true; - } -} - -unsigned ThumbInstrInfo::isLoadFromStackSlot(const MachineInstr *MI, - int &FrameIndex) const { - switch (MI->getOpcode()) { - default: break; - // FIXME: Thumb2 - case ARM::tRestore: - if (MI->getOperand(1).isFI() && - MI->getOperand(2).isImm() && - MI->getOperand(2).getImm() == 0) { - FrameIndex = MI->getOperand(1).getIndex(); - return MI->getOperand(0).getReg(); - } - break; - } - return 0; -} - -unsigned ThumbInstrInfo::isStoreToStackSlot(const MachineInstr *MI, - int &FrameIndex) const { - switch (MI->getOpcode()) { - default: break; - // FIXME: Thumb2 - case ARM::tSpill: - if (MI->getOperand(1).isFI() && - MI->getOperand(2).isImm() && - MI->getOperand(2).getImm() == 0) { - FrameIndex = MI->getOperand(1).getIndex(); - return MI->getOperand(0).getReg(); - } - break; - } - return 0; -} - -bool ThumbInstrInfo::copyRegToReg(MachineBasicBlock &MBB, - MachineBasicBlock::iterator I, - unsigned DestReg, unsigned SrcReg, - const TargetRegisterClass *DestRC, - const TargetRegisterClass *SrcRC) const { - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (I != MBB.end()) DL = I->getDebugLoc(); - - // FIXME: Thumb2 - if (DestRC == ARM::GPRRegisterClass) { - if (SrcRC == ARM::GPRRegisterClass) { - BuildMI(MBB, I, DL, get(ARM::tMOVhir2hir), DestReg).addReg(SrcReg); - return true; - } else if (SrcRC == ARM::tGPRRegisterClass) { - BuildMI(MBB, I, DL, get(ARM::tMOVlor2hir), DestReg).addReg(SrcReg); - return true; - } - } else if (DestRC == ARM::tGPRRegisterClass) { - if (SrcRC == ARM::GPRRegisterClass) { - BuildMI(MBB, I, DL, get(ARM::tMOVhir2lor), DestReg).addReg(SrcReg); - return true; - } else if (SrcRC == ARM::tGPRRegisterClass) { - BuildMI(MBB, I, DL, get(ARM::tMOVr), DestReg).addReg(SrcReg); - return true; - } - } - - return false; -} - -bool ThumbInstrInfo:: -canFoldMemoryOperand(const MachineInstr *MI, - const SmallVectorImpl &Ops) const { - if (Ops.size() != 1) return false; - - unsigned OpNum = Ops[0]; - unsigned Opc = MI->getOpcode(); - switch (Opc) { - default: break; - case ARM::tMOVr: - case ARM::tMOVlor2hir: - case ARM::tMOVhir2lor: - case ARM::tMOVhir2hir: { - if (OpNum == 0) { // move -> store - unsigned SrcReg = MI->getOperand(1).getReg(); - if (RI.isPhysicalRegister(SrcReg) && !isARMLowRegister(SrcReg)) - // tSpill cannot take a high register operand. - return false; - } else { // move -> load - unsigned DstReg = MI->getOperand(0).getReg(); - if (RI.isPhysicalRegister(DstReg) && !isARMLowRegister(DstReg)) - // tRestore cannot target a high register operand. - return false; - } - return true; - } - } - - return false; -} - -void ThumbInstrInfo:: -storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - unsigned SrcReg, bool isKill, int FI, - const TargetRegisterClass *RC) const { - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (I != MBB.end()) DL = I->getDebugLoc(); - - assert(RC == ARM::tGPRRegisterClass && "Unknown regclass!"); - - // FIXME: Thumb2 - if (RC == ARM::tGPRRegisterClass) { - BuildMI(MBB, I, DL, get(ARM::tSpill)) - .addReg(SrcReg, getKillRegState(isKill)) - .addFrameIndex(FI).addImm(0); - } -} - -void ThumbInstrInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - bool isKill, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const{ - DebugLoc DL = DebugLoc::getUnknownLoc(); - unsigned Opc = 0; - - // FIXME: Thumb2. Is GPRRegClass here correct? - assert(RC == ARM::GPRRegisterClass && "Unknown regclass!"); - if (RC == ARM::GPRRegisterClass) { - Opc = Addr[0].isFI() ? ARM::tSpill : ARM::tSTR; - } - - MachineInstrBuilder MIB = - BuildMI(MF, DL, get(Opc)).addReg(SrcReg, getKillRegState(isKill)); - for (unsigned i = 0, e = Addr.size(); i != e; ++i) - MIB.addOperand(Addr[i]); - NewMIs.push_back(MIB); - return; -} - -void ThumbInstrInfo:: -loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - unsigned DestReg, int FI, - const TargetRegisterClass *RC) const { - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (I != MBB.end()) DL = I->getDebugLoc(); - - // FIXME: Thumb2 - assert(RC == ARM::tGPRRegisterClass && "Unknown regclass!"); - - if (RC == ARM::tGPRRegisterClass) { - BuildMI(MBB, I, DL, get(ARM::tRestore), DestReg) - .addFrameIndex(FI).addImm(0); - } -} - -void ThumbInstrInfo:: -loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const { - DebugLoc DL = DebugLoc::getUnknownLoc(); - unsigned Opc = 0; - - // FIXME: Thumb2. Is GPRRegClass ok here? - if (RC == ARM::GPRRegisterClass) { - Opc = Addr[0].isFI() ? ARM::tRestore : ARM::tLDR; - } - - MachineInstrBuilder MIB = BuildMI(MF, DL, get(Opc), DestReg); - for (unsigned i = 0, e = Addr.size(); i != e; ++i) - MIB.addOperand(Addr[i]); - NewMIs.push_back(MIB); - return; -} - -bool ThumbInstrInfo:: -spillCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, - const std::vector &CSI) const { - if (CSI.empty()) - return false; - - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (MI != MBB.end()) DL = MI->getDebugLoc(); - - MachineInstrBuilder MIB = BuildMI(MBB, MI, DL, get(ARM::tPUSH)); - for (unsigned i = CSI.size(); i != 0; --i) { - unsigned Reg = CSI[i-1].getReg(); - // Add the callee-saved register as live-in. It's killed at the spill. - MBB.addLiveIn(Reg); - MIB.addReg(Reg, RegState::Kill); - } - return true; -} - -bool ThumbInstrInfo:: -restoreCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, - const std::vector &CSI) const { - MachineFunction &MF = *MBB.getParent(); - ARMFunctionInfo *AFI = MF.getInfo(); - if (CSI.empty()) - return false; - - bool isVarArg = AFI->getVarArgsRegSaveSize() > 0; - MachineInstr *PopMI = MF.CreateMachineInstr(get(ARM::tPOP),MI->getDebugLoc()); - for (unsigned i = CSI.size(); i != 0; --i) { - unsigned Reg = CSI[i-1].getReg(); - if (Reg == ARM::LR) { - // Special epilogue for vararg functions. See emitEpilogue - if (isVarArg) - continue; - Reg = ARM::PC; - PopMI->setDesc(get(ARM::tPOP_RET)); - MI = MBB.erase(MI); - } - PopMI->addOperand(MachineOperand::CreateReg(Reg, true)); - } - - // It's illegal to emit pop instruction without operands. - if (PopMI->getNumOperands() > 0) - MBB.insert(MI, PopMI); - - return true; -} - -MachineInstr *ThumbInstrInfo:: -foldMemoryOperandImpl(MachineFunction &MF, MachineInstr *MI, - const SmallVectorImpl &Ops, int FI) const { - if (Ops.size() != 1) return NULL; - - unsigned OpNum = Ops[0]; - unsigned Opc = MI->getOpcode(); - MachineInstr *NewMI = NULL; - switch (Opc) { - default: break; - case ARM::tMOVr: - case ARM::tMOVlor2hir: - case ARM::tMOVhir2lor: - case ARM::tMOVhir2hir: { - if (OpNum == 0) { // move -> store - unsigned SrcReg = MI->getOperand(1).getReg(); - bool isKill = MI->getOperand(1).isKill(); - if (RI.isPhysicalRegister(SrcReg) && !isARMLowRegister(SrcReg)) - // tSpill cannot take a high register operand. - break; - NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::tSpill)) - .addReg(SrcReg, getKillRegState(isKill)) - .addFrameIndex(FI).addImm(0); - } else { // move -> load - unsigned DstReg = MI->getOperand(0).getReg(); - if (RI.isPhysicalRegister(DstReg) && !isARMLowRegister(DstReg)) - // tRestore cannot target a high register operand. - break; - bool isDead = MI->getOperand(0).isDead(); - NewMI = BuildMI(MF, MI->getDebugLoc(), get(ARM::tRestore)) - .addReg(DstReg, RegState::Define | getDeadRegState(isDead)) - .addFrameIndex(FI).addImm(0); - } - break; - } - } - - return NewMI; -} Removed: llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h?rev=74730&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ThumbInstrInfo.h (removed) @@ -1,95 +0,0 @@ -//===- ThumbInstrInfo.h - Thumb Instruction Information ----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the ARM implementation of the TargetInstrInfo class. -// -//===----------------------------------------------------------------------===// - -#ifndef THUMBINSTRUCTIONINFO_H -#define THUMBINSTRUCTIONINFO_H - -#include "llvm/Target/TargetInstrInfo.h" -#include "ARM.h" -#include "ARMInstrInfo.h" -#include "ThumbRegisterInfo.h" - -namespace llvm { - class ARMSubtarget; - -class ThumbInstrInfo : public ARMBaseInstrInfo { - ThumbRegisterInfo RI; -public: - explicit ThumbInstrInfo(const ARMSubtarget &STI); - - /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As - /// such, whenever a client has an instance of instruction info, it should - /// always be able to get register info as well (through this method). - /// - virtual const ThumbRegisterInfo &getRegisterInfo() const { return RI; } - - /// Return true if the instruction is a register to register move and return - /// the source and dest operands and their sub-register indices by reference. - virtual bool isMoveInstr(const MachineInstr &MI, - unsigned &SrcReg, unsigned &DstReg, - unsigned &SrcSubIdx, unsigned &DstSubIdx) const; - - virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, - int &FrameIndex) const; - virtual unsigned isStoreToStackSlot(const MachineInstr *MI, - int &FrameIndex) const; - - virtual bool copyRegToReg(MachineBasicBlock &MBB, - MachineBasicBlock::iterator I, - unsigned DestReg, unsigned SrcReg, - const TargetRegisterClass *DestRC, - const TargetRegisterClass *SrcRC) const; - virtual void storeRegToStackSlot(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MBBI, - unsigned SrcReg, bool isKill, int FrameIndex, - const TargetRegisterClass *RC) const; - - virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const; - - virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MBBI, - unsigned DestReg, int FrameIndex, - const TargetRegisterClass *RC) const; - - virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const; - virtual bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, - const std::vector &CSI) const; - virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, - const std::vector &CSI) const; - - virtual bool canFoldMemoryOperand(const MachineInstr *MI, - const SmallVectorImpl &Ops) const; - - virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, - MachineInstr* MI, - const SmallVectorImpl &Ops, - MachineInstr* LoadMI) const { - return 0; - } - - virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, - MachineInstr* MI, - const SmallVectorImpl &Ops, - int FrameIndex) const; -}; -} - -#endif // THUMBINSTRUCTIONINFO_H Removed: llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp?rev=74730&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.cpp (removed) @@ -1,755 +0,0 @@ -//===- ThumbRegisterInfo.cpp - Thumb Register Information -------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the ARM implementation of the TargetRegisterInfo class. -// -//===----------------------------------------------------------------------===// - -#include "ARM.h" -#include "ARMAddressingModes.h" -#include "ARMMachineFunctionInfo.h" -#include "ARMSubtarget.h" -#include "ThumbInstrInfo.h" -#include "ThumbRegisterInfo.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/CodeGen/MachineConstantPool.h" -#include "llvm/CodeGen/MachineFrameInfo.h" -#include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineInstrBuilder.h" -#include "llvm/CodeGen/MachineLocation.h" -#include "llvm/CodeGen/MachineRegisterInfo.h" -#include "llvm/Target/TargetFrameInfo.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/ADT/BitVector.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/Support/CommandLine.h" -using namespace llvm; - -static cl::opt -ThumbRegScavenging("enable-thumb-reg-scavenging", - cl::Hidden, - cl::desc("Enable register scavenging on Thumb")); - -ThumbRegisterInfo::ThumbRegisterInfo(const TargetInstrInfo &tii, - const ARMSubtarget &sti) - : ARMBaseRegisterInfo(tii, sti) { -} - -/// emitLoadConstPool - Emits a load from constpool to materialize the -/// specified immediate. -void ThumbRegisterInfo::emitLoadConstPool(MachineBasicBlock &MBB, - MachineBasicBlock::iterator &MBBI, - unsigned DestReg, int Val, - const TargetInstrInfo *TII, - DebugLoc dl) const { - MachineFunction &MF = *MBB.getParent(); - MachineConstantPool *ConstantPool = MF.getConstantPool(); - Constant *C = ConstantInt::get(Type::Int32Ty, Val); - unsigned Idx = ConstantPool->getConstantPoolIndex(C, 4); - - BuildMI(MBB, MBBI, dl, TII->get(ARM::tLDRcp), DestReg) - .addConstantPoolIndex(Idx); -} - -const TargetRegisterClass* -ThumbRegisterInfo::getPhysicalRegisterRegClass(unsigned Reg, MVT VT) const { - if (isARMLowRegister(Reg)) - return ARM::tGPRRegisterClass; - switch (Reg) { - default: - break; - case ARM::R8: case ARM::R9: case ARM::R10: case ARM::R11: - case ARM::R12: case ARM::SP: case ARM::LR: case ARM::PC: - return ARM::GPRRegisterClass; - } - - return TargetRegisterInfo::getPhysicalRegisterRegClass(Reg, VT); -} - -bool -ThumbRegisterInfo::requiresRegisterScavenging(const MachineFunction &MF) const { - return ThumbRegScavenging; -} - -bool ThumbRegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { - const MachineFrameInfo *FFI = MF.getFrameInfo(); - unsigned CFSize = FFI->getMaxCallFrameSize(); - // It's not always a good idea to include the call frame as part of the - // stack frame. ARM (especially Thumb) has small immediate offset to - // address the stack frame. So a large call frame can cause poor codegen - // and may even makes it impossible to scavenge a register. - if (CFSize >= ((1 << 8) - 1) * 4 / 2) // Half of imm8 * 4 - return false; - - return !MF.getFrameInfo()->hasVarSizedObjects(); -} - -/// emitThumbRegPlusImmInReg - Emits a series of instructions to materialize -/// a destreg = basereg + immediate in Thumb code. Materialize the immediate -/// in a register using mov / mvn sequences or load the immediate from a -/// constpool entry. -static -void emitThumbRegPlusImmInReg(MachineBasicBlock &MBB, - MachineBasicBlock::iterator &MBBI, - unsigned DestReg, unsigned BaseReg, - int NumBytes, bool CanChangeCC, - const TargetInstrInfo &TII, - const ThumbRegisterInfo& MRI, - DebugLoc dl) { - bool isHigh = !isARMLowRegister(DestReg) || - (BaseReg != 0 && !isARMLowRegister(BaseReg)); - bool isSub = false; - // Subtract doesn't have high register version. Load the negative value - // if either base or dest register is a high register. Also, if do not - // issue sub as part of the sequence if condition register is to be - // preserved. - if (NumBytes < 0 && !isHigh && CanChangeCC) { - isSub = true; - NumBytes = -NumBytes; - } - unsigned LdReg = DestReg; - if (DestReg == ARM::SP) { - assert(BaseReg == ARM::SP && "Unexpected!"); - LdReg = ARM::R3; - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVlor2hir), ARM::R12) - .addReg(ARM::R3, RegState::Kill); - } - - if (NumBytes <= 255 && NumBytes >= 0) - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVi8), LdReg).addImm(NumBytes); - else if (NumBytes < 0 && NumBytes >= -255) { - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVi8), LdReg).addImm(NumBytes); - BuildMI(MBB, MBBI, dl, TII.get(ARM::tNEG), LdReg) - .addReg(LdReg, RegState::Kill); - } else - MRI.emitLoadConstPool(MBB, MBBI, LdReg, NumBytes, &TII, dl); - - // Emit add / sub. - int Opc = (isSub) ? ARM::tSUBrr : (isHigh ? ARM::tADDhirr : ARM::tADDrr); - const MachineInstrBuilder MIB = BuildMI(MBB, MBBI, dl, - TII.get(Opc), DestReg); - if (DestReg == ARM::SP || isSub) - MIB.addReg(BaseReg).addReg(LdReg, RegState::Kill); - else - MIB.addReg(LdReg).addReg(BaseReg, RegState::Kill); - if (DestReg == ARM::SP) - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVhir2lor), ARM::R3) - .addReg(ARM::R12, RegState::Kill); -} - -/// calcNumMI - Returns the number of instructions required to materialize -/// the specific add / sub r, c instruction. -static unsigned calcNumMI(int Opc, int ExtraOpc, unsigned Bytes, - unsigned NumBits, unsigned Scale) { - unsigned NumMIs = 0; - unsigned Chunk = ((1 << NumBits) - 1) * Scale; - - if (Opc == ARM::tADDrSPi) { - unsigned ThisVal = (Bytes > Chunk) ? Chunk : Bytes; - Bytes -= ThisVal; - NumMIs++; - NumBits = 8; - Scale = 1; // Followed by a number of tADDi8. - Chunk = ((1 << NumBits) - 1) * Scale; - } - - NumMIs += Bytes / Chunk; - if ((Bytes % Chunk) != 0) - NumMIs++; - if (ExtraOpc) - NumMIs++; - return NumMIs; -} - -/// emitThumbRegPlusImmediate - Emits a series of instructions to materialize -/// a destreg = basereg + immediate in Thumb code. -static -void emitThumbRegPlusImmediate(MachineBasicBlock &MBB, - MachineBasicBlock::iterator &MBBI, - unsigned DestReg, unsigned BaseReg, - int NumBytes, const TargetInstrInfo &TII, - const ThumbRegisterInfo& MRI, - DebugLoc dl) { - bool isSub = NumBytes < 0; - unsigned Bytes = (unsigned)NumBytes; - if (isSub) Bytes = -NumBytes; - bool isMul4 = (Bytes & 3) == 0; - bool isTwoAddr = false; - bool DstNotEqBase = false; - unsigned NumBits = 1; - unsigned Scale = 1; - int Opc = 0; - int ExtraOpc = 0; - - if (DestReg == BaseReg && BaseReg == ARM::SP) { - assert(isMul4 && "Thumb sp inc / dec size must be multiple of 4!"); - NumBits = 7; - Scale = 4; - Opc = isSub ? ARM::tSUBspi : ARM::tADDspi; - isTwoAddr = true; - } else if (!isSub && BaseReg == ARM::SP) { - // r1 = add sp, 403 - // => - // r1 = add sp, 100 * 4 - // r1 = add r1, 3 - if (!isMul4) { - Bytes &= ~3; - ExtraOpc = ARM::tADDi3; - } - NumBits = 8; - Scale = 4; - Opc = ARM::tADDrSPi; - } else { - // sp = sub sp, c - // r1 = sub sp, c - // r8 = sub sp, c - if (DestReg != BaseReg) - DstNotEqBase = true; - NumBits = 8; - Opc = isSub ? ARM::tSUBi8 : ARM::tADDi8; - isTwoAddr = true; - } - - unsigned NumMIs = calcNumMI(Opc, ExtraOpc, Bytes, NumBits, Scale); - unsigned Threshold = (DestReg == ARM::SP) ? 3 : 2; - if (NumMIs > Threshold) { - // This will expand into too many instructions. Load the immediate from a - // constpool entry. - emitThumbRegPlusImmInReg(MBB, MBBI, DestReg, BaseReg, NumBytes, true, TII, - MRI, dl); - return; - } - - if (DstNotEqBase) { - if (isARMLowRegister(DestReg) && isARMLowRegister(BaseReg)) { - // If both are low registers, emit DestReg = add BaseReg, max(Imm, 7) - unsigned Chunk = (1 << 3) - 1; - unsigned ThisVal = (Bytes > Chunk) ? Chunk : Bytes; - Bytes -= ThisVal; - BuildMI(MBB, MBBI, dl,TII.get(isSub ? ARM::tSUBi3 : ARM::tADDi3), DestReg) - .addReg(BaseReg, RegState::Kill).addImm(ThisVal); - } else { - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr), DestReg) - .addReg(BaseReg, RegState::Kill); - } - BaseReg = DestReg; - } - - unsigned Chunk = ((1 << NumBits) - 1) * Scale; - while (Bytes) { - unsigned ThisVal = (Bytes > Chunk) ? Chunk : Bytes; - Bytes -= ThisVal; - ThisVal /= Scale; - // Build the new tADD / tSUB. - if (isTwoAddr) - BuildMI(MBB, MBBI, dl, TII.get(Opc), DestReg) - .addReg(DestReg).addImm(ThisVal); - else { - bool isKill = BaseReg != ARM::SP; - BuildMI(MBB, MBBI, dl, TII.get(Opc), DestReg) - .addReg(BaseReg, getKillRegState(isKill)).addImm(ThisVal); - BaseReg = DestReg; - - if (Opc == ARM::tADDrSPi) { - // r4 = add sp, imm - // r4 = add r4, imm - // ... - NumBits = 8; - Scale = 1; - Chunk = ((1 << NumBits) - 1) * Scale; - Opc = isSub ? ARM::tSUBi8 : ARM::tADDi8; - isTwoAddr = true; - } - } - } - - if (ExtraOpc) - BuildMI(MBB, MBBI, dl, TII.get(ExtraOpc), DestReg) - .addReg(DestReg, RegState::Kill) - .addImm(((unsigned)NumBytes) & 3); -} - -static void emitSPUpdate(MachineBasicBlock &MBB, - MachineBasicBlock::iterator &MBBI, - const TargetInstrInfo &TII, DebugLoc dl, - const ThumbRegisterInfo &MRI, - int NumBytes) { - emitThumbRegPlusImmediate(MBB, MBBI, ARM::SP, ARM::SP, NumBytes, TII, - MRI, dl); -} - -void ThumbRegisterInfo:: -eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, - MachineBasicBlock::iterator I) const { - if (!hasReservedCallFrame(MF)) { - // If we have alloca, convert as follows: - // ADJCALLSTACKDOWN -> sub, sp, sp, amount - // ADJCALLSTACKUP -> add, sp, sp, amount - MachineInstr *Old = I; - DebugLoc dl = Old->getDebugLoc(); - unsigned Amount = Old->getOperand(0).getImm(); - if (Amount != 0) { - // We need to keep the stack aligned properly. To do this, we round the - // amount of space needed for the outgoing arguments up to the next - // alignment boundary. - unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment(); - Amount = (Amount+Align-1)/Align*Align; - - // Replace the pseudo instruction with a new instruction... - unsigned Opc = Old->getOpcode(); - if (Opc == ARM::ADJCALLSTACKDOWN || Opc == ARM::tADJCALLSTACKDOWN) { - emitSPUpdate(MBB, I, TII, dl, *this, -Amount); - } else { - assert(Opc == ARM::ADJCALLSTACKUP || Opc == ARM::tADJCALLSTACKUP); - emitSPUpdate(MBB, I, TII, dl, *this, Amount); - } - } - } - MBB.erase(I); -} - -/// emitThumbConstant - Emit a series of instructions to materialize a -/// constant. -static void emitThumbConstant(MachineBasicBlock &MBB, - MachineBasicBlock::iterator &MBBI, - unsigned DestReg, int Imm, - const TargetInstrInfo &TII, - const ThumbRegisterInfo& MRI, - DebugLoc dl) { - bool isSub = Imm < 0; - if (isSub) Imm = -Imm; - - int Chunk = (1 << 8) - 1; - int ThisVal = (Imm > Chunk) ? Chunk : Imm; - Imm -= ThisVal; - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVi8), DestReg).addImm(ThisVal); - if (Imm > 0) - emitThumbRegPlusImmediate(MBB, MBBI, DestReg, DestReg, Imm, TII, MRI, dl); - if (isSub) - BuildMI(MBB, MBBI, dl, TII.get(ARM::tNEG), DestReg) - .addReg(DestReg, RegState::Kill); -} - -void ThumbRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, - int SPAdj, RegScavenger *RS) const{ - unsigned i = 0; - MachineInstr &MI = *II; - MachineBasicBlock &MBB = *MI.getParent(); - MachineFunction &MF = *MBB.getParent(); - ARMFunctionInfo *AFI = MF.getInfo(); - DebugLoc dl = MI.getDebugLoc(); - - while (!MI.getOperand(i).isFI()) { - ++i; - assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); - } - - unsigned FrameReg = ARM::SP; - int FrameIndex = MI.getOperand(i).getIndex(); - int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) + - MF.getFrameInfo()->getStackSize() + SPAdj; - - if (AFI->isGPRCalleeSavedArea1Frame(FrameIndex)) - Offset -= AFI->getGPRCalleeSavedArea1Offset(); - else if (AFI->isGPRCalleeSavedArea2Frame(FrameIndex)) - Offset -= AFI->getGPRCalleeSavedArea2Offset(); - else if (hasFP(MF)) { - assert(SPAdj == 0 && "Unexpected"); - // There is alloca()'s in this function, must reference off the frame - // pointer instead. - FrameReg = getFrameRegister(MF); - Offset -= AFI->getFramePtrSpillOffset(); - } - - unsigned Opcode = MI.getOpcode(); - const TargetInstrDesc &Desc = MI.getDesc(); - unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); - - if (Opcode == ARM::tADDrSPi) { - Offset += MI.getOperand(i+1).getImm(); - - // Can't use tADDrSPi if it's based off the frame pointer. - unsigned NumBits = 0; - unsigned Scale = 1; - if (FrameReg != ARM::SP) { - Opcode = ARM::tADDi3; - MI.setDesc(TII.get(ARM::tADDi3)); - NumBits = 3; - } else { - NumBits = 8; - Scale = 4; - assert((Offset & 3) == 0 && - "Thumb add/sub sp, #imm immediate must be multiple of 4!"); - } - - if (Offset == 0) { - // Turn it into a move. - MI.setDesc(TII.get(ARM::tMOVhir2lor)); - MI.getOperand(i).ChangeToRegister(FrameReg, false); - MI.RemoveOperand(i+1); - return; - } - - // Common case: small offset, fits into instruction. - unsigned Mask = (1 << NumBits) - 1; - if (((Offset / Scale) & ~Mask) == 0) { - // Replace the FrameIndex with sp / fp - MI.getOperand(i).ChangeToRegister(FrameReg, false); - MI.getOperand(i+1).ChangeToImmediate(Offset / Scale); - return; - } - - unsigned DestReg = MI.getOperand(0).getReg(); - unsigned Bytes = (Offset > 0) ? Offset : -Offset; - unsigned NumMIs = calcNumMI(Opcode, 0, Bytes, NumBits, Scale); - // MI would expand into a large number of instructions. Don't try to - // simplify the immediate. - if (NumMIs > 2) { - emitThumbRegPlusImmediate(MBB, II, DestReg, FrameReg, Offset, TII, - *this, dl); - MBB.erase(II); - return; - } - - if (Offset > 0) { - // Translate r0 = add sp, imm to - // r0 = add sp, 255*4 - // r0 = add r0, (imm - 255*4) - MI.getOperand(i).ChangeToRegister(FrameReg, false); - MI.getOperand(i+1).ChangeToImmediate(Mask); - Offset = (Offset - Mask * Scale); - MachineBasicBlock::iterator NII = next(II); - emitThumbRegPlusImmediate(MBB, NII, DestReg, DestReg, Offset, TII, - *this, dl); - } else { - // Translate r0 = add sp, -imm to - // r0 = -imm (this is then translated into a series of instructons) - // r0 = add r0, sp - emitThumbConstant(MBB, II, DestReg, Offset, TII, *this, dl); - MI.setDesc(TII.get(ARM::tADDhirr)); - MI.getOperand(i).ChangeToRegister(DestReg, false, false, true); - MI.getOperand(i+1).ChangeToRegister(FrameReg, false); - } - return; - } else { - unsigned ImmIdx = 0; - int InstrOffs = 0; - unsigned NumBits = 0; - unsigned Scale = 1; - switch (AddrMode) { - case ARMII::AddrModeT1_s: { - ImmIdx = i+1; - InstrOffs = MI.getOperand(ImmIdx).getImm(); - NumBits = (FrameReg == ARM::SP) ? 8 : 5; - Scale = 4; - break; - } - default: - assert(0 && "Unsupported addressing mode!"); - abort(); - break; - } - - Offset += InstrOffs * Scale; - assert((Offset & (Scale-1)) == 0 && "Can't encode this offset!"); - - // Common case: small offset, fits into instruction. - MachineOperand &ImmOp = MI.getOperand(ImmIdx); - int ImmedOffset = Offset / Scale; - unsigned Mask = (1 << NumBits) - 1; - if ((unsigned)Offset <= Mask * Scale) { - // Replace the FrameIndex with sp - MI.getOperand(i).ChangeToRegister(FrameReg, false); - ImmOp.ChangeToImmediate(ImmedOffset); - return; - } - - bool isThumSpillRestore = Opcode == ARM::tRestore || Opcode == ARM::tSpill; - if (AddrMode == ARMII::AddrModeT1_s) { - // Thumb tLDRspi, tSTRspi. These will change to instructions that use - // a different base register. - NumBits = 5; - Mask = (1 << NumBits) - 1; - } - // If this is a thumb spill / restore, we will be using a constpool load to - // materialize the offset. - if (AddrMode == ARMII::AddrModeT1_s && isThumSpillRestore) - ImmOp.ChangeToImmediate(0); - else { - // Otherwise, it didn't fit. Pull in what we can to simplify the immed. - ImmedOffset = ImmedOffset & Mask; - ImmOp.ChangeToImmediate(ImmedOffset); - Offset &= ~(Mask*Scale); - } - } - - // If we get here, the immediate doesn't fit into the instruction. We folded - // as much as possible above, handle the rest, providing a register that is - // SP+LargeImm. - assert(Offset && "This code isn't needed if offset already handled!"); - - if (Desc.mayLoad()) { - // Use the destination register to materialize sp + offset. - unsigned TmpReg = MI.getOperand(0).getReg(); - bool UseRR = false; - if (Opcode == ARM::tRestore) { - if (FrameReg == ARM::SP) - emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg, - Offset, false, TII, *this, dl); - else { - emitLoadConstPool(MBB, II, TmpReg, Offset, &TII, dl); - UseRR = true; - } - } else - emitThumbRegPlusImmediate(MBB, II, TmpReg, FrameReg, Offset, TII, - *this, dl); - MI.setDesc(TII.get(ARM::tLDR)); - MI.getOperand(i).ChangeToRegister(TmpReg, false, false, true); - if (UseRR) - // Use [reg, reg] addrmode. - MI.addOperand(MachineOperand::CreateReg(FrameReg, false)); - else // tLDR has an extra register operand. - MI.addOperand(MachineOperand::CreateReg(0, false)); - } else if (Desc.mayStore()) { - // FIXME! This is horrific!!! We need register scavenging. - // Our temporary workaround has marked r3 unavailable. Of course, r3 is - // also a ABI register so it's possible that is is the register that is - // being storing here. If that's the case, we do the following: - // r12 = r2 - // Use r2 to materialize sp + offset - // str r3, r2 - // r2 = r12 - unsigned ValReg = MI.getOperand(0).getReg(); - unsigned TmpReg = ARM::R3; - bool UseRR = false; - if (ValReg == ARM::R3) { - BuildMI(MBB, II, dl, TII.get(ARM::tMOVlor2hir), ARM::R12) - .addReg(ARM::R2, RegState::Kill); - TmpReg = ARM::R2; - } - if (TmpReg == ARM::R3 && AFI->isR3LiveIn()) - BuildMI(MBB, II, dl, TII.get(ARM::tMOVlor2hir), ARM::R12) - .addReg(ARM::R3, RegState::Kill); - if (Opcode == ARM::tSpill) { - if (FrameReg == ARM::SP) - emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg, - Offset, false, TII, *this, dl); - else { - emitLoadConstPool(MBB, II, TmpReg, Offset, &TII, dl); - UseRR = true; - } - } else - emitThumbRegPlusImmediate(MBB, II, TmpReg, FrameReg, Offset, TII, - *this, dl); - MI.setDesc(TII.get(ARM::tSTR)); - MI.getOperand(i).ChangeToRegister(TmpReg, false, false, true); - if (UseRR) // Use [reg, reg] addrmode. - MI.addOperand(MachineOperand::CreateReg(FrameReg, false)); - else // tSTR has an extra register operand. - MI.addOperand(MachineOperand::CreateReg(0, false)); - - MachineBasicBlock::iterator NII = next(II); - if (ValReg == ARM::R3) - BuildMI(MBB, NII, dl, TII.get(ARM::tMOVhir2lor), ARM::R2) - .addReg(ARM::R12, RegState::Kill); - if (TmpReg == ARM::R3 && AFI->isR3LiveIn()) - BuildMI(MBB, NII, dl, TII.get(ARM::tMOVhir2lor), ARM::R3) - .addReg(ARM::R12, RegState::Kill); - } else - assert(false && "Unexpected opcode!"); -} - -void ThumbRegisterInfo::emitPrologue(MachineFunction &MF) const { - MachineBasicBlock &MBB = MF.front(); - MachineBasicBlock::iterator MBBI = MBB.begin(); - MachineFrameInfo *MFI = MF.getFrameInfo(); - ARMFunctionInfo *AFI = MF.getInfo(); - unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize(); - unsigned NumBytes = MFI->getStackSize(); - const std::vector &CSI = MFI->getCalleeSavedInfo(); - DebugLoc dl = (MBBI != MBB.end() ? - MBBI->getDebugLoc() : DebugLoc::getUnknownLoc()); - - // Check if R3 is live in. It might have to be used as a scratch register. - for (MachineRegisterInfo::livein_iterator I =MF.getRegInfo().livein_begin(), - E = MF.getRegInfo().livein_end(); I != E; ++I) { - if (I->first == ARM::R3) { - AFI->setR3IsLiveIn(true); - break; - } - } - - // Thumb add/sub sp, imm8 instructions implicitly multiply the offset by 4. - NumBytes = (NumBytes + 3) & ~3; - MFI->setStackSize(NumBytes); - - // Determine the sizes of each callee-save spill areas and record which frame - // belongs to which callee-save spill areas. - unsigned GPRCS1Size = 0, GPRCS2Size = 0, DPRCSSize = 0; - int FramePtrSpillFI = 0; - - if (VARegSaveSize) - emitSPUpdate(MBB, MBBI, TII, dl, *this, -VARegSaveSize); - - if (!AFI->hasStackFrame()) { - if (NumBytes != 0) - emitSPUpdate(MBB, MBBI, TII, dl, *this, -NumBytes); - return; - } - - for (unsigned i = 0, e = CSI.size(); i != e; ++i) { - unsigned Reg = CSI[i].getReg(); - int FI = CSI[i].getFrameIdx(); - switch (Reg) { - case ARM::R4: - case ARM::R5: - case ARM::R6: - case ARM::R7: - case ARM::LR: - if (Reg == FramePtr) - FramePtrSpillFI = FI; - AFI->addGPRCalleeSavedArea1Frame(FI); - GPRCS1Size += 4; - break; - case ARM::R8: - case ARM::R9: - case ARM::R10: - case ARM::R11: - if (Reg == FramePtr) - FramePtrSpillFI = FI; - if (STI.isTargetDarwin()) { - AFI->addGPRCalleeSavedArea2Frame(FI); - GPRCS2Size += 4; - } else { - AFI->addGPRCalleeSavedArea1Frame(FI); - GPRCS1Size += 4; - } - break; - default: - AFI->addDPRCalleeSavedAreaFrame(FI); - DPRCSSize += 8; - } - } - - if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH) { - ++MBBI; - if (MBBI != MBB.end()) - dl = MBBI->getDebugLoc(); - } - - // Darwin ABI requires FP to point to the stack slot that contains the - // previous FP. - if (STI.isTargetDarwin() || hasFP(MF)) { - MachineInstrBuilder MIB = - BuildMI(MBB, MBBI, dl, TII.get(ARM::tADDrSPi), FramePtr) - .addFrameIndex(FramePtrSpillFI).addImm(0); - } - - // Determine starting offsets of spill areas. - unsigned DPRCSOffset = NumBytes - (GPRCS1Size + GPRCS2Size + DPRCSSize); - unsigned GPRCS2Offset = DPRCSOffset + DPRCSSize; - unsigned GPRCS1Offset = GPRCS2Offset + GPRCS2Size; - AFI->setFramePtrSpillOffset(MFI->getObjectOffset(FramePtrSpillFI) + NumBytes); - AFI->setGPRCalleeSavedArea1Offset(GPRCS1Offset); - AFI->setGPRCalleeSavedArea2Offset(GPRCS2Offset); - AFI->setDPRCalleeSavedAreaOffset(DPRCSOffset); - - NumBytes = DPRCSOffset; - if (NumBytes) { - // Insert it after all the callee-save spills. - emitSPUpdate(MBB, MBBI, TII, dl, *this, -NumBytes); - } - - if (STI.isTargetELF() && hasFP(MF)) { - MFI->setOffsetAdjustment(MFI->getOffsetAdjustment() - - AFI->getFramePtrSpillOffset()); - } - - AFI->setGPRCalleeSavedArea1Size(GPRCS1Size); - AFI->setGPRCalleeSavedArea2Size(GPRCS2Size); - AFI->setDPRCalleeSavedAreaSize(DPRCSSize); -} - -static bool isCalleeSavedRegister(unsigned Reg, const unsigned *CSRegs) { - for (unsigned i = 0; CSRegs[i]; ++i) - if (Reg == CSRegs[i]) - return true; - return false; -} - -static bool isCSRestore(MachineInstr *MI, const unsigned *CSRegs) { - return (MI->getOpcode() == ARM::tRestore && - MI->getOperand(1).isFI() && - isCalleeSavedRegister(MI->getOperand(0).getReg(), CSRegs)); -} - -void ThumbRegisterInfo::emitEpilogue(MachineFunction &MF, - MachineBasicBlock &MBB) const { - MachineBasicBlock::iterator MBBI = prior(MBB.end()); - assert((MBBI->getOpcode() == ARM::tBX_RET || - MBBI->getOpcode() == ARM::tPOP_RET) && - "Can only insert epilog into returning blocks"); - DebugLoc dl = MBBI->getDebugLoc(); - MachineFrameInfo *MFI = MF.getFrameInfo(); - ARMFunctionInfo *AFI = MF.getInfo(); - unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize(); - int NumBytes = (int)MFI->getStackSize(); - - if (!AFI->hasStackFrame()) { - if (NumBytes != 0) - emitSPUpdate(MBB, MBBI, TII, dl, *this, NumBytes); - } else { - // Unwind MBBI to point to first LDR / FLDD. - const unsigned *CSRegs = getCalleeSavedRegs(); - if (MBBI != MBB.begin()) { - do - --MBBI; - while (MBBI != MBB.begin() && isCSRestore(MBBI, CSRegs)); - if (!isCSRestore(MBBI, CSRegs)) - ++MBBI; - } - - // Move SP to start of FP callee save spill area. - NumBytes -= (AFI->getGPRCalleeSavedArea1Size() + - AFI->getGPRCalleeSavedArea2Size() + - AFI->getDPRCalleeSavedAreaSize()); - - if (hasFP(MF)) { - NumBytes = AFI->getFramePtrSpillOffset() - NumBytes; - // Reset SP based on frame pointer only if the stack frame extends beyond - // frame pointer stack slot or target is ELF and the function has FP. - if (NumBytes) - emitThumbRegPlusImmediate(MBB, MBBI, ARM::SP, FramePtr, -NumBytes, - TII, *this, dl); - else - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVlor2hir), ARM::SP) - .addReg(FramePtr); - } else { - if (MBBI->getOpcode() == ARM::tBX_RET && - &MBB.front() != MBBI && - prior(MBBI)->getOpcode() == ARM::tPOP) { - MachineBasicBlock::iterator PMBBI = prior(MBBI); - emitSPUpdate(MBB, PMBBI, TII, dl, *this, NumBytes); - } else - emitSPUpdate(MBB, MBBI, TII, dl, *this, NumBytes); - } - } - - if (VARegSaveSize) { - // Epilogue for vararg functions: pop LR to R3 and branch off it. - // FIXME: Verify this is still ok when R3 is no longer being reserved. - BuildMI(MBB, MBBI, dl, TII.get(ARM::tPOP)).addReg(ARM::R3); - - emitSPUpdate(MBB, MBBI, TII, dl, *this, VARegSaveSize); - - BuildMI(MBB, MBBI, dl, TII.get(ARM::tBX_RET_vararg)).addReg(ARM::R3); - MBB.erase(MBBI); - } -} Removed: llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h?rev=74730&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ThumbRegisterInfo.h (removed) @@ -1,60 +0,0 @@ -//===- ThumbRegisterInfo.h - Thumb Register Information Impl ----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the ARM implementation of the TargetRegisterInfo class. -// -//===----------------------------------------------------------------------===// - -#ifndef THUMBREGISTERINFO_H -#define THUMBREGISTERINFO_H - -#include "ARM.h" -#include "ARMRegisterInfo.h" -#include "llvm/Target/TargetRegisterInfo.h" - -namespace llvm { - class ARMSubtarget; - class TargetInstrInfo; - class Type; - -struct ThumbRegisterInfo : public ARMBaseRegisterInfo { -public: - ThumbRegisterInfo(const TargetInstrInfo &tii, const ARMSubtarget &STI); - - /// emitLoadConstPool - Emits a load from constpool to materialize the - /// specified immediate. - void emitLoadConstPool(MachineBasicBlock &MBB, - MachineBasicBlock::iterator &MBBI, - unsigned DestReg, int Val, - const TargetInstrInfo *TII, - DebugLoc dl) const; - - /// Code Generation virtual methods... - const TargetRegisterClass * - getPhysicalRegisterRegClass(unsigned Reg, MVT VT = MVT::Other) const; - - bool isReservedReg(const MachineFunction &MF, unsigned Reg) const; - - bool requiresRegisterScavenging(const MachineFunction &MF) const; - - bool hasReservedCallFrame(MachineFunction &MF) const; - - void eliminateCallFramePseudoInstr(MachineFunction &MF, - MachineBasicBlock &MBB, - MachineBasicBlock::iterator I) const; - - void eliminateFrameIndex(MachineBasicBlock::iterator II, - int SPAdj, RegScavenger *RS = NULL) const; - - void emitPrologue(MachineFunction &MF) const; - void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; -}; -} - -#endif // THUMBREGISTERINFO_H From sabre at nondot.org Thu Jul 2 17:24:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 22:24:29 -0000 Subject: [llvm-commits] [llvm] r74732 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/Support/SourceMgr.cpp Message-ID: <200907022224.n62MOUfV026445@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 17:24:20 2009 New Revision: 74732 URL: http://llvm.org/viewvc/llvm-project?rev=74732&view=rev Log: add an explicit class for holding llvm::SourceMgr diagnostics and use it to print them. This gives us column numbers in the diag line. Before: t.s:4: error: unexpected token in argument list mov %eax %edx ^ now: t.s:4:11: error: unexpected token in argument list mov %eax %edx ^ Modified: llvm/trunk/include/llvm/Support/SourceMgr.h llvm/trunk/lib/Support/SourceMgr.cpp Modified: llvm/trunk/include/llvm/Support/SourceMgr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=74732&r1=74731&r2=74732&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/SourceMgr.h (original) +++ llvm/trunk/include/llvm/Support/SourceMgr.h Thu Jul 2 17:24:20 2009 @@ -7,9 +7,9 @@ // //===----------------------------------------------------------------------===// // -// This file declares the SourceMgr class. This class is used as a simple -// substrate for diagnostics, #include handling, and other low level things for -// simple parsers. +// This file declares the SMLoc, SMDiagnostic and SourceMgr classes. This +// provides a simple substrate for diagnostics, #include handling, and other low +// level things for simple parsers. // //===----------------------------------------------------------------------===// @@ -23,6 +23,8 @@ namespace llvm { class MemoryBuffer; class SourceMgr; + class SMDiagnostic; + class raw_ostream; class SMLoc { const char *Ptr; @@ -44,8 +46,8 @@ } }; -/// SourceMgr - This owns the files read by tblgen, handles include stacks, -/// and handles printing of diagnostics. +/// SourceMgr - This owns the files read by a parser, handles include stacks, +/// and handles diagnostic wrangling. class SourceMgr { struct SrcBuffer { /// Buffer - The memory buffer for the file. @@ -117,7 +119,35 @@ void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const; private: - void PrintIncludeStack(SMLoc IncludeLoc) const; + void PrintIncludeStack(SMLoc IncludeLoc, raw_ostream &OS) const; +}; + + +/// SMDiagnostic - Instances of this class encapsulate one diagnostic report, +/// allowing printing to a raw_ostream as a caret diagnostic. +class SMDiagnostic { + std::string Filename; + int LineNo, ColumnNo; + std::string Message, LineContents; +public: + SMDiagnostic() : LineNo(0), ColumnNo(0) {} + SMDiagnostic(const std::string &FN, int Line, int Col, + const std::string &Msg, const std::string &LineStr) + : Filename(FN), LineNo(Line), ColumnNo(Col), Message(Msg), + LineContents(LineStr) {} + SMDiagnostic(const SMDiagnostic &RHS) { + operator=(RHS); + } + + void operator=(const SMDiagnostic &E) { + Filename = E.Filename; + LineNo = E.LineNo; + ColumnNo = E.ColumnNo; + Message = E.Message; + LineContents = E.LineContents; + } + + void Print(const char *ProgName, raw_ostream &S); }; } // end llvm namespace Modified: llvm/trunk/lib/Support/SourceMgr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=74732&r1=74731&r2=74732&view=diff ============================================================================== --- llvm/trunk/lib/Support/SourceMgr.cpp (original) +++ llvm/trunk/lib/Support/SourceMgr.cpp Thu Jul 2 17:24:20 2009 @@ -76,17 +76,17 @@ return LineNo; } -void SourceMgr::PrintIncludeStack(SMLoc IncludeLoc) const { +void SourceMgr::PrintIncludeStack(SMLoc IncludeLoc, raw_ostream &OS) const { if (IncludeLoc == SMLoc()) return; // Top of stack. int CurBuf = FindBufferContainingLoc(IncludeLoc); assert(CurBuf != -1 && "Invalid or unspecified location!"); - PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc); + PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS); - errs() << "Included from " - << getBufferInfo(CurBuf).Buffer->getBufferIdentifier() - << ":" << FindLineNumber(IncludeLoc, CurBuf) << ":\n"; + OS << "Included from " + << getBufferInfo(CurBuf).Buffer->getBufferIdentifier() + << ":" << FindLineNumber(IncludeLoc, CurBuf) << ":\n"; } @@ -99,19 +99,11 @@ int CurBuf = FindBufferContainingLoc(Loc); assert(CurBuf != -1 && "Invalid or unspecified location!"); - PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc); + PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS); MemoryBuffer *CurMB = getBufferInfo(CurBuf).Buffer; - OS << CurMB->getBufferIdentifier() << ":" - << FindLineNumber(Loc, CurBuf) << ": "; - - if (Type) - OS << Type << ": "; - - OS << Msg << "\n"; - // Scan backward to find the start of the line. const char *LineStart = Loc.getPointer(); while (LineStart != CurMB->getBufferStart() && @@ -122,10 +114,51 @@ while (LineEnd != CurMB->getBufferEnd() && LineEnd[0] != '\n' && LineEnd[0] != '\r') ++LineEnd; + + std::string PrintedMsg; + if (Type) { + PrintedMsg = Type; + PrintedMsg += ": "; + } + PrintedMsg += Msg; + + // Print out the line. - OS << std::string(LineStart, LineEnd) << "\n"; - // Print out spaces before the caret. - for (const char *Pos = LineStart; Pos != Loc.getPointer(); ++Pos) - OS << (*Pos == '\t' ? '\t' : ' '); - OS << "^\n"; + SMDiagnostic(CurMB->getBufferIdentifier(), FindLineNumber(Loc, CurBuf), + Loc.getPointer()-LineStart, PrintedMsg, + std::string(LineStart, LineEnd)).Print(0, OS); + +} + +//===----------------------------------------------------------------------===// +// SMDiagnostic Implementation +//===----------------------------------------------------------------------===// + +void SMDiagnostic::Print(const char *ProgName, raw_ostream &S) { + if (ProgName && ProgName[0]) + S << ProgName << ": "; + + if (Filename == "-") + S << ""; + else + S << Filename; + + if (LineNo != -1) { + S << ':' << LineNo; + if (ColumnNo != -1) + S << ':' << (ColumnNo+1); + } + + S << ": " << Message << '\n'; + + if (LineNo != -1 && ColumnNo != -1) { + S << LineContents << '\n'; + + // Print out spaces/tabs before the caret. + for (unsigned i = 0; i != unsigned(ColumnNo); ++i) + S << (LineContents[i] == '\t' ? '\t' : ' '); + S << "^\n"; + } } + + From dpatel at apple.com Thu Jul 2 17:43:30 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 02 Jul 2009 22:43:30 -0000 Subject: [llvm-commits] [llvm] r74733 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h include/llvm/CodeGen/MachineFunction.h lib/Analysis/DebugInfo.cpp lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200907022243.n62MhV2S026961@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 2 17:43:26 2009 New Revision: 74733 URL: http://llvm.org/viewvc/llvm-project?rev=74733&view=rev Log: Simplify debug info intrisinc lowering. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=74733&r1=74732&r2=74733&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Thu Jul 2 17:43:26 2009 @@ -581,13 +581,11 @@ /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.stoppoint intrinsic. DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI, - CodeGenOpt::Level OptLev, DebugLocTracker &DebugLocInfo); /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.func_start intrinsic. DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, - CodeGenOpt::Level OptLev, DebugLocTracker &DebugLocInfo); /// isInlinedFnStart - Return true if FSI is starting an inlined function. Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=74733&r1=74732&r2=74733&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Thu Jul 2 17:43:26 2009 @@ -356,6 +356,9 @@ /// setDefaultDebugLoc - Get the default debug location for the machine /// function. void setDefaultDebugLoc(DebugLoc DL) { DefaultDebugLoc = DL; } + + /// getDebugLocInfo - Get the debug info location tracker. + DebugLocTracker &getDebugLocInfo() { return DebugLocInfo; } }; //===--------------------------------------------------------------------===// Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=74733&r1=74732&r2=74733&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Thu Jul 2 17:43:26 2009 @@ -1091,12 +1091,9 @@ /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.stoppoint intrinsic. DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI, - CodeGenOpt::Level OptLev, DebugLocTracker &DebugLocInfo) { DebugLoc DL; Value *Context = SPI.getContext(); - if (DIDescriptor::ValidDebugInfo(Context, OptLev) == false) - return DL; // If this location is already tracked then use it. DebugLocTuple Tuple(cast(Context), SPI.getLine(), @@ -1117,12 +1114,9 @@ /// ExtractDebugLocation - Extract debug location information /// from llvm.dbg.func_start intrinsic. DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, - CodeGenOpt::Level OptLev, DebugLocTracker &DebugLocInfo) { DebugLoc DL; Value *SP = FSI.getSubprogram(); - if (DIDescriptor::ValidDebugInfo(SP, OptLev) == false) - return DL; DISubprogram Subprogram(cast(SP)); unsigned Line = Subprogram.getLineNumber(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=74733&r1=74732&r2=74733&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Jul 2 17:43:26 2009 @@ -326,19 +326,14 @@ default: break; case Intrinsic::dbg_stoppoint: { DbgStopPointInst *SPI = cast(I); - if (DIDescriptor::ValidDebugInfo(SPI->getContext(), CodeGenOpt::None)) { - DICompileUnit CU(cast(SPI->getContext())); - unsigned Line = SPI->getLine(); - unsigned Col = SPI->getColumn(); - unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), Line, Col); - setCurDebugLoc(DebugLoc::get(Idx)); - } + if (isValidDebugInfoIntrinsic(*SPI, CodeGenOpt::None)) + setCurDebugLoc(ExtractDebugLocation(*SPI, MF.getDebugLocInfo())); return true; } case Intrinsic::dbg_region_start: { DbgRegionStartInst *RSI = cast(I); - if (DIDescriptor::ValidDebugInfo(RSI->getContext(), CodeGenOpt::None) && - DW && DW->ShouldEmitDwarfDebug()) { + if (isValidDebugInfoIntrinsic(*RSI, CodeGenOpt::None) && DW + && DW->ShouldEmitDwarfDebug()) { unsigned ID = DW->RecordRegionStart(cast(RSI->getContext())); const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); @@ -348,11 +343,11 @@ } case Intrinsic::dbg_region_end: { DbgRegionEndInst *REI = cast(I); - if (DIDescriptor::ValidDebugInfo(REI->getContext(), CodeGenOpt::None) && - DW && DW->ShouldEmitDwarfDebug()) { + if (isValidDebugInfoIntrinsic(*REI, CodeGenOpt::None) && DW + && DW->ShouldEmitDwarfDebug()) { unsigned ID = 0; DISubprogram Subprogram(cast(REI->getContext())); - if (!Subprogram.isNull() && !Subprogram.describes(MF.getFunction())) { + if (isInlinedFnEnd(*REI, MF.getFunction())) { // This is end of an inlined function. const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); ID = DW->RecordInlinedFnEnd(Subprogram); @@ -372,19 +367,13 @@ } case Intrinsic::dbg_func_start: { DbgFuncStartInst *FSI = cast(I); - Value *SP = FSI->getSubprogram(); - if (!DIDescriptor::ValidDebugInfo(SP, CodeGenOpt::None)) + if (!isValidDebugInfoIntrinsic(*FSI, CodeGenOpt::None) || !DW + || !DW->ShouldEmitDwarfDebug()) return true; - DISubprogram Subprogram(cast(SP)); - DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - unsigned Line = Subprogram.getLineNumber(); - - // If this subprogram does not describe current function then this is - // beginning of a inlined function. - if (!Subprogram.describes(MF.getFunction())) { + if (isInlinedFnStart(*FSI, MF.getFunction())) { // This is a beginning of an inlined function. - + // If llvm.dbg.func.start is seen in a new block before any // llvm.dbg.stoppoint intrinsic then the location info is unknown. // FIXME : Why DebugLoc is reset at the beginning of each block ? @@ -392,59 +381,53 @@ if (PrevLoc.isUnknown()) return true; // Record the source line. - unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0); - setCurDebugLoc(DebugLoc::get(LocID)); - - if (DW && DW->ShouldEmitDwarfDebug()) { - DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); - unsigned LabelID = DW->RecordInlinedFnStart(Subprogram, - DICompileUnit(PrevLocTpl.CompileUnit), - PrevLocTpl.Line, - PrevLocTpl.Col); - const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); - BuildMI(MBB, DL, II).addImm(LabelID); - } + setCurDebugLoc(ExtractDebugLocation(*FSI, MF.getDebugLocInfo())); + + DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); + DISubprogram SP(cast(FSI->getSubprogram())); + unsigned LabelID = DW->RecordInlinedFnStart(SP, + DICompileUnit(PrevLocTpl.CompileUnit), + PrevLocTpl.Line, + PrevLocTpl.Col); + const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); + BuildMI(MBB, DL, II).addImm(LabelID); return true; } - + // This is a beginning of a new function. - // Record the source line. - unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0); - MF.setDefaultDebugLoc(DebugLoc::get(LocID)); - - if (DW && DW->ShouldEmitDwarfDebug()) - // llvm.dbg.func_start also defines beginning of function scope. - DW->RecordRegionStart(cast(FSI->getSubprogram())); + MF.setDefaultDebugLoc(ExtractDebugLocation(*FSI, MF.getDebugLocInfo())); + // llvm.dbg.func_start also defines beginning of function scope. + DW->RecordRegionStart(cast(FSI->getSubprogram())); return true; } case Intrinsic::dbg_declare: { DbgDeclareInst *DI = cast(I); + if (!isValidDebugInfoIntrinsic(*DI, CodeGenOpt::None) || !DW + || !DW->ShouldEmitDwarfDebug()) + return true; + Value *Variable = DI->getVariable(); - if (DIDescriptor::ValidDebugInfo(Variable, CodeGenOpt::None) && - DW && DW->ShouldEmitDwarfDebug()) { - // Determine the address of the declared object. - Value *Address = DI->getAddress(); - if (BitCastInst *BCI = dyn_cast(Address)) - Address = BCI->getOperand(0); - AllocaInst *AI = dyn_cast(Address); - // Don't handle byval struct arguments or VLAs, for example. - if (!AI) break; - DenseMap::iterator SI = - StaticAllocaMap.find(AI); - if (SI == StaticAllocaMap.end()) break; // VLAs. - int FI = SI->second; - - // Determine the debug globalvariable. - GlobalValue *GV = cast(Variable); - - // Build the DECLARE instruction. - const TargetInstrDesc &II = TII.get(TargetInstrInfo::DECLARE); - MachineInstr *DeclareMI - = BuildMI(MBB, DL, II).addFrameIndex(FI).addGlobalAddress(GV); - DIVariable DV(cast(GV)); - DW->RecordVariableScope(DV, DeclareMI); - } + Value *Address = DI->getAddress(); + if (BitCastInst *BCI = dyn_cast(Address)) + Address = BCI->getOperand(0); + AllocaInst *AI = dyn_cast(Address); + // Don't handle byval struct arguments or VLAs, for example. + if (!AI) break; + DenseMap::iterator SI = + StaticAllocaMap.find(AI); + if (SI == StaticAllocaMap.end()) break; // VLAs. + int FI = SI->second; + + // Determine the debug globalvariable. + GlobalValue *GV = cast(Variable); + + // Build the DECLARE instruction. + const TargetInstrDesc &II = TII.get(TargetInstrInfo::DECLARE); + MachineInstr *DeclareMI + = BuildMI(MBB, DL, II).addFrameIndex(FI).addGlobalAddress(GV); + DIVariable DV(cast(GV)); + DW->RecordVariableScope(DV, DeclareMI); return true; } case Intrinsic::eh_exception: { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=74733&r1=74732&r2=74733&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Thu Jul 2 17:43:26 2009 @@ -332,30 +332,14 @@ default: break; case Intrinsic::dbg_stoppoint: { DbgStopPointInst *SPI = cast(I); - - if (DIDescriptor::ValidDebugInfo(SPI->getContext(), - CodeGenOpt::Default)) { - DICompileUnit CU(cast(SPI->getContext())); - unsigned idx = MF->getOrCreateDebugLocID(CU.getGV(), - SPI->getLine(), - SPI->getColumn()); - DL = DebugLoc::get(idx); - } - + if (isValidDebugInfoIntrinsic(*SPI, CodeGenOpt::Default)) + DL = ExtractDebugLocation(*SPI, MF->getDebugLocInfo()); break; } case Intrinsic::dbg_func_start: { DbgFuncStartInst *FSI = cast(I); - Value *SP = FSI->getSubprogram(); - - if (DIDescriptor::ValidDebugInfo(SP, CodeGenOpt::Default)) { - DISubprogram Subprogram(cast(SP)); - DICompileUnit CU(Subprogram.getCompileUnit()); - unsigned Line = Subprogram.getLineNumber(); - DL = DebugLoc::get(MF->getOrCreateDebugLocID(CU.getGV(), - Line, 0)); - } - + if (isValidDebugInfoIntrinsic(*FSI, CodeGenOpt::Default)) + DL = ExtractDebugLocation(*FSI, MF->getDebugLocInfo()); break; } } @@ -3887,13 +3871,11 @@ } case Intrinsic::dbg_stoppoint: { DbgStopPointInst &SPI = cast(I); - if (DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLevel)) { + if (isValidDebugInfoIntrinsic(SPI, CodeGenOpt::Default)) { MachineFunction &MF = DAG.getMachineFunction(); - DICompileUnit CU(cast(SPI.getContext())); - DebugLoc Loc = DebugLoc::get(MF.getOrCreateDebugLocID(CU.getGV(), - SPI.getLine(), SPI.getColumn())); + DebugLoc Loc = ExtractDebugLocation(SPI, MF.getDebugLocInfo()); setCurDebugLoc(Loc); - + if (OptLevel == CodeGenOpt::None) DAG.setRoot(DAG.getDbgStopPoint(Loc, getRoot(), SPI.getLine(), @@ -3905,115 +3887,103 @@ case Intrinsic::dbg_region_start: { DwarfWriter *DW = DAG.getDwarfWriter(); DbgRegionStartInst &RSI = cast(I); - - if (DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLevel) && - DW && DW->ShouldEmitDwarfDebug()) { + if (isValidDebugInfoIntrinsic(RSI, OptLevel) && DW + && DW->ShouldEmitDwarfDebug()) { unsigned LabelID = DW->RecordRegionStart(cast(RSI.getContext())); DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); } - return 0; } case Intrinsic::dbg_region_end: { DwarfWriter *DW = DAG.getDwarfWriter(); DbgRegionEndInst &REI = cast(I); - if (DIDescriptor::ValidDebugInfo(REI.getContext(), OptLevel) && - DW && DW->ShouldEmitDwarfDebug()) { - MachineFunction &MF = DAG.getMachineFunction(); - DISubprogram Subprogram(cast(REI.getContext())); + if (!isValidDebugInfoIntrinsic(REI, OptLevel) || !DW + || !DW->ShouldEmitDwarfDebug()) + return 0; - if (Subprogram.isNull() || Subprogram.describes(MF.getFunction())) { - unsigned LabelID = - DW->RecordRegionEnd(cast(REI.getContext())); - DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), - getRoot(), LabelID)); - } else { - // This is end of inlined function. Debugging information for inlined - // function is not handled yet (only supported by FastISel). - if (OptLevel == CodeGenOpt::None) { - unsigned ID = DW->RecordInlinedFnEnd(Subprogram); - if (ID != 0) - // Returned ID is 0 if this is unbalanced "end of inlined - // scope". This could happen if optimizer eats dbg intrinsics or - // "beginning of inlined scope" is not recoginized due to missing - // location info. In such cases, do ignore this region.end. - DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), - getRoot(), ID)); - } + MachineFunction &MF = DAG.getMachineFunction(); + DISubprogram Subprogram(cast(REI.getContext())); + + if (isInlinedFnEnd(REI, MF.getFunction())) { + // This is end of inlined function. Debugging information for inlined + // function is not handled yet (only supported by FastISel). + if (OptLevel == CodeGenOpt::None) { + unsigned ID = DW->RecordInlinedFnEnd(Subprogram); + if (ID != 0) + // Returned ID is 0 if this is unbalanced "end of inlined + // scope". This could happen if optimizer eats dbg intrinsics or + // "beginning of inlined scope" is not recoginized due to missing + // location info. In such cases, do ignore this region.end. + DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), + getRoot(), ID)); } - } + return 0; + } + unsigned LabelID = + DW->RecordRegionEnd(cast(REI.getContext())); + DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), + getRoot(), LabelID)); return 0; } case Intrinsic::dbg_func_start: { DwarfWriter *DW = DAG.getDwarfWriter(); DbgFuncStartInst &FSI = cast(I); - Value *SP = FSI.getSubprogram(); - if (!DIDescriptor::ValidDebugInfo(SP, OptLevel)) + if (!isValidDebugInfoIntrinsic(FSI, CodeGenOpt::None) || !DW + || !DW->ShouldEmitDwarfDebug()) return 0; - DISubprogram Subprogram(cast(SP)); - DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - unsigned Line = Subprogram.getLineNumber(); - MachineFunction &MF = DAG.getMachineFunction(); - // If this subprogram does not describe current function then this is - // beginning of a inlined function. - bool isInlinedFnStart = !Subprogram.describes(MF.getFunction()); - if (isInlinedFnStart && OptLevel != CodeGenOpt::None) - // FIXME: Debugging informaation for inlined function is only - // supported at CodeGenOpt::Node. - return 0; - - if (isInlinedFnStart && OptLevel == CodeGenOpt::None) { - // This is a beginning of an inlined function. + // This is a beginning of an inlined function. + if (isInlinedFnStart(FSI, MF.getFunction())) { + if (OptLevel != CodeGenOpt::None) + // FIXME: Debugging informaation for inlined function is only + // supported at CodeGenOpt::Node. + return 0; + DebugLoc PrevLoc = CurDebugLoc; // If llvm.dbg.func.start is seen in a new block before any // llvm.dbg.stoppoint intrinsic then the location info is unknown. // FIXME : Why DebugLoc is reset at the beginning of each block ? if (PrevLoc.isUnknown()) return 0; - + // Record the source line. - unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0); - setCurDebugLoc(DebugLoc::get(LocID)); + setCurDebugLoc(ExtractDebugLocation(FSI, MF.getDebugLocInfo())); - if (DW && DW->ShouldEmitDwarfDebug()) { - DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); - unsigned LabelID = DW->RecordInlinedFnStart(Subprogram, - DICompileUnit(PrevLocTpl.CompileUnit), - PrevLocTpl.Line, - PrevLocTpl.Col); - DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), - getRoot(), LabelID)); - } + DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); + DISubprogram SP(cast(FSI.getSubprogram())); + DICompileUnit CU(PrevLocTpl.CompileUnit); + unsigned LabelID = DW->RecordInlinedFnStart(SP, CU, + PrevLocTpl.Line, + PrevLocTpl.Col); + DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), + getRoot(), LabelID)); return 0; } // This is a beginning of a new function. - // Record the source line. - unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0); - MF.setDefaultDebugLoc(DebugLoc::get(LocID)); + MF.setDefaultDebugLoc(ExtractDebugLocation(FSI, MF.getDebugLocInfo())); - if (DW && DW->ShouldEmitDwarfDebug()) - // llvm.dbg.func_start also defines beginning of function scope. - DW->RecordRegionStart(cast(FSI.getSubprogram())); - + // llvm.dbg.func_start also defines beginning of function scope. + DW->RecordRegionStart(cast(FSI.getSubprogram())); return 0; } case Intrinsic::dbg_declare: { - if (OptLevel == CodeGenOpt::None) { - DbgDeclareInst &DI = cast(I); - Value *Variable = DI.getVariable(); - if (DIDescriptor::ValidDebugInfo(Variable, OptLevel)) - DAG.setRoot(DAG.getNode(ISD::DECLARE, dl, MVT::Other, getRoot(), - getValue(DI.getAddress()), getValue(Variable))); - } else { - // FIXME: Do something sensible here when we support debug declare. - } + if (OptLevel != CodeGenOpt::None) + // FIXME: Variable debug info is not supported here. + return 0; + + DbgDeclareInst &DI = cast(I); + if (!isValidDebugInfoIntrinsic(DI, CodeGenOpt::None)) + return 0; + + Value *Variable = DI.getVariable(); + DAG.setRoot(DAG.getNode(ISD::DECLARE, dl, MVT::Other, getRoot(), + getValue(DI.getAddress()), getValue(Variable))); return 0; } case Intrinsic::eh_exception: { From sabre at nondot.org Thu Jul 2 17:46:19 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 22:46:19 -0000 Subject: [llvm-commits] [llvm] r74734 - in /llvm/trunk: include/llvm/Assembly/Parser.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLLexer.h lib/AsmParser/LLParser.h lib/AsmParser/Parser.cpp tools/bugpoint/BugDriver.cpp tools/llvm-as/llvm-as.cpp Message-ID: <200907022246.n62MkJB4027058@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 17:46:18 2009 New Revision: 74734 URL: http://llvm.org/viewvc/llvm-project?rev=74734&view=rev Log: switch the .ll parser into SMDiagnostic. Modified: llvm/trunk/include/llvm/Assembly/Parser.h llvm/trunk/lib/AsmParser/LLLexer.cpp llvm/trunk/lib/AsmParser/LLLexer.h llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/AsmParser/Parser.cpp llvm/trunk/tools/bugpoint/BugDriver.cpp llvm/trunk/tools/llvm-as/llvm-as.cpp Modified: llvm/trunk/include/llvm/Assembly/Parser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Parser.h?rev=74734&r1=74733&r2=74734&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Parser.h (original) +++ llvm/trunk/include/llvm/Assembly/Parser.h Thu Jul 2 17:46:18 2009 @@ -19,7 +19,7 @@ namespace llvm { class Module; -class ParseError; +class SMDiagnostic; class raw_ostream; class LLVMContext; @@ -31,8 +31,8 @@ /// @brief Parse LLVM Assembly from a file Module *ParseAssemblyFile( const std::string &Filename, ///< The name of the file to parse - ParseError &Error, ///< If not null, an object to return errors in. - LLVMContext& Context ///< Context in which to allocate globals info. + SMDiagnostic &Error, ///< Error result info. + LLVMContext &Context ///< Context in which to allocate globals info. ); /// The function is a secondary interface to the LLVM Assembly Parser. It parses @@ -44,61 +44,10 @@ Module *ParseAssemblyString( const char *AsmString, ///< The string containing assembly Module *M, ///< A module to add the assembly too. - ParseError &Error, ///< If not null, an object to return errors in. - LLVMContext& Context + SMDiagnostic &Error, ///< Error result info. + LLVMContext &Context ); -//===------------------------------------------------------------------------=== -// Helper Classes -//===------------------------------------------------------------------------=== - -/// An instance of this class can be passed to ParseAssemblyFile or -/// ParseAssemblyString functions in order to capture error information from -/// the parser. It provides a standard way to print out the error message -/// including the file name and line number where the error occurred. -/// @brief An LLVM Assembly Parsing Error Object -class ParseError { -public: - ParseError() : Filename("unknown"), Message("none"), LineNo(0), ColumnNo(0) {} - ParseError(const ParseError &E); - - void setFilename(const std::string &F) { Filename = F; } - - inline const std::string &getRawMessage() const { // Just the raw message. - return Message; - } - - inline const std::string &getFilename() const { - return Filename; - } - - void setError(const std::string &message, int lineNo = -1, int ColNo = -1, - const std::string &FileContents = "") { - Message = message; - LineNo = lineNo; ColumnNo = ColNo; - LineContents = FileContents; - } - - // getErrorLocation - Return the line and column number of the error in the - // input source file. The source filename can be derived from the - // ParserOptions in effect. If positional information is not applicable, - // these will return a value of -1. - // - inline void getErrorLocation(int &Line, int &Column) const { - Line = LineNo; Column = ColumnNo; - } - - void PrintError(const char *ProgName, raw_ostream &S); - -private : - std::string Filename; - std::string Message; - int LineNo, ColumnNo; // -1 if not relevant - std::string LineContents; - - void operator=(const ParseError &E); // DO NOT IMPLEMENT -}; - } // End llvm namespace #endif Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=74734&r1=74733&r2=74734&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Thu Jul 2 17:46:18 2009 @@ -16,6 +16,7 @@ #include "llvm/Instruction.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Assembly/Parser.h" #include @@ -38,8 +39,9 @@ for (const char *FP = CurBuf->getBufferStart(); FP != ErrorLoc; ++FP) if (*FP == '\n') ++LineNo; - std::string LineContents(LineStart, LineEnd); - ErrorInfo.setError(Msg, LineNo, ErrorLoc-LineStart, LineContents); + ErrorInfo = SMDiagnostic(CurBuf->getBufferIdentifier(), + LineNo, ErrorLoc-LineStart, Msg, + std::string(LineStart, LineEnd)); return true; } @@ -195,7 +197,7 @@ // Lexer definition. //===----------------------------------------------------------------------===// -LLLexer::LLLexer(MemoryBuffer *StartBuf, ParseError &Err) +LLLexer::LLLexer(MemoryBuffer *StartBuf, SMDiagnostic &Err) : CurBuf(StartBuf), ErrorInfo(Err), APFloatVal(0.0) { CurPtr = CurBuf->getBufferStart(); } Modified: llvm/trunk/lib/AsmParser/LLLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.h?rev=74734&r1=74733&r2=74734&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.h (original) +++ llvm/trunk/lib/AsmParser/LLLexer.h Thu Jul 2 17:46:18 2009 @@ -22,12 +22,12 @@ namespace llvm { class MemoryBuffer; class Type; - class ParseError; + class SMDiagnostic; class LLLexer { const char *CurPtr; MemoryBuffer *CurBuf; - ParseError &ErrorInfo; + SMDiagnostic &ErrorInfo; // Information about the current token. const char *TokStart; @@ -40,7 +40,7 @@ std::string TheError; public: - explicit LLLexer(MemoryBuffer *StartBuf, ParseError &); + explicit LLLexer(MemoryBuffer *StartBuf, SMDiagnostic &); ~LLLexer() {} lltok::Kind Lex() { Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=74734&r1=74733&r2=74734&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Thu Jul 2 17:46:18 2009 @@ -73,7 +73,7 @@ std::map > ForwardRefValIDs; std::vector NumberedVals; public: - LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : + LLParser(MemoryBuffer *F, SMDiagnostic &Err, Module *m) : Context(m->getContext()), Lex(F, Err), M(m) {} bool Run(); Modified: llvm/trunk/lib/AsmParser/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Parser.cpp?rev=74734&r1=74733&r2=74734&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Parser.cpp (original) +++ llvm/trunk/lib/AsmParser/Parser.cpp Thu Jul 2 17:46:18 2009 @@ -15,20 +15,20 @@ #include "LLParser.h" #include "llvm/Module.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/Support/SourceMgr.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include using namespace llvm; -Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err, - LLVMContext& Context) { - Err.setFilename(Filename); - +Module *llvm::ParseAssemblyFile(const std::string &Filename, SMDiagnostic &Err, + LLVMContext &Context) { std::string ErrorStr; OwningPtr F(MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrorStr)); if (F == 0) { - Err.setError("Could not open input file '" + Filename + "'"); + Err = SMDiagnostic("", -1, -1, + "Could not open input file '" + Filename + "'", ""); return 0; } @@ -39,9 +39,7 @@ } Module *llvm::ParseAssemblyString(const char *AsmString, Module *M, - ParseError &Err, LLVMContext& Context) { - Err.setFilename(""); - + SMDiagnostic &Err, LLVMContext &Context) { OwningPtr F(MemoryBuffer::getMemBuffer(AsmString, AsmString+strlen(AsmString), "")); @@ -56,33 +54,3 @@ return 0; return M2.take(); } - - -//===------------------------------------------------------------------------=== -// ParseError Class -//===------------------------------------------------------------------------=== - -void ParseError::PrintError(const char *ProgName, raw_ostream &S) { - errs() << ProgName << ": "; - if (Filename == "-") - errs() << ""; - else - errs() << Filename; - - if (LineNo != -1) { - errs() << ':' << LineNo; - if (ColumnNo != -1) - errs() << ':' << (ColumnNo+1); - } - - errs() << ": " << Message << '\n'; - - if (LineNo != -1 && ColumnNo != -1) { - errs() << LineContents << '\n'; - - // Print out spaces/tabs before the caret. - for (unsigned i = 0; i != unsigned(ColumnNo); ++i) - errs() << (LineContents[i] == '\t' ? '\t' : ' '); - errs() << "^\n"; - } -} Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=74734&r1=74733&r2=74734&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/BugDriver.cpp (original) +++ llvm/trunk/tools/bugpoint/BugDriver.cpp Thu Jul 2 17:46:18 2009 @@ -23,6 +23,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -82,9 +83,9 @@ if (Buffer.get()) Result = ParseBitcodeFile(Buffer.get(), Ctxt); - ParseError Err; + SMDiagnostic Err; if (!Result && !(Result = ParseAssemblyFile(Filename, Err, Ctxt))) { - Err.PrintError("bugpoint", errs()); + Err.Print("bugpoint", errs()); Result = 0; } Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=74734&r1=74733&r2=74734&view=diff ============================================================================== --- llvm/trunk/tools/llvm-as/llvm-as.cpp (original) +++ llvm/trunk/tools/llvm-as/llvm-as.cpp Thu Jul 2 17:46:18 2009 @@ -23,6 +23,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" +#include "llvm/Support/SourceMgr.h" #include "llvm/Support/Streams.h" #include "llvm/Support/SystemUtils.h" #include "llvm/Support/raw_ostream.h" @@ -64,10 +65,10 @@ std::ostream *Out = 0; try { // Parse the file now... - ParseError Err; + SMDiagnostic Err; std::auto_ptr M(ParseAssemblyFile(InputFilename, Err, Context)); if (M.get() == 0) { - Err.PrintError(argv[0], errs()); + Err.Print(argv[0], errs()); return 1; } From sabre at nondot.org Thu Jul 2 18:08:14 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 02 Jul 2009 23:08:14 -0000 Subject: [llvm-commits] [llvm] r74735 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLLexer.h lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/AsmParser/Parser.cpp lib/Support/SourceMgr.cpp Message-ID: <200907022308.n62N8Egm027780@zion.cs.uiuc.edu> Author: lattner Date: Thu Jul 2 18:08:13 2009 New Revision: 74735 URL: http://llvm.org/viewvc/llvm-project?rev=74735&view=rev Log: switch the .ll parser to use SourceMgr. Modified: llvm/trunk/include/llvm/Support/SourceMgr.h llvm/trunk/lib/AsmParser/LLLexer.cpp llvm/trunk/lib/AsmParser/LLLexer.h llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/AsmParser/Parser.cpp llvm/trunk/lib/Support/SourceMgr.cpp Modified: llvm/trunk/include/llvm/Support/SourceMgr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=74735&r1=74734&r2=74735&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/SourceMgr.h (original) +++ llvm/trunk/include/llvm/Support/SourceMgr.h Thu Jul 2 18:08:13 2009 @@ -118,6 +118,16 @@ /// prefixed to the message. void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const; + + /// GetMessage - Return an SMDiagnostic at the specified location with the + /// specified string. + /// + /// @param Type - If non-null, the kind of message (e.g., "error") which is + /// prefixed to the message. + SMDiagnostic GetMessage(SMLoc Loc, + const std::string &Msg, const char *Type) const; + + private: void PrintIncludeStack(SMLoc IncludeLoc, raw_ostream &OS) const; }; Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=74735&r1=74734&r2=74735&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Thu Jul 2 18:08:13 2009 @@ -24,24 +24,7 @@ using namespace llvm; bool LLLexer::Error(LocTy ErrorLoc, const std::string &Msg) const { - // Scan backward to find the start of the line. - const char *LineStart = ErrorLoc; - while (