mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 13:36:28 +00:00
Split out the shift code from visitBinary.
llvm-svn: 24412
This commit is contained in:
parent
fc4928a31a
commit
78ac456d32
@ -347,7 +347,8 @@ public:
|
||||
void visitUnwind(UnwindInst &I) { assert(0 && "TODO"); }
|
||||
|
||||
//
|
||||
void visitBinary(User &I, unsigned Opcode, bool isShift = false);
|
||||
void visitBinary(User &I, unsigned Opcode);
|
||||
void visitShift(User &I, unsigned Opcode);
|
||||
void visitAdd(User &I) {
|
||||
visitBinary(I, I.getType()->isFloatingPoint() ? ISD::FADD : ISD::ADD);
|
||||
}
|
||||
@ -380,9 +381,9 @@ public:
|
||||
void visitAnd(User &I) { visitBinary(I, ISD::AND); }
|
||||
void visitOr (User &I) { visitBinary(I, ISD::OR); }
|
||||
void visitXor(User &I) { visitBinary(I, ISD::XOR); }
|
||||
void visitShl(User &I) { visitBinary(I, ISD::SHL, true); }
|
||||
void visitShr(User &I) {
|
||||
visitBinary(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA, true);
|
||||
void visitShl(User &I) { visitShift(I, ISD::SHL); }
|
||||
void visitShr(User &I) {
|
||||
visitShift(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA);
|
||||
}
|
||||
|
||||
void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc);
|
||||
@ -520,13 +521,19 @@ void SelectionDAGLowering::visitSub(User &I) {
|
||||
}
|
||||
}
|
||||
|
||||
void SelectionDAGLowering::visitBinary(User &I, unsigned Opcode, bool isShift) {
|
||||
void SelectionDAGLowering::visitBinary(User &I, unsigned Opcode) {
|
||||
SDOperand Op1 = getValue(I.getOperand(0));
|
||||
SDOperand Op2 = getValue(I.getOperand(1));
|
||||
|
||||
if (isShift)
|
||||
Op2 = DAG.getNode(ISD::ANY_EXTEND, TLI.getShiftAmountTy(), Op2);
|
||||
setValue(&I, DAG.getNode(Opcode, Op1.getValueType(), Op1, Op2));
|
||||
}
|
||||
|
||||
void SelectionDAGLowering::visitShift(User &I, unsigned Opcode) {
|
||||
SDOperand Op1 = getValue(I.getOperand(0));
|
||||
SDOperand Op2 = getValue(I.getOperand(1));
|
||||
|
||||
Op2 = DAG.getNode(ISD::ANY_EXTEND, TLI.getShiftAmountTy(), Op2);
|
||||
|
||||
setValue(&I, DAG.getNode(Opcode, Op1.getValueType(), Op1, Op2));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user