diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp index 1a5c595b48b0dc0d037eb7ae376816c290b5bcc4..96c78884d73957c339cfbc376ab0ba0ec3be6cdc 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp @@ -1262,14 +1262,19 @@ void AArch64CGFunc::SelectAsm(AsmNode &node) { case OP_regread: { auto ®readNode = static_cast(*node.Opnd(i)); PregIdx pregIdx = regreadNode.GetRegIdx(); - RegOperand &inOpnd = GetOrCreateVirtualRegisterOperand(GetVirtualRegNOFromPseudoRegIdx(pregIdx)); - listInputOpnd->PushOpnd(static_cast(inOpnd)); MIRPreg *preg = GetFunction().GetPregTab()->PregFromPregIdx(pregIdx); PrimType pType = preg->GetPrimType(); + RegOperand *inOpnd; + if (IsSpecialPseudoRegister(pregIdx)) { + inOpnd = &GetOrCreateSpecialRegisterOperand(-pregIdx, pType); + } else { + inOpnd = &GetOrCreateVirtualRegisterOperand(GetVirtualRegNOFromPseudoRegIdx(pregIdx)); + } + listInputOpnd->PushOpnd(static_cast(*inOpnd)); listInRegPrefix->stringList.push_back( - static_cast(&CreateStringOperand(GetRegPrefixFromPrimType(pType, inOpnd.GetSize(), str)))); + static_cast(&CreateStringOperand(GetRegPrefixFromPrimType(pType, inOpnd->GetSize(), str)))); if (isOutputTempNode) { - rPlusOpnd.emplace_back(std::make_pair(&static_cast(inOpnd), pType)); + rPlusOpnd.emplace_back(std::make_pair(&static_cast(*inOpnd), pType)); } break; }