@@ -56,19 +56,10 @@ static bool printOp(const DWARFExpression::Operation *Op, raw_ostream &OS,
56
56
assert (!Name.empty () && " DW_OP has no name!" );
57
57
OS << Name;
58
58
59
- std::optional<unsigned > SubOpcode = Op->getSubCode ();
60
- if (SubOpcode) {
61
- StringRef SubName = SubOperationEncodingString (Op->getCode (), *SubOpcode);
62
- assert (!SubName.empty () && " DW_OP SubOp has no name!" );
63
- OS << ' ' << SubName;
64
- }
65
-
66
59
if ((Op->getCode () >= DW_OP_breg0 && Op->getCode () <= DW_OP_breg31) ||
67
60
(Op->getCode () >= DW_OP_reg0 && Op->getCode () <= DW_OP_reg31) ||
68
61
Op->getCode () == DW_OP_bregx || Op->getCode () == DW_OP_regx ||
69
- Op->getCode () == DW_OP_regval_type ||
70
- (SubOpcode && (*SubOpcode == DW_OP_LLVM_call_frame_entry_reg ||
71
- *SubOpcode == DW_OP_LLVM_aspace_bregx)))
62
+ Op->getCode () == DW_OP_regval_type)
72
63
if (prettyPrintRegisterOp (U, OS, DumpOpts, Op->getCode (),
73
64
Op->getRawOperands ()))
74
65
return true ;
@@ -79,8 +70,16 @@ static bool printOp(const DWARFExpression::Operation *Op, raw_ostream &OS,
79
70
unsigned Signed = Size & DWARFExpression::Operation::SignBit;
80
71
81
72
if (Size == DWARFExpression::Operation::SizeSubOpLEB) {
82
- assert (Operand == 0 );
83
- assert (SubOpcode);
73
+ assert (Operand == 0 && " DW_OP SubOp must be the first operand" );
74
+ unsigned SubOpcode = Op->getRawOperand (Operand);
75
+ StringRef SubName = SubOperationEncodingString (Op->getCode (), SubOpcode);
76
+ assert (!SubName.empty () && " DW_OP SubOp has no name!" );
77
+ OS << ' ' << SubName;
78
+ if (SubOpcode == DW_OP_LLVM_call_frame_entry_reg ||
79
+ SubOpcode == DW_OP_LLVM_aspace_bregx)
80
+ if (prettyPrintRegisterOp (U, OS, DumpOpts, Op->getCode (),
81
+ Op->getRawOperands ()))
82
+ return true ;
84
83
} else if (Size == DWARFExpression::Operation::BaseTypeRef && U) {
85
84
// For DW_OP_convert the operand may be 0 to indicate that conversion to
86
85
// the generic type should be done. The same holds for DW_OP_reinterpret,
0 commit comments