[LoongArch] Add some comments for expand pseudo-inst pass. NFC
authorwanglei <wanglei@loongson.cn>
Tue, 27 Sep 2022 11:03:18 +0000 (19:03 +0800)
committerWeining Lu <luweining@loongson.cn>
Tue, 27 Sep 2022 12:26:07 +0000 (20:26 +0800)
Differential Revision: https://reviews.llvm.org/D134708

llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp

index a7a5cd3..08b3a0f 100644 (file)
@@ -131,6 +131,9 @@ bool LoongArchPreRAExpandPseudo::expandPcalau12iInstPair(
 bool LoongArchPreRAExpandPseudo::expandLoadAddressPcrel(
     MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
     MachineBasicBlock::iterator &NextMBBI) {
+  // Code Sequence:
+  // pcalau12i $rd, %pc_hi20(sym)
+  // addi.w/d $rd, $rd, %pc_lo12(sym)
   MachineFunction *MF = MBB.getParent();
   const auto &STI = MF->getSubtarget<LoongArchSubtarget>();
   unsigned SecondOpcode = STI.is64Bit() ? LoongArch::ADDI_D : LoongArch::ADDI_W;
@@ -141,6 +144,9 @@ bool LoongArchPreRAExpandPseudo::expandLoadAddressPcrel(
 bool LoongArchPreRAExpandPseudo::expandLoadAddressGot(
     MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
     MachineBasicBlock::iterator &NextMBBI) {
+  // Code Sequence:
+  // pcalau12i $rd, %got_pc_hi20(sym)
+  // ld.w/d $rd, $rd, %got_pc_lo12(sym)
   MachineFunction *MF = MBB.getParent();
   const auto &STI = MF->getSubtarget<LoongArchSubtarget>();
   unsigned SecondOpcode = STI.is64Bit() ? LoongArch::LD_D : LoongArch::LD_W;