#include "llvm/ADT/StringExtras.h"
#include <algorithm>
#include <set>
+#include <iostream>
using namespace llvm;
// Provide a command-line option to aggregate function arguments into a struct
if (AggregateArgs) {
std::vector<Value*> Indices;
Indices.push_back(Constant::getNullValue(Type::UIntTy));
- Indices.push_back(ConstantUInt::get(Type::UIntTy, i));
+ Indices.push_back(ConstantInt::get(Type::UIntTy, i));
std::string GEPname = "gep_" + inputs[i]->getName();
TerminatorInst *TI = newFunction->begin()->getTerminator();
GetElementPtrInst *GEP = new GetElementPtrInst(AI, Indices, GEPname, TI);
for (unsigned i = 0, e = inputs.size(); i != e; ++i) {
std::vector<Value*> Indices;
Indices.push_back(Constant::getNullValue(Type::UIntTy));
- Indices.push_back(ConstantUInt::get(Type::UIntTy, i));
+ Indices.push_back(ConstantInt::get(Type::UIntTy, i));
GetElementPtrInst *GEP =
new GetElementPtrInst(Struct, Indices,
"gep_" + StructValues[i]->getName());
if (AggregateArgs) {
std::vector<Value*> Indices;
Indices.push_back(Constant::getNullValue(Type::UIntTy));
- Indices.push_back(ConstantUInt::get(Type::UIntTy, FirstOut + i));
+ Indices.push_back(ConstantInt::get(Type::UIntTy, FirstOut + i));
GetElementPtrInst *GEP
= new GetElementPtrInst(Struct, Indices,
"gep_reload_" + outputs[i]->getName());
// Now we can emit a switch statement using the call as a value.
SwitchInst *TheSwitch =
- new SwitchInst(ConstantUInt::getNullValue(Type::UShortTy),
+ new SwitchInst(ConstantInt::getNullValue(Type::UShortTy),
codeReplacer, 0, codeReplacer);
// Since there may be multiple exits from the original region, make the new
case 0:
case 1: break; // No value needed.
case 2: // Conditional branch, return a bool
- brVal = SuccNum ? ConstantBool::False : ConstantBool::True;
+ brVal = ConstantBool::get(!SuccNum);
break;
default:
- brVal = ConstantUInt::get(Type::UShortTy, SuccNum);
+ brVal = ConstantInt::get(Type::UShortTy, SuccNum);
break;
}
ReturnInst *NTRet = new ReturnInst(brVal, NewTarget);
// Update the switch instruction.
- TheSwitch->addCase(ConstantUInt::get(Type::UShortTy, SuccNum),
+ TheSwitch->addCase(ConstantInt::get(Type::UShortTy, SuccNum),
OldTarget);
// Restore values just before we exit
if (AggregateArgs) {
std::vector<Value*> Indices;
Indices.push_back(Constant::getNullValue(Type::UIntTy));
- Indices.push_back(ConstantUInt::get(Type::UIntTy,FirstOut+out));
+ Indices.push_back(ConstantInt::get(Type::UIntTy,FirstOut+out));
GetElementPtrInst *GEP =
new GetElementPtrInst(OAI, Indices,
"gep_" + outputs[out]->getName(),