From 2330e4d4c4f8008d17f5a38ac0d7b04e139d4131 Mon Sep 17 00:00:00 2001 From: Christopher Lamb Date: Sat, 21 Apr 2007 08:16:25 +0000 Subject: add support for alignment attributes on load/store instructions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36301 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bytecode/Reader/Reader.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'lib/Bytecode/Reader') diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 49792693dc..59c69d7c49 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -831,13 +831,31 @@ void BytecodeReader::ParseInstruction(SmallVector &Oprnds, &Idx[0], Idx.size()); break; } - case 62: // volatile load + case 62: { // attributed load + if (Oprnds.size() != 2 || !isa(InstTy)) + error("Invalid attributed load instruction!"); + signed Log2AlignVal = ((Oprnds[1]>>1)-1); + Result = new LoadInst(getValue(iType, Oprnds[0]), "", (Oprnds[1] & 1), + ((Log2AlignVal < 0) ? 0 : 1<(InstTy)) error("Invalid load instruction!"); - Result = new LoadInst(getValue(iType, Oprnds[0]), "", Opcode == 62); + Result = new LoadInst(getValue(iType, Oprnds[0]), ""); break; - case 63: // volatile store + case 63: { // attributed store + if (!isa(InstTy) || Oprnds.size() != 3) + error("Invalid store instruction!"); + + Value *Ptr = getValue(iType, Oprnds[1]); + const Type *ValTy = cast(Ptr->getType())->getElementType(); + signed Log2AlignVal = ((Oprnds[2]>>1)-1); + Result = new StoreInst(getValue(getTypeSlot(ValTy), Oprnds[0]), Ptr, + (Oprnds[2] & 1), + ((Log2AlignVal < 0) ? 0 : 1<(InstTy) || Oprnds.size() != 2) error("Invalid store instruction!"); -- cgit v1.2.3-70-g09d2