};
MemoryInst : MALLOC Types {
- $$ = new MallocInst(PointerType::get(*$2));
+ $$ = new MallocInst(*$2);
delete $2;
}
| MALLOC Types ',' UINT ValueRef {
- const Type *Ty = PointerType::get(*$2);
- $$ = new MallocInst(Ty, getVal($4, $5));
+ $$ = new MallocInst(*$2, getVal($4, $5));
delete $2;
}
| ALLOCA Types {
- $$ = new AllocaInst(PointerType::get(*$2));
+ $$ = new AllocaInst(*$2);
delete $2;
}
| ALLOCA Types ',' UINT ValueRef {
- const Type *Ty = PointerType::get(*$2);
- Value *ArrSize = getVal($4, $5);
- $$ = new AllocaInst(Ty, ArrSize);
+ $$ = new AllocaInst(*$2, getVal($4, $5));
delete $2;
}
| FREE ResolvedVal {
if (CallInst *CI = dyn_cast<CallInst>(I)) {
if (CI->getCalledValue() == MallocFunc) { // Replace call to malloc?
- const Type *PtrSByte = PointerType::get(Type::SByteTy);
Value *Source = CI->getOperand(1);
// If no prototype was provided for malloc, we may need to cast the
Source = new CastInst(Source, Type::UIntTy, "MallocAmtCast", BI);
std::string Name(CI->getName()); CI->setName("");
- BI = new MallocInst(PtrSByte, Source, Name, BI);
+ BI = new MallocInst(Type::SByteTy, Source, Name, BI);
CI->replaceAllUsesWith(BI);
BIL.erase(I);
Changed = true;