From 42ba6b4b8841487dc4ec0f6020f336c3a2cf0699 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 5 Nov 2005 22:08:14 +0000 Subject: Write/read allocation instruction alignment info to .bc files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24203 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bytecode/Writer/Writer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/Bytecode/Writer/Writer.cpp') diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index b1f2634296..d314231828 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -693,6 +693,13 @@ void BytecodeWriter::outputInstruction(const Instruction &I) { assert(Slots[1] != ~0U && "Cast return type unknown?"); if (Slots[1] > MaxOpSlot) MaxOpSlot = Slots[1]; NumOperands++; + } else if (const AllocationInst *AI = dyn_cast(&I)) { + assert(NumOperands == 1 && "Bogus allocation!"); + if (AI->getAlignment()) { + Slots[1] = Log2_32(AI->getAlignment())+1; + if (Slots[1] > MaxOpSlot) MaxOpSlot = Slots[1]; + NumOperands = 2; + } } else if (const GetElementPtrInst *GEP = dyn_cast(&I)) { // We need to encode the type of sequential type indices into their slot # unsigned Idx = 1; -- cgit v1.2.3