[PATCH] D40808: [RISCV] Implement branch analysis
Mandeep Singh Grang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 4 16:10:35 PST 2017
mgrang added inline comments.
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:81
+// RISCVInstrInfo, giving us flexibility in what to push to it. For RISCV, we
+// push BranchOpcode, Reg1, Reg2
+static void parseCondBranch(MachineInstr *LastInst, MachineBasicBlock *&Target,
----------------
Period after comment.
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:117
+ bool AllowModify) const {
+ // Implementation derived from AArch64InstrInfo::analyzeBranch
+ TBB = FBB = nullptr;
----------------
Period after comment.
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:242
+
+ // Unconditional branch
+ if (Cond.empty()) {
----------------
Period after comment.
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:245
+ BuildMI(&MBB, DL, get(RISCV::PseudoBR)).addMBB(TBB);
+ return 1;
+ }
----------------
Can you add a comment to explain what 1 is here?
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:248
+
+ // Either a one or two-way conditional branch
+ unsigned Opc = Cond[0].getImm();
----------------
Period after comment.
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:252
+
+ // One-way conditional branch
+ if (!FBB) {
----------------
Period after comment.
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:253
+ // One-way conditional branch
+ if (!FBB) {
+ return 1;
----------------
Braces not needed here.
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:254
+ if (!FBB) {
+ return 1;
+ }
----------------
Can you add a comment to explain what 1 is here?
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:257
+
+ // Two-way conditional branch
+ BuildMI(&MBB, DL, get(RISCV::PseudoBR)).addMBB(FBB);
----------------
Period after comment.
================
Comment at: lib/Target/RISCV/RISCVInstrInfo.cpp:259
+ BuildMI(&MBB, DL, get(RISCV::PseudoBR)).addMBB(FBB);
+ return 2;
+}
----------------
Can you add a comment to explain what 2 is here?
https://reviews.llvm.org/D40808
More information about the llvm-commits
mailing list