|
22 | 22 | #include "llvm/CodeGen/StackMaps.h"
|
23 | 23 | #include "llvm/CodeGen/TargetLowering.h"
|
24 | 24 | #include "llvm/IR/DerivedTypes.h"
|
| 25 | +#include "llvm/IR/DiagnosticInfo.h" |
25 | 26 | #include "llvm/Support/ErrorHandling.h"
|
26 | 27 | #include "llvm/Support/KnownBits.h"
|
27 | 28 | #include "llvm/Support/raw_ostream.h"
|
@@ -357,6 +358,9 @@ void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
|
357 | 358 | case ISD::PATCHPOINT:
|
358 | 359 | Res = PromoteIntRes_PATCHPOINT(N);
|
359 | 360 | break;
|
| 361 | + case ISD::READ_REGISTER: |
| 362 | + Res = PromoteIntRes_READ_REGISTER(N); |
| 363 | + break; |
360 | 364 | }
|
361 | 365 |
|
362 | 366 | // If the result is null then the sub-method took care of registering it.
|
@@ -2076,6 +2080,9 @@ bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) {
|
2076 | 2080 | case ISD::PATCHPOINT:
|
2077 | 2081 | Res = PromoteIntOp_PATCHPOINT(N, OpNo);
|
2078 | 2082 | break;
|
| 2083 | + case ISD::WRITE_REGISTER: |
| 2084 | + Res = PromoteIntOp_WRITE_REGISTER(N, OpNo); |
| 2085 | + break; |
2079 | 2086 | case ISD::EXPERIMENTAL_VP_STRIDED_LOAD:
|
2080 | 2087 | case ISD::EXPERIMENTAL_VP_STRIDED_STORE:
|
2081 | 2088 | Res = PromoteIntOp_VP_STRIDED(N, OpNo);
|
@@ -2853,6 +2860,15 @@ SDValue DAGTypeLegalizer::PromoteIntOp_PATCHPOINT(SDNode *N, unsigned OpNo) {
|
2853 | 2860 | return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
|
2854 | 2861 | }
|
2855 | 2862 |
|
| 2863 | +SDValue DAGTypeLegalizer::PromoteIntOp_WRITE_REGISTER(SDNode *N, |
| 2864 | + unsigned OpNo) { |
| 2865 | + const Function &Fn = DAG.getMachineFunction().getFunction(); |
| 2866 | + Fn.getContext().diagnose(DiagnosticInfoLegalizationFailure( |
| 2867 | + "cannot use llvm.write_register with illegal type", Fn, |
| 2868 | + N->getDebugLoc())); |
| 2869 | + return N->getOperand(0); |
| 2870 | +} |
| 2871 | + |
2856 | 2872 | SDValue DAGTypeLegalizer::PromoteIntOp_VP_STRIDED(SDNode *N, unsigned OpNo) {
|
2857 | 2873 | assert((N->getOpcode() == ISD::EXPERIMENTAL_VP_STRIDED_LOAD && OpNo == 3) ||
|
2858 | 2874 | (N->getOpcode() == ISD::EXPERIMENTAL_VP_STRIDED_STORE && OpNo == 4));
|
@@ -3127,6 +3143,10 @@ void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) {
|
3127 | 3143 | case ISD::VSCALE:
|
3128 | 3144 | ExpandIntRes_VSCALE(N, Lo, Hi);
|
3129 | 3145 | break;
|
| 3146 | + |
| 3147 | + case ISD::READ_REGISTER: |
| 3148 | + ExpandIntRes_READ_REGISTER(N, Lo, Hi); |
| 3149 | + break; |
3130 | 3150 | }
|
3131 | 3151 |
|
3132 | 3152 | // If Lo/Hi is null, the sub-method took care of registering results etc.
|
@@ -5471,6 +5491,18 @@ void DAGTypeLegalizer::ExpandIntRes_VSCALE(SDNode *N, SDValue &Lo,
|
5471 | 5491 | SplitInteger(Res, Lo, Hi);
|
5472 | 5492 | }
|
5473 | 5493 |
|
| 5494 | +void DAGTypeLegalizer::ExpandIntRes_READ_REGISTER(SDNode *N, SDValue &Lo, |
| 5495 | + SDValue &Hi) { |
| 5496 | + const Function &Fn = DAG.getMachineFunction().getFunction(); |
| 5497 | + Fn.getContext().diagnose(DiagnosticInfoLegalizationFailure( |
| 5498 | + "cannot use llvm.read_register with illegal type", Fn, N->getDebugLoc())); |
| 5499 | + ReplaceValueWith(SDValue(N, 1), N->getOperand(0)); |
| 5500 | + EVT LoVT, HiVT; |
| 5501 | + std::tie(LoVT, HiVT) = DAG.GetSplitDestVTs(N->getValueType(0)); |
| 5502 | + Lo = DAG.getPOISON(LoVT); |
| 5503 | + Hi = DAG.getPOISON(HiVT); |
| 5504 | +} |
| 5505 | + |
5474 | 5506 | //===----------------------------------------------------------------------===//
|
5475 | 5507 | // Integer Operand Expansion
|
5476 | 5508 | //===----------------------------------------------------------------------===//
|
@@ -5537,6 +5569,9 @@ bool DAGTypeLegalizer::ExpandIntegerOperand(SDNode *N, unsigned OpNo) {
|
5537 | 5569 | case ISD::EXPERIMENTAL_VP_STRIDED_STORE:
|
5538 | 5570 | Res = ExpandIntOp_VP_STRIDED(N, OpNo);
|
5539 | 5571 | break;
|
| 5572 | + case ISD::WRITE_REGISTER: |
| 5573 | + Res = ExpandIntOp_WRITE_REGISTER(N, OpNo); |
| 5574 | + break; |
5540 | 5575 | }
|
5541 | 5576 |
|
5542 | 5577 | // If the result is null, the sub-method took care of registering results etc.
|
@@ -5935,6 +5970,15 @@ SDValue DAGTypeLegalizer::ExpandIntOp_VP_STRIDED(SDNode *N, unsigned OpNo) {
|
5935 | 5970 | return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
|
5936 | 5971 | }
|
5937 | 5972 |
|
| 5973 | +SDValue DAGTypeLegalizer::ExpandIntOp_WRITE_REGISTER(SDNode *N, unsigned OpNo) { |
| 5974 | + const Function &Fn = DAG.getMachineFunction().getFunction(); |
| 5975 | + Fn.getContext().diagnose(DiagnosticInfoLegalizationFailure( |
| 5976 | + "cannot use llvm.write_register with illegal type", Fn, |
| 5977 | + N->getDebugLoc())); |
| 5978 | + |
| 5979 | + return N->getOperand(0); |
| 5980 | +} |
| 5981 | + |
5938 | 5982 | SDValue DAGTypeLegalizer::PromoteIntRes_VECTOR_SPLICE(SDNode *N) {
|
5939 | 5983 | SDLoc dl(N);
|
5940 | 5984 |
|
@@ -6332,6 +6376,16 @@ SDValue DAGTypeLegalizer::PromoteIntRes_PATCHPOINT(SDNode *N) {
|
6332 | 6376 | return Res.getValue(0);
|
6333 | 6377 | }
|
6334 | 6378 |
|
| 6379 | +SDValue DAGTypeLegalizer::PromoteIntRes_READ_REGISTER(SDNode *N) { |
| 6380 | + const Function &Fn = DAG.getMachineFunction().getFunction(); |
| 6381 | + Fn.getContext().diagnose(DiagnosticInfoLegalizationFailure( |
| 6382 | + "cannot use llvm.read_register with illegal type", Fn, N->getDebugLoc())); |
| 6383 | + |
| 6384 | + EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)); |
| 6385 | + ReplaceValueWith(SDValue(N, 1), N->getOperand(0)); |
| 6386 | + return DAG.getPOISON(NVT); |
| 6387 | +} |
| 6388 | + |
6335 | 6389 | SDValue DAGTypeLegalizer::PromoteIntOp_EXTRACT_VECTOR_ELT(SDNode *N) {
|
6336 | 6390 | SDLoc dl(N);
|
6337 | 6391 | SDValue V0 = GetPromotedInteger(N->getOperand(0));
|
|
0 commit comments