Changes in directory llvm/lib/Target/Alpha:
AlphaAsmPrinter.cpp updated: 1.27 -> 1.28 AlphaISelDAGToDAG.cpp updated: 1.22 -> 1.23 AlphaISelPattern.cpp updated: 1.197 -> 1.198 AlphaInstrFormats.td updated: 1.20 -> 1.21 AlphaInstrInfo.td updated: 1.89 -> 1.90 --- Log message: add br pattern, unify JSR and BSR ISel instrs, and add BSR support for DAG --- Diffs of the changes: (+38 -32) AlphaAsmPrinter.cpp | 6 +++--- AlphaISelDAGToDAG.cpp | 23 ++++++++++++++--------- AlphaISelPattern.cpp | 15 ++++++++------- AlphaInstrFormats.td | 9 ++++++--- AlphaInstrInfo.td | 17 +++++++---------- 5 files changed, 38 insertions(+), 32 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.27 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.28 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.27 Wed Nov 30 12:54:34 2005 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Sun Dec 25 11:36:48 2005 @@ -136,9 +136,9 @@ case MachineOperand::MO_GlobalAddress: //Abuse PCrel to specify pcrel calls //calls are the only thing that use this flag - if (MO.isPCRelative()) - O << PrivateGlobalPrefix << Mang->getValueName(MO.getGlobal()) << "..ng"; - else +// if (MO.isPCRelative()) +// O << PrivateGlobalPrefix << Mang->getValueName(MO.getGlobal()) << "..ng"; +// else O << Mang->getValueName(MO.getGlobal()); return; Index: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp diff -u llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.22 llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.23 --- llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.22 Sat Dec 24 19:34:27 2005 +++ llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Sun Dec 25 11:36:48 2005 @@ -194,9 +194,6 @@ CurDAG->getBasicBlock(Dest), Chain); } - case ISD::BR: - return CurDAG->SelectNodeTo(N, Alpha::BR_DAG, MVT::Other, N->getOperand(1), - Select(N->getOperand(0))); case ISD::FrameIndex: { int FI = cast<FrameIndexSDNode>(N)->getIndex(); return CurDAG->SelectNodeTo(N, Alpha::LDA, MVT::i64, @@ -214,7 +211,7 @@ Chain.getValue(1)); Chain = CurDAG->getCopyToReg(Chain, Alpha::R27, Select(Op.getOperand(0)), Chain.getValue(1)); - Chain = CurDAG->getTargetNode(Alpha::JSRsDAG, MVT::Other, MVT::Flag, + Chain = CurDAG->getTargetNode(Alpha::JSRs, MVT::Other, MVT::Flag, Chain, Chain.getValue(1)); Chain = CurDAG->getCopyFromReg(Chain, Alpha::R27, MVT::i64, Chain.getValue(1)); @@ -359,7 +356,7 @@ SDNode *N = Op.Val; SDOperand Chain = Select(N->getOperand(0)); - SDOperand Addr = Select(N->getOperand(1)); + SDOperand Addr = N->getOperand(1); SDOperand InFlag; // Null incoming flag value. std::vector<SDOperand> CallOperands; @@ -404,12 +401,20 @@ } - Chain = CurDAG->getCopyToReg(Chain, Alpha::R27, Addr, InFlag); - InFlag = Chain.getValue(1); // Finally, once everything is in registers to pass to the call, emit the // call itself. - Chain = CurDAG->getTargetNode(Alpha::JSRDAG, MVT::Other, MVT::Flag, - Chain, InFlag ); + if (Addr.getOpcode() == AlphaISD::GPRelLo) { + SDOperand GOT = getGlobalBaseReg(); + Chain = CurDAG->getCopyToReg(Chain, Alpha::R29, GOT, InFlag); + InFlag = Chain.getValue(1); + Chain = CurDAG->getTargetNode(Alpha::BSR, MVT::Other, MVT::Flag, + Addr.getOperand(0), Chain, InFlag); + } else { + Chain = CurDAG->getCopyToReg(Chain, Alpha::R27, Select(Addr), InFlag); + InFlag = Chain.getValue(1); + Chain = CurDAG->getTargetNode(Alpha::JSR, MVT::Other, MVT::Flag, + Chain, InFlag ); + } InFlag = Chain.getValue(1); std::vector<SDOperand> CallResults; Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.197 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.198 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.197 Sat Dec 24 19:34:27 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sun Dec 25 11:36:48 2005 @@ -824,17 +824,18 @@ } } //build the right kind of call - GlobalAddressSDNode *GASD = dyn_cast<GlobalAddressSDNode>(N.getOperand(1)); - if (GASD && !GASD->getGlobal()->isExternal()) { + if (N.getOperand(1).getOpcode() == AlphaISD::GPRelLo) { //use PC relative branch call AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::BSR, 1, Alpha::R26) - .addGlobalAddress(GASD->getGlobal(),true); + BuildMI(BB, Alpha::BSR, 1) + .addGlobalAddress(cast<GlobalAddressSDNode>(N.getOperand(1) + .getOperand(0)) + ->getGlobal(),true); } else { //no need to restore GP as we are doing an indirect call Tmp1 = SelectExpr(N.getOperand(1)); BuildMI(BB, Alpha::BIS, 2, Alpha::R27).addReg(Tmp1).addReg(Tmp1); - BuildMI(BB, Alpha::JSR, 2, Alpha::R26).addReg(Alpha::R27).addImm(0); + BuildMI(BB, Alpha::JSR, 0); } //push the result into a virtual register @@ -1237,7 +1238,7 @@ BuildMI(BB, Alpha::BIS, 2, Alpha::R24).addReg(Tmp2).addReg(Tmp2); BuildMI(BB, Alpha::BIS, 2, Alpha::R25).addReg(Tmp3).addReg(Tmp3); BuildMI(BB, Alpha::BIS, 2, Alpha::R27).addReg(Tmp1).addReg(Tmp1); - BuildMI(BB, Alpha::JSRs, 2, Alpha::R23).addReg(Alpha::R27).addImm(0); + BuildMI(BB, Alpha::JSRs, 0); BuildMI(BB, Alpha::BIS, 2, Result).addReg(Alpha::R27).addReg(Alpha::R27); return Result; @@ -1551,7 +1552,7 @@ cast<BasicBlockSDNode>(N.getOperand(1))->getBasicBlock(); Select(N.getOperand(0)); - BuildMI(BB, Alpha::BR, 1, Alpha::R31).addMBB(Dest); + BuildMI(BB, Alpha::BR, 1).addMBB(Dest); return; } Index: llvm/lib/Target/Alpha/AlphaInstrFormats.td diff -u llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.20 llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.21 --- llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.20 Sat Dec 24 01:34:33 2005 +++ llvm/lib/Target/Alpha/AlphaInstrFormats.td Sun Dec 25 11:36:48 2005 @@ -95,10 +95,13 @@ let Inst{25-21} = Ra; let Inst{20-0} = disp; } +def target : Operand<OtherVT> {} let isBranch = 1, isTerminator = 1 in -class BFormD<bits<6> opcode, string asmstr> - : InstAlpha<opcode, (ops s21imm:$DISP), asmstr> { - bits<5> Ra = 31; +class BFormD<bits<6> opcode, string asmstr, list<dag> pattern> + : InstAlpha<opcode, (ops target:$DISP), asmstr> { + let Pattern = pattern; + + bits<5> Ra; bits<21> disp; let Inst{25-21} = Ra; Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.89 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.90 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.89 Sat Dec 24 19:34:27 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Sun Dec 25 11:36:48 2005 @@ -411,14 +411,13 @@ def RETDAG : MbrForm< 0x1A, 0x02, (ops), "ret $$31,($$26),1">; //Return from subroutine def JMP : MbrForm< 0x1A, 0x00, (ops GPRC:$RD, GPRC:$RS, GPRC:$DISP), "jmp $RD,($RS),$DISP">; //Jump -let isCall = 1, +let isCall = 1, Ra = 26, Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, - R20, R21, R22, R23, R24, R25, R27, R28, R29, + R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, F0, F1, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30], Uses = [R29] in { - def JSR : MbrForm< 0x1A, 0x01, (ops GPRC:$RD, GPRC:$RS, s14imm:$DISP), "jsr $RD,($RS),$DISP">; //Jump to subroutine - def BSR : BForm<0x34, "bsr $RA,$DISP">; //Branch to subroutine + def BSR : BFormD<0x34, "bsr $$26,$$$DISP..ng", []>; //Branch to subroutine } let isCall = 1, Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, @@ -426,19 +425,17 @@ F0, F1, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30], Uses = [R27, R29] in { - def JSRDAG : MbrForm< 0x1A, 0x01, (ops ), "jsr $$26,($$27),0">; //Jump to subroutine + def JSR : MbrForm< 0x1A, 0x01, (ops ), "jsr $$26,($$27),0">; //Jump to subroutine } -let isCall = 1, Defs = [R24, R25, R27, R28], Uses = [R24, R25] in - def JSRs : MbrForm< 0x1A, 0x01, (ops GPRC:$RD, GPRC:$RS, s14imm:$DISP), "jsr $RD,($RS),$DISP">; //Jump to div or rem let isCall = 1, Defs = [R23, R24, R25, R27, R28], Uses = [R24, R25, R27] in - def JSRsDAG : MbrForm< 0x1A, 0x01, (ops ), "jsr $$23,($$27),0">; //Jump to div or rem + def JSRs : MbrForm< 0x1A, 0x01, (ops ), "jsr $$23,($$27),0">; //Jump to div or rem def JSR_COROUTINE : MbrForm< 0x1A, 0x03, (ops GPRC:$RD, GPRC:$RS, s14imm:$DISP), "jsr_coroutine $RD,($RS),$DISP">; //Jump to subroutine return -def BR : BForm<0x30, "br $RA,$DISP">; //Branch -def BR_DAG : BFormD<0x30, "br $$31,$DISP">; //Branch +let Ra = 31 in +def BR : BFormD<0x30, "br $$31,$DISP", [(br bb:$DISP)]>; let OperandList = (ops GPRC:$RA, s64imm:$DISP, GPRC:$RB) in { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits