<html><head></head><body bgcolor="#FFFFFF"><div>It might not work with 64k registers. I didn't make the change to use one long string literal. I just exploited the C++ restriction that a string literal cant contain more 64K characters. I'll add asserts since that restriction might only be a warning.<br><br>Sent from my iPhone</div><div><br>On Mar 6, 2012, at 7:57 AM, Jakob Stoklund Olesen <<a href="mailto:stoklund@2pi.dk">stoklund@2pi.dk</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><br><div><div>On Mar 5, 2012, at 10:04 PM, Craig Topper wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">Author: ctopper<br>Date: Tue Mar  6 00:04:39 2012<br>New Revision: 152105<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=152105&view=rev">http://llvm.org/viewvc/llvm-project?rev=152105&view=rev</a><br>Log:<br>Use uint16_t to store indices into string table since C++ only allows 64K string literals so the index into the big string can never be larger than that.<br><br>Modified:<br>   llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp<br><br>Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=152105&r1=152104&r2=152105&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=152105&r1=152104&r2=152105&view=diff</a><br>==============================================================================<br>--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)<br>+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Tue Mar  6 00:04:39 2012<br>@@ -463,7 +463,7 @@<br>emitRegisterNameString(raw_ostream &O, StringRef AltName,<br>  const std::vector<CodeGenRegister*> &Registers) {<br>  StringToOffsetTable StringTable;<br>-  O << "  static const unsigned RegAsmOffset" << AltName << "[] = {\n    ";<br>+  O << "  static const uint16_t RegAsmOffset" << AltName << "[] = {\n    ";<br>  for (unsigned i = 0, e = Registers.size(); i != e; ++i) {<br>    const CodeGenRegister &Reg = *Registers[i];<br></span></span></blockquote></div><br><div>How does this work with 64k registers?</div><div><br></div><div>You are also missing overflow checking.</div><div><br></div><div>/jakob</div><div><br></div></div></blockquote></body></html>