summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2007-04-21 08:16:25 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2007-04-21 08:16:25 +0000
commitbff50208c8622fbcf8c8fdaac61ff81670de1423 (patch)
treeab39674971382d5bb5d26ac2f3eef372113d986d /llvm/lib/Bytecode/Reader
parent64995e1b3f9311c8a44af06e4bd1d8d49c4dc862 (diff)
downloadbcm5719-llvm-bff50208c8622fbcf8c8fdaac61ff81670de1423.tar.gz
bcm5719-llvm-bff50208c8622fbcf8c8fdaac61ff81670de1423.zip
add support for alignment attributes on load/store instructions
llvm-svn: 36301
Diffstat (limited to 'llvm/lib/Bytecode/Reader')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index 49792693dcc..59c69d7c496 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/lib/Bytecode/Reader/Reader.cpp
@@ -831,13 +831,31 @@ void BytecodeReader::ParseInstruction(SmallVector<unsigned, 8> &Oprnds,
&Idx[0], Idx.size());
break;
}
- case 62: // volatile load
+ case 62: { // attributed load
+ if (Oprnds.size() != 2 || !isa<PointerType>(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<<Log2AlignVal));
+ break;
+ }
case Instruction::Load:
if (Oprnds.size() != 1 || !isa<PointerType>(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<PointerType>(InstTy) || Oprnds.size() != 3)
+ error("Invalid store instruction!");
+
+ Value *Ptr = getValue(iType, Oprnds[1]);
+ const Type *ValTy = cast<PointerType>(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<<Log2AlignVal));
+ break;
+ }
case Instruction::Store: {
if (!isa<PointerType>(InstTy) || Oprnds.size() != 2)
error("Invalid store instruction!");
OpenPOWER on IntegriCloud