mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
set the 'isstore' flag for instructions whose pattern is an
intrinsic that writes to memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45650 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e81cd881b1
commit
e67bde5bb1
@ -633,6 +633,22 @@ static std::vector<unsigned char> getImplicitType(Record *R, bool NotRegisters,
|
|||||||
return Other;
|
return Other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// getIntrinsicInfo - If this node corresponds to an intrinsic, return the
|
||||||
|
/// CodeGenIntrinsic information for it, otherwise return a null pointer.
|
||||||
|
const CodeGenIntrinsic *TreePatternNode::
|
||||||
|
getIntrinsicInfo(const CodeGenDAGPatterns &CDP) const {
|
||||||
|
if (getOperator() != CDP.get_intrinsic_void_sdnode() &&
|
||||||
|
getOperator() != CDP.get_intrinsic_w_chain_sdnode() &&
|
||||||
|
getOperator() != CDP.get_intrinsic_wo_chain_sdnode())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
unsigned IID =
|
||||||
|
dynamic_cast<IntInit*>(getChild(0)->getLeafValue())->getValue();
|
||||||
|
return &CDP.getIntrinsicInfo(IID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// ApplyTypeConstraints - Apply all of the type constraints relevent to
|
/// ApplyTypeConstraints - Apply all of the type constraints relevent to
|
||||||
/// this node and its children in the tree. This returns true if it makes a
|
/// this node and its children in the tree. This returns true if it makes a
|
||||||
/// change, false otherwise. If a type contradiction is found, throw an
|
/// change, false otherwise. If a type contradiction is found, throw an
|
||||||
@ -699,27 +715,22 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
|
|||||||
MadeChange = getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
|
MadeChange = getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
|
||||||
MadeChange |= UpdateNodeType(MVT::isVoid, TP);
|
MadeChange |= UpdateNodeType(MVT::isVoid, TP);
|
||||||
return MadeChange;
|
return MadeChange;
|
||||||
} else if (getOperator() == CDP.get_intrinsic_void_sdnode() ||
|
} else if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP)) {
|
||||||
getOperator() == CDP.get_intrinsic_w_chain_sdnode() ||
|
|
||||||
getOperator() == CDP.get_intrinsic_wo_chain_sdnode()) {
|
|
||||||
unsigned IID =
|
|
||||||
dynamic_cast<IntInit*>(getChild(0)->getLeafValue())->getValue();
|
|
||||||
const CodeGenIntrinsic &Int = CDP.getIntrinsicInfo(IID);
|
|
||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
|
|
||||||
// Apply the result type to the node.
|
// Apply the result type to the node.
|
||||||
MadeChange = UpdateNodeType(Int.ArgVTs[0], TP);
|
MadeChange = UpdateNodeType(Int->ArgVTs[0], TP);
|
||||||
|
|
||||||
if (getNumChildren() != Int.ArgVTs.size())
|
if (getNumChildren() != Int->ArgVTs.size())
|
||||||
TP.error("Intrinsic '" + Int.Name + "' expects " +
|
TP.error("Intrinsic '" + Int->Name + "' expects " +
|
||||||
utostr(Int.ArgVTs.size()-1) + " operands, not " +
|
utostr(Int->ArgVTs.size()-1) + " operands, not " +
|
||||||
utostr(getNumChildren()-1) + " operands!");
|
utostr(getNumChildren()-1) + " operands!");
|
||||||
|
|
||||||
// Apply type info to the intrinsic ID.
|
// Apply type info to the intrinsic ID.
|
||||||
MadeChange |= getChild(0)->UpdateNodeType(MVT::iPTR, TP);
|
MadeChange |= getChild(0)->UpdateNodeType(MVT::iPTR, TP);
|
||||||
|
|
||||||
for (unsigned i = 1, e = getNumChildren(); i != e; ++i) {
|
for (unsigned i = 1, e = getNumChildren(); i != e; ++i) {
|
||||||
MVT::ValueType OpVT = Int.ArgVTs[i];
|
MVT::ValueType OpVT = Int->ArgVTs[i];
|
||||||
MadeChange |= getChild(i)->UpdateNodeType(OpVT, TP);
|
MadeChange |= getChild(i)->UpdateNodeType(OpVT, TP);
|
||||||
MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
|
MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
|
||||||
}
|
}
|
||||||
|
@ -203,14 +203,17 @@ public:
|
|||||||
void setChild(unsigned i, TreePatternNode *N) {
|
void setChild(unsigned i, TreePatternNode *N) {
|
||||||
Children[i] = N;
|
Children[i] = N;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const std::string &getPredicateFn() const { return PredicateFn; }
|
const std::string &getPredicateFn() const { return PredicateFn; }
|
||||||
void setPredicateFn(const std::string &Fn) { PredicateFn = Fn; }
|
void setPredicateFn(const std::string &Fn) { PredicateFn = Fn; }
|
||||||
|
|
||||||
Record *getTransformFn() const { return TransformFn; }
|
Record *getTransformFn() const { return TransformFn; }
|
||||||
void setTransformFn(Record *Fn) { TransformFn = Fn; }
|
void setTransformFn(Record *Fn) { TransformFn = Fn; }
|
||||||
|
|
||||||
|
/// getIntrinsicInfo - If this node corresponds to an intrinsic, return the
|
||||||
|
/// CodeGenIntrinsic information for it, otherwise return a null pointer.
|
||||||
|
const CodeGenIntrinsic *getIntrinsicInfo(const CodeGenDAGPatterns &CDP) const;
|
||||||
|
|
||||||
void print(std::ostream &OS) const;
|
void print(std::ostream &OS) const;
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
|
@ -176,8 +176,15 @@ private:
|
|||||||
// Get information about the SDNode for the operator.
|
// Get information about the SDNode for the operator.
|
||||||
const SDNodeInfo &OpInfo = CDP.getSDNodeInfo(N->getOperator());
|
const SDNodeInfo &OpInfo = CDP.getSDNodeInfo(N->getOperator());
|
||||||
|
|
||||||
if (OpInfo.getEnumName() == "ISD::STORE")
|
// If this is a store node, it obviously stores to memory.
|
||||||
|
if (OpInfo.getEnumName() == "ISD::STORE") {
|
||||||
isStore = true;
|
isStore = true;
|
||||||
|
|
||||||
|
} else if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) {
|
||||||
|
// If this is an intrinsic, analyze it.
|
||||||
|
if (IntInfo->ModRef >= CodeGenIntrinsic::WriteArgMem)
|
||||||
|
isStore = true; // Intrinsics that can write to memory are 'isStore'.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i)
|
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user