mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
TableGen: Support physical register inputs > 255
This was truncating register value that didn't fit in unsigned char. Switch AMDGPU sendmsg intrinsics to using a tablegen pattern. llvm-svn: 366695
This commit is contained in:
parent
8aea07e50f
commit
bcf27a40b4
@ -162,6 +162,7 @@ public:
|
|||||||
OPC_EmitMergeInputChains1_1,
|
OPC_EmitMergeInputChains1_1,
|
||||||
OPC_EmitMergeInputChains1_2,
|
OPC_EmitMergeInputChains1_2,
|
||||||
OPC_EmitCopyToReg,
|
OPC_EmitCopyToReg,
|
||||||
|
OPC_EmitCopyToReg2,
|
||||||
OPC_EmitNodeXForm,
|
OPC_EmitNodeXForm,
|
||||||
OPC_EmitNode,
|
OPC_EmitNode,
|
||||||
// Space-optimized forms that implicitly encode number of result VTs.
|
// Space-optimized forms that implicitly encode number of result VTs.
|
||||||
|
@ -3323,10 +3323,13 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OPC_EmitCopyToReg: {
|
case OPC_EmitCopyToReg:
|
||||||
|
case OPC_EmitCopyToReg2: {
|
||||||
unsigned RecNo = MatcherTable[MatcherIndex++];
|
unsigned RecNo = MatcherTable[MatcherIndex++];
|
||||||
assert(RecNo < RecordedNodes.size() && "Invalid EmitCopyToReg");
|
assert(RecNo < RecordedNodes.size() && "Invalid EmitCopyToReg");
|
||||||
unsigned DestPhysReg = MatcherTable[MatcherIndex++];
|
unsigned DestPhysReg = MatcherTable[MatcherIndex++];
|
||||||
|
if (Opcode == OPC_EmitCopyToReg2)
|
||||||
|
DestPhysReg |= MatcherTable[MatcherIndex++] << 8;
|
||||||
|
|
||||||
if (!InputChain.getNode())
|
if (!InputChain.getNode())
|
||||||
InputChain = CurDAG->getEntryNode();
|
InputChain = CurDAG->getEntryNode();
|
||||||
|
@ -932,13 +932,15 @@ private:
|
|||||||
///
|
///
|
||||||
class EmitCopyToRegMatcher : public Matcher {
|
class EmitCopyToRegMatcher : public Matcher {
|
||||||
unsigned SrcSlot; // Value to copy into the physreg.
|
unsigned SrcSlot; // Value to copy into the physreg.
|
||||||
Record *DestPhysReg;
|
const CodeGenRegister *DestPhysReg;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EmitCopyToRegMatcher(unsigned srcSlot, Record *destPhysReg)
|
EmitCopyToRegMatcher(unsigned srcSlot,
|
||||||
|
const CodeGenRegister *destPhysReg)
|
||||||
: Matcher(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {}
|
: Matcher(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {}
|
||||||
|
|
||||||
unsigned getSrcSlot() const { return SrcSlot; }
|
unsigned getSrcSlot() const { return SrcSlot; }
|
||||||
Record *getDestPhysReg() const { return DestPhysReg; }
|
const CodeGenRegister *getDestPhysReg() const { return DestPhysReg; }
|
||||||
|
|
||||||
static bool classof(const Matcher *N) {
|
static bool classof(const Matcher *N) {
|
||||||
return N->getKind() == EmitCopyToReg;
|
return N->getKind() == EmitCopyToReg;
|
||||||
|
@ -670,12 +670,22 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
|
|||||||
OS << '\n';
|
OS << '\n';
|
||||||
return 2+MN->getNumNodes();
|
return 2+MN->getNumNodes();
|
||||||
}
|
}
|
||||||
case Matcher::EmitCopyToReg:
|
case Matcher::EmitCopyToReg: {
|
||||||
OS << "OPC_EmitCopyToReg, "
|
const auto *C2RMatcher = cast<EmitCopyToRegMatcher>(N);
|
||||||
<< cast<EmitCopyToRegMatcher>(N)->getSrcSlot() << ", "
|
int Bytes = 3;
|
||||||
<< getQualifiedName(cast<EmitCopyToRegMatcher>(N)->getDestPhysReg())
|
const CodeGenRegister *Reg = C2RMatcher->getDestPhysReg();
|
||||||
<< ",\n";
|
if (Reg->EnumValue > 255) {
|
||||||
return 3;
|
assert(isUInt<16>(Reg->EnumValue) && "not handled");
|
||||||
|
OS << "OPC_EmitCopyToReg2, " << C2RMatcher->getSrcSlot() << ", "
|
||||||
|
<< "TARGET_VAL(" << getQualifiedName(Reg->TheDef) << "),\n";
|
||||||
|
++Bytes;
|
||||||
|
} else {
|
||||||
|
OS << "OPC_EmitCopyToReg, " << C2RMatcher->getSrcSlot() << ", "
|
||||||
|
<< getQualifiedName(Reg->TheDef) << ",\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Bytes;
|
||||||
|
}
|
||||||
case Matcher::EmitNodeXForm: {
|
case Matcher::EmitNodeXForm: {
|
||||||
const EmitNodeXFormMatcher *XF = cast<EmitNodeXFormMatcher>(N);
|
const EmitNodeXFormMatcher *XF = cast<EmitNodeXFormMatcher>(N);
|
||||||
OS << "OPC_EmitNodeXForm, " << getNodeXFormID(XF->getNodeXForm()) << ", "
|
OS << "OPC_EmitNodeXForm, " << getNodeXFormID(XF->getNodeXForm()) << ", "
|
||||||
|
@ -867,9 +867,13 @@ EmitResultInstructionAsOperand(const TreePatternNode *N,
|
|||||||
if (isRoot && !PhysRegInputs.empty()) {
|
if (isRoot && !PhysRegInputs.empty()) {
|
||||||
// Emit all of the CopyToReg nodes for the input physical registers. These
|
// Emit all of the CopyToReg nodes for the input physical registers. These
|
||||||
// occur in patterns like (mul:i8 AL:i8, GR8:i8:$src).
|
// occur in patterns like (mul:i8 AL:i8, GR8:i8:$src).
|
||||||
for (unsigned i = 0, e = PhysRegInputs.size(); i != e; ++i)
|
for (unsigned i = 0, e = PhysRegInputs.size(); i != e; ++i) {
|
||||||
|
const CodeGenRegister *Reg =
|
||||||
|
CGP.getTargetInfo().getRegBank().getReg(PhysRegInputs[i].first);
|
||||||
AddMatcher(new EmitCopyToRegMatcher(PhysRegInputs[i].second,
|
AddMatcher(new EmitCopyToRegMatcher(PhysRegInputs[i].second,
|
||||||
PhysRegInputs[i].first));
|
Reg));
|
||||||
|
}
|
||||||
|
|
||||||
// Even if the node has no other glue inputs, the resultant node must be
|
// Even if the node has no other glue inputs, the resultant node must be
|
||||||
// glued to the CopyFromReg nodes we just generated.
|
// glued to the CopyFromReg nodes we just generated.
|
||||||
TreeHasInGlue = true;
|
TreeHasInGlue = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user