diff options
author | Christopher Lamb <christopher.lamb@gmail.com> | 2007-04-22 19:24:39 +0000 |
---|---|---|
committer | Christopher Lamb <christopher.lamb@gmail.com> | 2007-04-22 19:24:39 +0000 |
commit | 43c7f37942a35398fd1e14b22f435f483a0ee863 (patch) | |
tree | 7b5086671d5743f3187e8f8f3bc6d7fe1e507b39 /lib/Bytecode/Reader | |
parent | cb403d69fb620d4df66233d27a6f8c545ce0d0e4 (diff) |
PR400 work phase 1. Add attributed load/store instructions for volatile/align to LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 4cb67c3156..7ac784ecc7 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/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 attributed 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!"); |