[llvm-commits] [llvm] r163185 - in /llvm/trunk: include/llvm/Bitcode/LLVMBitCodes.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp
Sean Silva
silvas at purdue.edu
Tue Sep 4 19:50:05 PDT 2012
Ok. For whatever reason, I was under the impression that the bitcode
backwards compatibility was a bit stronger than that. If you're
planning on removing it, could you leave a FIXME there then saying to
remove it come 3.2?
--Sean Silva
On Tue, Sep 4, 2012 at 9:08 PM, Chad Rosier <mcrosier at apple.com> wrote:
> Thanks for the suggestion, Sean.
>
> Once we have a major release we don't need to maintain backward compatibility in the bitcode, so the _OLD enumeration will eventually be removed. I don't foresee this changing again, but even if it did, _OLD_OLD would be fine as it would eventually be removed.
>
> Chad
>
> On Sep 4, 2012, at 6:05 PM, Sean Silva wrote:
>
>> + CST_CODE_INLINEASM_OLD = 18, // INLINEASM: [sideeffect|alignstack,
>>
>> Words like "old" and "new", in being relative, are generally not good
>> to use in identifier names (e.g. if this ever changes again, then what
>> will it become _OLD_OLD?). `CST_CODE_INLINEASM_PRE_NSDIALECT` or
>> similar would be a better name.
>>
>> --Sean Silva
>>
>> On Tue, Sep 4, 2012 at 8:56 PM, Chad Rosier <mcrosier at apple.com> wrote:
>>> Author: mcrosier
>>> Date: Tue Sep 4 19:56:20 2012
>>> New Revision: 163185
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=163185&view=rev
>>> Log:
>>> [ms-inline asm] Add support for the nsdialect keyword in the Bitcode
>>> Reader/Writer.
>>>
>>> Modified:
>>> llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
>>> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
>>> llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
>>>
>>> Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=163185&r1=163184&r2=163185&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
>>> +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Tue Sep 4 19:56:20 2012
>>> @@ -161,11 +161,14 @@
>>> CST_CODE_CE_INSERTELT = 15, // CE_INSERTELT: [opval, opval, opval]
>>> CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval]
>>> CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred]
>>> - CST_CODE_INLINEASM = 18, // INLINEASM: [sideeffect,asmstr,conststr]
>>> + CST_CODE_INLINEASM_OLD = 18, // INLINEASM: [sideeffect|alignstack,
>>> + // asmstr,conststr]
>>> CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval]
>>> CST_CODE_CE_INBOUNDS_GEP = 20,// INBOUNDS_GEP: [n x operands]
>>> CST_CODE_BLOCKADDRESS = 21, // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#]
>>> - CST_CODE_DATA = 22 // DATA: [n x elements]
>>> + CST_CODE_DATA = 22, // DATA: [n x elements]
>>> + CST_CODE_INLINEASM = 23 // INLINEASM: [sideeffect|alignstack|
>>> + // nsdialect,asmstr,conststr]
>>> };
>>>
>>> /// CastOpcodes - These are values used in the bitcode files to encode which
>>>
>>> Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=163185&r1=163184&r2=163185&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
>>> +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Sep 4 19:56:20 2012
>>> @@ -1245,7 +1245,8 @@
>>> V = ConstantExpr::getICmp(Record[3], Op0, Op1);
>>> break;
>>> }
>>> - case bitc::CST_CODE_INLINEASM: {
>>> + // This maintains backward compatibility, pre-'nsdialect'.
>>> + case bitc::CST_CODE_INLINEASM_OLD: {
>>> if (Record.size() < 2) return Error("Invalid INLINEASM record");
>>> std::string AsmStr, ConstrStr;
>>> bool HasSideEffects = Record[0] & 1;
>>> @@ -1266,6 +1267,30 @@
>>> AsmStr, ConstrStr, HasSideEffects, IsAlignStack);
>>> break;
>>> }
>>> + // This version adds support for the 'nsdialect' keyword.
>>> + case bitc::CST_CODE_INLINEASM: {
>>> + if (Record.size() < 2) return Error("Invalid INLINEASM record");
>>> + std::string AsmStr, ConstrStr;
>>> + bool HasSideEffects = Record[0] & 1;
>>> + bool IsAlignStack = (Record[0] >> 1) & 1;
>>> + unsigned AsmDialect = Record[0] >> 2;
>>> + unsigned AsmStrSize = Record[1];
>>> + if (2+AsmStrSize >= Record.size())
>>> + return Error("Invalid INLINEASM record");
>>> + unsigned ConstStrSize = Record[2+AsmStrSize];
>>> + if (3+AsmStrSize+ConstStrSize > Record.size())
>>> + return Error("Invalid INLINEASM record");
>>> +
>>> + for (unsigned i = 0; i != AsmStrSize; ++i)
>>> + AsmStr += (char)Record[2+i];
>>> + for (unsigned i = 0; i != ConstStrSize; ++i)
>>> + ConstrStr += (char)Record[3+AsmStrSize+i];
>>> + PointerType *PTy = cast<PointerType>(CurTy);
>>> + V = InlineAsm::get(cast<FunctionType>(PTy->getElementType()),
>>> + AsmStr, ConstrStr, HasSideEffects, IsAlignStack,
>>> + AsmDialect);
>>> + break;
>>> + }
>>> case bitc::CST_CODE_BLOCKADDRESS:{
>>> if (Record.size() < 3) return Error("Invalid CE_BLOCKADDRESS record");
>>> Type *FnTy = getTypeByID(Record[0]);
>>>
>>> Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=163185&r1=163184&r2=163185&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
>>> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Sep 4 19:56:20 2012
>>> @@ -814,7 +814,8 @@
>>>
>>> if (const InlineAsm *IA = dyn_cast<InlineAsm>(V)) {
>>> Record.push_back(unsigned(IA->hasSideEffects()) |
>>> - unsigned(IA->isAlignStack()) << 1);
>>> + unsigned(IA->isAlignStack()) << 1 |
>>> + unsigned(IA->getDialect()&1) << 2);
>>>
>>> // Add the asm string.
>>> const std::string &AsmStr = IA->getAsmString();
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list