mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-06 17:24:34 +00:00
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
This commit is contained in:
@ -902,27 +902,33 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
|
||||
if (CallingConv) cast<InvokeInst>(Result)->setCallingConv(CallingConv);
|
||||
break;
|
||||
}
|
||||
case Instruction::Malloc:
|
||||
if (Oprnds.size() > 2)
|
||||
case Instruction::Malloc: {
|
||||
unsigned Align = 0;
|
||||
if (Oprnds.size() == 2)
|
||||
Align = (1 << Oprnds[1]) >> 1;
|
||||
else if (Oprnds.size() > 2)
|
||||
error("Invalid malloc instruction!");
|
||||
if (!isa<PointerType>(InstTy))
|
||||
error("Invalid malloc instruction!");
|
||||
|
||||
Result = new MallocInst(cast<PointerType>(InstTy)->getElementType(),
|
||||
Oprnds.size() ? getValue(Type::UIntTyID,
|
||||
Oprnds[0]) : 0);
|
||||
getValue(Type::UIntTyID, Oprnds[0]), Align);
|
||||
break;
|
||||
}
|
||||
|
||||
case Instruction::Alloca:
|
||||
if (Oprnds.size() > 2)
|
||||
case Instruction::Alloca: {
|
||||
unsigned Align = 0;
|
||||
if (Oprnds.size() == 2)
|
||||
Align = (1 << Oprnds[1]) >> 1;
|
||||
else if (Oprnds.size() > 2)
|
||||
error("Invalid alloca instruction!");
|
||||
if (!isa<PointerType>(InstTy))
|
||||
error("Invalid alloca instruction!");
|
||||
|
||||
Result = new AllocaInst(cast<PointerType>(InstTy)->getElementType(),
|
||||
Oprnds.size() ? getValue(Type::UIntTyID,
|
||||
Oprnds[0]) :0);
|
||||
getValue(Type::UIntTyID, Oprnds[0]), Align);
|
||||
break;
|
||||
}
|
||||
case Instruction::Free:
|
||||
if (!isa<PointerType>(InstTy))
|
||||
error("Invalid free instruction!");
|
||||
|
Reference in New Issue
Block a user