Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.251 -> 1.252 --- Log message: PR400: http://llvm.org/PR400 work phase 1. Add attributed load/store instructions for volatile/align to LLVM. --- Diffs of the changes: (+21 -3) Reader.cpp | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.251 llvm/lib/Bytecode/Reader/Reader.cpp:1.252 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.251 Sun Apr 22 00:46:44 2007 +++ llvm/lib/Bytecode/Reader/Reader.cpp Sun Apr 22 14:24:39 2007 @@ -831,13 +831,31 @@ &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!"); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits