mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 20:34:38 +00:00
factor the 'in the default address space' check out to a single
'dsload' pattern. tblgen doesn't check patterns to see if they're textually identical. This allows better factoring. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97630 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1840991d54
commit
f85eff76b2
@ -350,6 +350,30 @@ def immSext8 : PatLeaf<(imm), [{
|
|||||||
def i16immSExt8 : PatLeaf<(i16 immSext8)>;
|
def i16immSExt8 : PatLeaf<(i16 immSext8)>;
|
||||||
def i32immSExt8 : PatLeaf<(i32 immSext8)>;
|
def i32immSExt8 : PatLeaf<(i32 immSext8)>;
|
||||||
|
|
||||||
|
/// Load patterns: these constraint the match to the right address space.
|
||||||
|
def dsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
|
||||||
|
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
||||||
|
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
||||||
|
if (PT->getAddressSpace() > 255)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}]>;
|
||||||
|
|
||||||
|
def gsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
|
||||||
|
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
||||||
|
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
||||||
|
return PT->getAddressSpace() == 256;
|
||||||
|
return false;
|
||||||
|
}]>;
|
||||||
|
|
||||||
|
def fsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
|
||||||
|
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
||||||
|
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
||||||
|
return PT->getAddressSpace() == 257;
|
||||||
|
return false;
|
||||||
|
}]>;
|
||||||
|
|
||||||
|
|
||||||
// Helper fragments for loads.
|
// Helper fragments for loads.
|
||||||
// It's always safe to treat a anyext i16 load as a i32 load if the i16 is
|
// It's always safe to treat a anyext i16 load as a i32 load if the i16 is
|
||||||
// known to be 32-bit aligned or better. Ditto for i8 to i16.
|
// known to be 32-bit aligned or better. Ditto for i8 to i16.
|
||||||
@ -367,8 +391,7 @@ def loadi16 : PatFrag<(ops node:$ptr), (i16 (unindexedload node:$ptr)), [{
|
|||||||
return false;
|
return false;
|
||||||
}]>;
|
}]>;
|
||||||
|
|
||||||
def loadi16_anyext : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)),
|
def loadi16_anyext : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)),[{
|
||||||
[{
|
|
||||||
LoadSDNode *LD = cast<LoadSDNode>(N);
|
LoadSDNode *LD = cast<LoadSDNode>(N);
|
||||||
if (const Value *Src = LD->getSrcValue())
|
if (const Value *Src = LD->getSrcValue())
|
||||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
||||||
@ -410,56 +433,12 @@ def nvloadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{
|
|||||||
return false;
|
return false;
|
||||||
}]>;
|
}]>;
|
||||||
|
|
||||||
def gsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
|
|
||||||
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
|
||||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
|
||||||
return PT->getAddressSpace() == 256;
|
|
||||||
return false;
|
|
||||||
}]>;
|
|
||||||
|
|
||||||
def fsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
|
def loadi8 : PatFrag<(ops node:$ptr), (i8 (dsload node:$ptr))>;
|
||||||
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
def loadi64 : PatFrag<(ops node:$ptr), (i64 (dsload node:$ptr))>;
|
||||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
def loadf32 : PatFrag<(ops node:$ptr), (f32 (dsload node:$ptr))>;
|
||||||
return PT->getAddressSpace() == 257;
|
def loadf64 : PatFrag<(ops node:$ptr), (f64 (dsload node:$ptr))>;
|
||||||
return false;
|
def loadf80 : PatFrag<(ops node:$ptr), (f80 (dsload node:$ptr))>;
|
||||||
}]>;
|
|
||||||
|
|
||||||
def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr)), [{
|
|
||||||
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
|
||||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
|
||||||
if (PT->getAddressSpace() > 255)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}]>;
|
|
||||||
def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr)), [{
|
|
||||||
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
|
||||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
|
||||||
if (PT->getAddressSpace() > 255)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}]>;
|
|
||||||
|
|
||||||
def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr)), [{
|
|
||||||
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
|
||||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
|
||||||
if (PT->getAddressSpace() > 255)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}]>;
|
|
||||||
def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr)), [{
|
|
||||||
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
|
||||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
|
||||||
if (PT->getAddressSpace() > 255)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}]>;
|
|
||||||
def loadf80 : PatFrag<(ops node:$ptr), (f80 (load node:$ptr)), [{
|
|
||||||
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
|
|
||||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
|
|
||||||
if (PT->getAddressSpace() > 255)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}]>;
|
|
||||||
|
|
||||||
def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>;
|
def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>;
|
||||||
def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>;
|
def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user