mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-12 17:25:49 +00:00
Remove Predicate_* calls from MBlaze and XCore
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112920 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -219,7 +219,7 @@ SelectAddr(SDNode *Op, SDValue Addr, SDValue &Offset, SDValue &Base) {
|
|||||||
// Operand is a result from an ADD.
|
// Operand is a result from an ADD.
|
||||||
if (Addr.getOpcode() == ISD::ADD) {
|
if (Addr.getOpcode() == ISD::ADD) {
|
||||||
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1))) {
|
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1))) {
|
||||||
if (Predicate_immSExt16(CN)) {
|
if (isUInt<16>(CN->getZExtValue())) {
|
||||||
|
|
||||||
// If the first operand is a FI, get the TargetFI Node
|
// If the first operand is a FI, get the TargetFI Node
|
||||||
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>
|
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>
|
||||||
|
@@ -56,6 +56,17 @@ namespace {
|
|||||||
return CurDAG->getTargetConstant(Imm, MVT::i32);
|
return CurDAG->getTargetConstant(Imm, MVT::i32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool immMskBitp(SDNode *inN) const {
|
||||||
|
ConstantSDNode *N = cast<ConstantSDNode>(inN);
|
||||||
|
uint32_t value = (uint32_t)N->getZExtValue();
|
||||||
|
if (!isMask_32(value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int msksize = 32 - CountLeadingZeros_32(value);
|
||||||
|
return (msksize >= 1 && msksize <= 8) ||
|
||||||
|
msksize == 16 || msksize == 24 || msksize == 32;
|
||||||
|
}
|
||||||
|
|
||||||
// Complex Pattern Selectors.
|
// Complex Pattern Selectors.
|
||||||
bool SelectADDRspii(SDNode *Op, SDValue Addr, SDValue &Base,
|
bool SelectADDRspii(SDNode *Op, SDValue Addr, SDValue &Base,
|
||||||
SDValue &Offset);
|
SDValue &Offset);
|
||||||
@@ -151,17 +162,15 @@ SDNode *XCoreDAGToDAGISel::Select(SDNode *N) {
|
|||||||
switch (N->getOpcode()) {
|
switch (N->getOpcode()) {
|
||||||
default: break;
|
default: break;
|
||||||
case ISD::Constant: {
|
case ISD::Constant: {
|
||||||
if (Predicate_immMskBitp(N)) {
|
uint64_t Val = cast<ConstantSDNode>(N)->getZExtValue();
|
||||||
|
if (immMskBitp(N)) {
|
||||||
// Transformation function: get the size of a mask
|
// Transformation function: get the size of a mask
|
||||||
int64_t MaskVal = cast<ConstantSDNode>(N)->getZExtValue();
|
|
||||||
assert(isMask_32(MaskVal));
|
|
||||||
// Look for the first non-zero bit
|
// Look for the first non-zero bit
|
||||||
SDValue MskSize = getI32Imm(32 - CountLeadingZeros_32(MaskVal));
|
SDValue MskSize = getI32Imm(32 - CountLeadingZeros_32(Val));
|
||||||
return CurDAG->getMachineNode(XCore::MKMSK_rus, dl,
|
return CurDAG->getMachineNode(XCore::MKMSK_rus, dl,
|
||||||
MVT::i32, MskSize);
|
MVT::i32, MskSize);
|
||||||
}
|
}
|
||||||
else if (! Predicate_immU16(N)) {
|
else if (!isUInt<16>(Val)) {
|
||||||
unsigned Val = cast<ConstantSDNode>(N)->getZExtValue();
|
|
||||||
SDValue CPIdx =
|
SDValue CPIdx =
|
||||||
CurDAG->getTargetConstantPool(ConstantInt::get(
|
CurDAG->getTargetConstantPool(ConstantInt::get(
|
||||||
Type::getInt32Ty(*CurDAG->getContext()), Val),
|
Type::getInt32Ty(*CurDAG->getContext()), Val),
|
||||||
|
@@ -140,17 +140,7 @@ def immU20 : PatLeaf<(imm), [{
|
|||||||
return (uint32_t)N->getZExtValue() < (1 << 20);
|
return (uint32_t)N->getZExtValue() < (1 << 20);
|
||||||
}]>;
|
}]>;
|
||||||
|
|
||||||
def immMskBitp : PatLeaf<(imm), [{
|
def immMskBitp : PatLeaf<(imm), [{ return immMskBitp(N); }]>;
|
||||||
uint32_t value = (uint32_t)N->getZExtValue();
|
|
||||||
if (!isMask_32(value)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int msksize = 32 - CountLeadingZeros_32(value);
|
|
||||||
return (msksize >= 1 && msksize <= 8)
|
|
||||||
|| msksize == 16
|
|
||||||
|| msksize == 24
|
|
||||||
|| msksize == 32;
|
|
||||||
}]>;
|
|
||||||
|
|
||||||
def immBitp : PatLeaf<(imm), [{
|
def immBitp : PatLeaf<(imm), [{
|
||||||
uint32_t value = (uint32_t)N->getZExtValue();
|
uint32_t value = (uint32_t)N->getZExtValue();
|
||||||
|
Reference in New Issue
Block a user