Expand this pseudo-instruction into a sequence of real instructions. Symbol-relative offsets (`call`, `tail`, `la`) produce placeholder encodings with zero offsets; the caller is responsible for patching them after symbol resolution.
(&self)
| 214 | Self::Nop => vec![RealInstruction::Addi(Addi::new(X0, X0, 0))], |
| 215 | |
| 216 | Self::Li { rd, imm } => expand_li(*rd, *imm), |
| 217 | |
| 218 | Self::Mv { rd, rs } => vec![RealInstruction::Addi(Addi::new(*rd, *rs, 0))], |
| 219 | |
| 220 | Self::Not { rd, rs } => vec![RealInstruction::Xori(Xori::new(*rd, *rs, -1))], |
| 221 | |
| 222 | Self::Neg { rd, rs } => vec![RealInstruction::Sub(Sub::new(*rd, X0, *rs))], |
| 223 | |
| 224 | Self::Negw { rd, rs } => vec![RealInstruction::Subw(Subw::new(*rd, X0, *rs))], |
| 225 | |
| 226 | Self::SextW { rd, rs } => vec![RealInstruction::Addiw(Addiw::new(*rd, *rs, 0))], |
| 227 | |
| 228 | Self::Seqz { rd, rs } => vec![RealInstruction::Sltiu(Sltiu::new(*rd, *rs, 1))], |
| 229 | |
| 230 | Self::Snez { rd, rs } => vec![RealInstruction::Sltu(Sltu::new(*rd, X0, *rs))], |
| 231 | |
| 232 | Self::Sltz { rd, rs } => vec![RealInstruction::Slt(Slt::new(*rd, *rs, X0))], |
| 233 | |
| 234 | Self::Sgtz { rd, rs } => vec![RealInstruction::Slt(Slt::new(*rd, X0, *rs))], |
| 235 | |
| 236 | Self::Beqz { rs, offset } => vec![RealInstruction::Beq(Beq::new(*rs, X0, *offset))], |
| 237 | |
| 238 | Self::Bnez { rs, offset } => vec![RealInstruction::Bne(Bne::new(*rs, X0, *offset))], |
| 239 | |
| 240 | Self::Blez { rs, offset } => vec![RealInstruction::Bge(Bge::new(X0, *rs, *offset))], |
| 241 | |
| 242 | Self::Bgez { rs, offset } => vec![RealInstruction::Bge(Bge::new(*rs, X0, *offset))], |
| 243 | |
| 244 | Self::Bltz { rs, offset } => vec![RealInstruction::Blt(Blt::new(*rs, X0, *offset))], |
| 245 | |
| 246 | Self::Bgtz { rs, offset } => vec![RealInstruction::Blt(Blt::new(X0, *rs, *offset))], |
| 247 | |
| 248 | Self::Bgt { rs1, rs2, offset } => { |
| 249 | vec![RealInstruction::Blt(Blt::new(*rs2, *rs1, *offset))] |
| 250 | } |
| 251 | |
| 252 | Self::Ble { rs1, rs2, offset } => { |
| 253 | vec![RealInstruction::Bge(Bge::new(*rs2, *rs1, *offset))] |
| 254 | } |
| 255 | |
| 256 | Self::Bgtu { rs1, rs2, offset } => { |
| 257 | vec![RealInstruction::Bltu(Bltu::new(*rs2, *rs1, *offset))] |
| 258 | } |
| 259 | |
| 260 | Self::Bleu { rs1, rs2, offset } => { |
| 261 | vec![RealInstruction::Bgeu(Bgeu::new(*rs2, *rs1, *offset))] |
| 262 | } |
| 263 | |
| 264 | Self::J { offset } => vec![RealInstruction::Jal(Jal::new(X0, *offset))], |
| 265 | |
| 266 | Self::Jr { rs } => vec![RealInstruction::Jalr(Jalr::new(X0, *rs, 0))], |
| 267 | |
| 268 | Self::Ret => vec![RealInstruction::Jalr(Jalr::new(X0, RA, 0))], |
| 269 | |
| 270 | Self::Call { .. } => vec![ |
| 271 | RealInstruction::Auipc(Auipc::new(RA, 0)), |
| 272 | RealInstruction::Jalr(Jalr::new(RA, RA, 0)), |
| 273 | ], |