// target-specific node if it hasn't already been changed.
SDOperand Select(SDOperand Op);
- SDNode *SelectIntImmediateExpr(SDOperand LHS, SDOperand RHS,
- unsigned OCHi, unsigned OCLo,
- bool IsArithmetic = false,
- bool Negate = false);
SDNode *SelectBitfieldInsert(SDNode *N);
/// SelectCC - Select a comparison of the specified values with the
return 0;
}
-// SelectIntImmediateExpr - Choose code for integer operations with an immediate
-// operand.
-SDNode *PPC32DAGToDAGISel::SelectIntImmediateExpr(SDOperand LHS, SDOperand RHS,
- unsigned OCHi, unsigned OCLo,
- bool IsArithmetic,
- bool Negate) {
- // Check to make sure this is a constant.
- ConstantSDNode *CN = dyn_cast<ConstantSDNode>(RHS);
- // Exit if not a constant.
- if (!CN) return 0;
- // Extract immediate.
- unsigned C = (unsigned)CN->getValue();
- // Negate if required (ISD::SUB).
- if (Negate) C = -C;
- // Get the hi and lo portions of constant.
- unsigned Hi = IsArithmetic ? HA16(C) : Hi16(C);
- unsigned Lo = Lo16(C);
-
- // If two instructions are needed and usage indicates it would be better to
- // load immediate into a register, bail out.
- if (Hi && Lo && CN->use_size() > 2) return false;
-
- // Select the first operand.
- SDOperand Opr0 = Select(LHS);
-
- if (Lo) // Add in the lo-part.
- Opr0 = CurDAG->getTargetNode(OCLo, MVT::i32, Opr0, getI32Imm(Lo));
- if (Hi) // Add in the hi-part.
- Opr0 = CurDAG->getTargetNode(OCHi, MVT::i32, Opr0, getI32Imm(Hi));
- return Opr0.Val;
-}
-
/// SelectAddr - Given the specified address, return the two operands for a
/// load/store instruction, and return true if it should be an indexed [r+r]
/// operation.
case ISD::OR:
if (SDNode *I = SelectBitfieldInsert(N))
return CodeGenMap[Op] = SDOperand(I, 0);
-
- if (SDNode *I = SelectIntImmediateExpr(N->getOperand(0),
- N->getOperand(1),
- PPC::ORIS, PPC::ORI))
- return CodeGenMap[Op] = SDOperand(I, 0);
// Other cases are autogenerated.
break;
case ISD::FNEG: {
SDOperand Val = Select(N->getOperand(0));
MVT::ValueType Ty = N->getValueType(0);
- if (Val.Val->hasOneUse()) {
+ if (N->getOperand(0).Val->hasOneUse()) {
unsigned Opc;
switch (Val.isTargetOpcode() ? Val.getTargetOpcode() : 0) {
default: Opc = 0; break;