<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 13, 2013, at 4:32 PM, Jakob Stoklund Olesen <<a href="mailto:stoklund@2pi.dk">stoklund@2pi.dk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>On Aug 13, 2013, at 3:58 PM, Matthias Braun <<a href="mailto:mbraun@apple.com">mbraun@apple.com</a>> wrote:<br><br><blockquote type="cite">MatzeB added you to the CC list for the revision "let tablegen compute maximum lanemask for a regs/regclasses".<br><br>Let tablegen compute the combination of subregister lanemasks for all<br>subregisters in a register/register class. This is preparation for further<br>work subregister allocation<br><br><a href="http://llvm-reviews.chandlerc.com/D1392">http://llvm-reviews.chandlerc.com/D1392</a><br><br>Files:<br>include/llvm/Target/TargetRegisterInfo.h<br>utils/TableGen/CodeGenRegisters.cpp<br>utils/TableGen/CodeGenRegisters.h<br>utils/TableGen/RegisterInfoEmitter.cpp<br><br>Index: include/llvm/Target/TargetRegisterInfo.h<br>===================================================================<br>--- include/llvm/Target/TargetRegisterInfo.h<br>+++ include/llvm/Target/TargetRegisterInfo.h<br>@@ -45,6 +45,7 @@<br> const vt_iterator VTs;<br> const uint32_t *SubClassMask;<br> const uint16_t *SuperRegIndices;<br>+  const unsigned LaneMask;<br> const sc_iterator SuperClasses;<br> ArrayRef<MCPhysReg> (*OrderFunc)(const MachineFunction&);<br><br>@@ -194,13 +195,21 @@<br> ArrayRef<MCPhysReg> getRawAllocationOrder(const MachineFunction &MF) const {<br>   return OrderFunc ? OrderFunc(MF) : makeArrayRef(begin(), getNumRegs());<br> }<br>+<br>+  /// return the combination of all lanemasks of register in this class.<br>+  /// The lanemasks of the registers are again the combination of all lanemasks<br>+  /// of their subregisters.<br></blockquote><br>Nits: Capitalize returns, and ‘lane mask’ in two words.<br><br><blockquote type="cite">/// TargetRegisterInfoDesc - Extra information, not in MCRegisterDesc, about<br>/// registers. These are used by codegen, not by MC.<br>struct TargetRegisterInfoDesc {<br> unsigned CostPerUse;          // Extra cost of instructions using register.<br> bool inAllocatableClass;      // Register belongs to an allocatable regclass.<br>+  unsigned LaneMask;            // combination of all subregister lane masks<br>};<br></blockquote><br>This is potentially very expensive - some targets have lots of registers. Do you actually need this?<br></div></blockquote><div>Well at some points live ranges of physical registers are calculated, so having the maximum lane mask for a specific register will be required. Anyway it is easy to switch to an approach where they are lazily compute on the demand by the passes that need them and not being precomputed by tablegen.</div><div><br></div><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><blockquote type="cite">+  // compute lanemask combinations for register classes<br>+  for (size_t c = 0, ce = RegClasses.size(); c != ce; ++c) {<br>+    CodeGenRegisterClass *RegClass = RegClasses[c];<br>+    const CodeGenRegister::Set &Registers = RegClass->getMembers();<br>+    unsigned LaneMask = 0;<br>+    for (CodeGenRegister::Set::iterator R = Registers.begin(),<br>+         RE = Registers.end(); R != RE; ++R) {<br>+      LaneMask |= (*R)->LaneMask;<br>+    }<br>+    RegClass->LaneMask = LaneMask;<br>+  }<br></blockquote><br>Can you use CodeGenRegisterClass::SubClassWithSubReg instead of computing this via the registers?</div></blockquote><div>I wouldn’t get something computed for all register classes that way, would I?</div><div><br></div><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><blockquote type="cite">+    /// combination of the lanemasks of all subregisters<br></blockquote><br>See<span class="Apple-converted-space"> </span><a href="http://llvm.org/docs/CodingStandards.html#commenting">http://llvm.org/docs/CodingStandards.html#commenting</a><br><br>"When writing comments, write them as English prose, which means they should use proper capitalization, punctuation, etc."<br><br>Thanks,<br>/jakob<br></div></blockquote><div>I will incorporate the other points into a new version.</div><div><br></div><div>Greetings,</div><div><span class="Apple-tab-span" style="white-space: pre;">      </span>Matthias</div></div><br></body></html>