[llvm] r252395 - [Bitcode] Add enums for call instruction markers and flags. NFC.
Akira Hatanaka via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 6 18:48:49 PST 2015
Author: ahatanak
Date: Fri Nov 6 20:48:49 2015
New Revision: 252395
URL: http://llvm.org/viewvc/llvm-project?rev=252395&view=rev
Log:
[Bitcode] Add enums for call instruction markers and flags. NFC.
This commit adds enums in LLVMBitCodes.h to improve readability and
maintainability. This is a follow-up to r252368 which was discussed
here:
http://reviews.llvm.org/D12923
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=252395&r1=252394&r2=252395&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
+++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Fri Nov 6 20:48:49 2015
@@ -335,6 +335,15 @@ enum { BITCODE_CURRENT_EPOCH = 0 };
SYNCHSCOPE_CROSSTHREAD = 1
};
+ /// Markers and flags for call instruction.
+ enum CallMarkersFlags {
+ CALL_TAIL = 0,
+ CALL_CCONV = 1,
+ CALL_MUSTTAIL = 14,
+ CALL_EXPLICIT_TYPE = 15,
+ CALL_NOTAIL = 16
+ };
+
// The function body block (FUNCTION_BLOCK_ID) describes function bodies. It
// can contain a constant block (CONSTANTS_BLOCK_ID).
enum FunctionCodes {
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=252395&r1=252394&r2=252395&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Nov 6 20:48:49 2015
@@ -4946,7 +4946,7 @@ std::error_code BitcodeReader::parseFunc
unsigned CCInfo = Record[OpNum++];
FunctionType *FTy = nullptr;
- if (CCInfo >> 15 & 1 &&
+ if (CCInfo >> bitc::CALL_EXPLICIT_TYPE & 1 &&
!(FTy = dyn_cast<FunctionType>(getTypeByID(Record[OpNum++]))))
return error("Explicit call type is not a function type");
@@ -4996,13 +4996,13 @@ std::error_code BitcodeReader::parseFunc
OperandBundles.clear();
InstructionList.push_back(I);
cast<CallInst>(I)->setCallingConv(
- static_cast<CallingConv::ID>((0x7ff & CCInfo) >> 1));
+ static_cast<CallingConv::ID>((0x7ff & CCInfo) >> bitc::CALL_CCONV));
CallInst::TailCallKind TCK = CallInst::TCK_None;
- if (CCInfo & 1)
+ if (CCInfo & 1 << bitc::CALL_TAIL)
TCK = CallInst::TCK_Tail;
- if (CCInfo & (1 << 14))
+ if (CCInfo & (1 << bitc::CALL_MUSTTAIL))
TCK = CallInst::TCK_MustTail;
- if (CCInfo & (1 << 16))
+ if (CCInfo & (1 << bitc::CALL_NOTAIL))
TCK = CallInst::TCK_NoTail;
cast<CallInst>(I)->setTailCallKind(TCK);
cast<CallInst>(I)->setAttributes(PAL);
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=252395&r1=252394&r2=252395&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Fri Nov 6 20:48:49 2015
@@ -2130,9 +2130,11 @@ static void WriteInstruction(const Instr
Code = bitc::FUNC_CODE_INST_CALL;
Vals.push_back(VE.getAttributeID(CI.getAttributes()));
- Vals.push_back((CI.getCallingConv() << 1) | unsigned(CI.isTailCall()) |
- unsigned(CI.isMustTailCall()) << 14 | 1 << 15 |
- unsigned(CI.isNoTailCall()) << 16);
+ Vals.push_back(CI.getCallingConv() << bitc::CALL_CCONV |
+ unsigned(CI.isTailCall()) << bitc::CALL_TAIL |
+ unsigned(CI.isMustTailCall()) << bitc::CALL_MUSTTAIL |
+ 1 << bitc::CALL_EXPLICIT_TYPE |
+ unsigned(CI.isNoTailCall()) << bitc::CALL_NOTAIL);
Vals.push_back(VE.getTypeID(FTy));
PushValueAndType(CI.getCalledValue(), InstID, Vals, VE); // Callee
More information about the llvm-commits
mailing list