llvm.org GIT mirror llvm / a37dd3e
Bitcode support for allocas with arbitrary array size types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104915 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
2 changed file(s) with 11 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
21772177 InstructionList.push_back(I);
21782178 break;
21792179 }
2180 case bitc::FUNC_CODE_INST_ALLOCA: { // ALLOCA: [instty, op, align]
2181 if (Record.size() < 3)
2180 case bitc::FUNC_CODE_INST_ALLOCA: { // ALLOCA: [instty, opty, op, align]
2181 // For backward compatibility, tolerate a lack of an opty, and use i32.
2182 // LLVM 3.0: Remove this.
2183 if (Record.size() < 3 || Record.size() > 4)
21822184 return Error("Invalid ALLOCA record");
2185 unsigned OpNum = 0;
21832186 const PointerType *Ty =
2184 dyn_cast_or_null(getTypeByID(Record[0]));
2185 Value *Size = getFnValueByID(Record[1], Type::getInt32Ty(Context));
2186 unsigned Align = Record[2];
2187 dyn_cast_or_null(getTypeByID(Record[OpNum++]));
2188 const Type *OpTy = Record.size() == 4 ? getTypeByID(Record[OpNum++]) :
2189 Type::getInt32Ty(Context);
2190 Value *Size = getFnValueByID(Record[OpNum++], OpTy);
2191 unsigned Align = Record[OpNum++];
21872192 if (!Ty || !Size) return Error("Invalid ALLOCA record");
21882193 I = new AllocaInst(Ty->getElementType(), Size, (1 << Align) >> 1);
21892194 InstructionList.push_back(I);
11131113 case Instruction::Alloca:
11141114 Code = bitc::FUNC_CODE_INST_ALLOCA;
11151115 Vals.push_back(VE.getTypeID(I.getType()));
1116 Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
11161117 Vals.push_back(VE.getValueID(I.getOperand(0))); // size.
11171118 Vals.push_back(Log2_32(cast(I).getAlignment())+1);
11181119 break;