#include "llvm/Transforms/IPO/MutateStructTypes.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
-#include "llvm/Function.h"
-#include "llvm/BasicBlock.h"
-#include "llvm/GlobalVariable.h"
#include "llvm/SymbolTable.h"
#include "llvm/iPHINode.h"
#include "llvm/iMemory.h"
#include "llvm/iTerminators.h"
#include "llvm/iOther.h"
-#include "llvm/Argument.h"
#include "llvm/Constants.h"
#include "Support/STLExtras.h"
-#include "Support/StatisticReporter.h"
+#include "Support/Statistic.h"
#include <algorithm>
-#include <iostream>
+
using std::map;
using std::vector;
// Memory Instructions
case Instruction::Alloca:
NewI =
- new AllocaInst(ConvertType(I.getType()),
+ new MallocInst(
+ ConvertType(cast<PointerType>(I.getType())->getElementType()),
I.getNumOperands() ? ConvertValue(I.getOperand(0)) :0);
break;
case Instruction::Malloc:
NewI =
- new MallocInst(ConvertType(I.getType()),
+ new MallocInst(
+ ConvertType(cast<PointerType>(I.getType())->getElementType()),
I.getNumOperands() ? ConvertValue(I.getOperand(0)) :0);
break;
break;
case Instruction::Load:
- assert(cast<MemAccessInst>(I).idx_begin() ==
- cast<MemAccessInst>(I).idx_end() &&
- "Indexing loads not supported!");
NewI = new LoadInst(ConvertValue(I.getOperand(0)));
break;
case Instruction::Store:
- assert(cast<MemAccessInst>(I).idx_begin() ==
- cast<MemAccessInst>(I).idx_end() &&
- "Indexing loads not supported!");
NewI = new StoreInst(ConvertValue(I.getOperand(0)),
ConvertValue(I.getOperand(1)));
break;