[PATCH] D43916: Named VReg support for MIR

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 19 15:04:15 PDT 2018


thegameg added inline comments.


================
Comment at: lib/CodeGen/MIRParser/MIParser.cpp:2534
+    if (!Names2VRegs.insert(std::make_pair(RegName, Reg)).second)
+      return error(Twine("Invalid register name '") + RegName + "'");
+    return Reg;
----------------
plotfi wrote:
> thegameg wrote:
> > It's a little unclear how to differentiate from an error (result = 1) or a register with the value 1. How about inlining this in the caller since it's only used once?
> So just do Names2VRegs.insert(std::make_pair(RegName, Reg)) ?
Hmm now that I'm thinking about it, if this insertion doesn't succeed it means that the key is already in the map. And since you checked at the beginning of this function I assume this can't happen?


================
Comment at: lib/CodeGen/MachineRegisterInfo.cpp:176
     TheDelegate->MRI_NoteNewVirtualRegister(Reg);
+  insertVRegByName(Name, Reg);
   return Reg;
----------------
plotfi wrote:
> thegameg wrote:
> > Not needed anymore, right?
> True, but I figured why not keep it consistent? I can remove it. 
Isn't `createVirtualRegister` always calling `createIncompleteVirtualRegister`?


Repository:
  rL LLVM

https://reviews.llvm.org/D43916





More information about the llvm-commits mailing list