Skip to content

Commit b6dc648

Browse files
committed
[CHERI] Fix CAP_TAG_GET operand counts and orders to work once validation is applied by upstream.
1 parent 44c01c2 commit b6dc648

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
16311631
case RISCVISD::CAP_TAG_GET: {
16321632
ReplaceNode(Node, CurDAG->getMachineNode(
16331633
RISCV::CGetTag, DL, Node->getVTList(),
1634-
{Node->getOperand(0), Node->getOperand(1)}));
1634+
{Node->getOperand(1), Node->getOperand(0)}));
16351635
return;
16361636
}
16371637
case ISD::INTRINSIC_WO_CHAIN: {

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6033,7 +6033,7 @@ SDValue Cap, EVT XLenVT) {
60336033
// call is optimized poorly, so we expand it manually.
60346034
SDVTList VTList = DAG.getVTList(XLenVT, MVT::Other);
60356035
SDValue IsTagged =
6036-
DAG.getNode(RISCVISD::CAP_TAG_GET, DL, VTList, Cap, DAG.getEntryNode());
6036+
DAG.getNode(RISCVISD::CAP_TAG_GET, DL, VTList, DAG.getEntryNode(), Cap);
60376037
SDValue Mask = DAG.getNode(ISD::SUB, DL, XLenVT,
60386038
DAG.getConstant(0, DL, XLenVT), IsTagged);
60396039
// Using EXTRACT_SUBREG instead of getaddr is safe here since the result is
@@ -18936,7 +18936,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1893618936
case Intrinsic::cheri_cap_tag_get: {
1893718937
SDVTList VTList = DAG.getVTList(XLenVT, MVT::Other);
1893818938
SDValue IntRes = DAG.getNode(RISCVISD::CAP_TAG_GET, DL, VTList,
18939-
N->getOperand(1), DAG.getEntryNode());
18939+
DAG.getEntryNode(), N->getOperand(1));
1894018940
SDValue Chain = SDValue(IntRes.getNode(), 1);
1894118941
IntRes = DAG.getNode(ISD::AssertZext, DL, XLenVT, IntRes,
1894218942
DAG.getValueType(MVT::i1));
@@ -18947,7 +18947,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1894718947
case Intrinsic::cheri_cap_tag_get_temporal: {
1894818948
SDVTList VTList = DAG.getVTList(XLenVT, MVT::Other);
1894918949
SDValue IntRes = DAG.getNode(RISCVISD::CAP_TAG_GET, DL, VTList,
18950-
N->getOperand(2), N->getOperand(0));
18950+
N->getOperand(0), N->getOperand(2));
1895118951
SDValue Chain = SDValue(IntRes.getNode(), 1);
1895218952
IntRes = DAG.getNode(ISD::AssertZext, DL, XLenVT, IntRes,
1895318953
DAG.getValueType(MVT::i1));

llvm/lib/Target/RISCV/RISCVInstrInfoXCheri.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def SDT_RISCVCheriBoolUnary : SDTypeProfile<1, 1, [
1717
SDTCisInt<0>, SDTCisVT<1, CLenVT>
1818
]>;
1919

20-
def SDT_RISCVCheriBoolUnaryChain : SDTypeProfile<2, 2, [
20+
def SDT_RISCVCheriBoolUnaryChain : SDTypeProfile<1, 1, [
2121
SDTCisInt<0>, SDTCisVT<2, CLenVT>
2222
]>;
2323

0 commit comments

Comments
 (0)