[llvm-commits] [llvm] r152105 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
Craig Topper
craig.topper at gmail.com
Tue Mar 6 08:23:20 PST 2012
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.
Sent from my iPhone
On Mar 6, 2012, at 7:57 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>
> On Mar 5, 2012, at 10:04 PM, Craig Topper wrote:
>
>> Author: ctopper
>> Date: Tue Mar 6 00:04:39 2012
>> New Revision: 152105
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=152105&view=rev
>> Log:
>> 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.
>>
>> Modified:
>> llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
>>
>> Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=152105&r1=152104&r2=152105&view=diff
>> ==============================================================================
>> --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
>> +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Tue Mar 6 00:04:39 2012
>> @@ -463,7 +463,7 @@
>> emitRegisterNameString(raw_ostream &O, StringRef AltName,
>> const std::vector<CodeGenRegister*> &Registers) {
>> StringToOffsetTable StringTable;
>> - O << " static const unsigned RegAsmOffset" << AltName << "[] = {\n ";
>> + O << " static const uint16_t RegAsmOffset" << AltName << "[] = {\n ";
>> for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
>> const CodeGenRegister &Reg = *Registers[i];
>
> How does this work with 64k registers?
>
> You are also missing overflow checking.
>
> /jakob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120306/bbddf1a6/attachment.html>
More information about the llvm-commits
mailing list