summaryrefslogtreecommitdiff
path: root/src/passes/InstrumentMemory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/InstrumentMemory.cpp')
-rw-r--r--src/passes/InstrumentMemory.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/passes/InstrumentMemory.cpp b/src/passes/InstrumentMemory.cpp
index 4db409c10..10574350b 100644
--- a/src/passes/InstrumentMemory.cpp
+++ b/src/passes/InstrumentMemory.cpp
@@ -78,13 +78,12 @@ struct InstrumentMemory : public WalkerPass<PostWalker<InstrumentMemory>> {
void visitLoad(Load* curr) {
id++;
Builder builder(*getModule());
- curr->ptr =
- builder.makeCall(load_ptr,
- {builder.makeConst(Literal(int32_t(id))),
- builder.makeConst(Literal(int32_t(curr->bytes))),
- builder.makeConst(Literal(int32_t(curr->offset.addr))),
- curr->ptr},
- Type::i32);
+ curr->ptr = builder.makeCall(load_ptr,
+ {builder.makeConst(int32_t(id)),
+ builder.makeConst(int32_t(curr->bytes)),
+ builder.makeConst(int32_t(curr->offset.addr)),
+ curr->ptr},
+ Type::i32);
Name target;
switch (curr->type.getSingle()) {
case Type::i32:
@@ -103,19 +102,18 @@ struct InstrumentMemory : public WalkerPass<PostWalker<InstrumentMemory>> {
return; // TODO: other types, unreachable, etc.
}
replaceCurrent(builder.makeCall(
- target, {builder.makeConst(Literal(int32_t(id))), curr}, curr->type));
+ target, {builder.makeConst(int32_t(id)), curr}, curr->type));
}
void visitStore(Store* curr) {
id++;
Builder builder(*getModule());
- curr->ptr =
- builder.makeCall(store_ptr,
- {builder.makeConst(Literal(int32_t(id))),
- builder.makeConst(Literal(int32_t(curr->bytes))),
- builder.makeConst(Literal(int32_t(curr->offset.addr))),
- curr->ptr},
- Type::i32);
+ curr->ptr = builder.makeCall(store_ptr,
+ {builder.makeConst(int32_t(id)),
+ builder.makeConst(int32_t(curr->bytes)),
+ builder.makeConst(int32_t(curr->offset.addr)),
+ curr->ptr},
+ Type::i32);
Name target;
switch (curr->value->type.getSingle()) {
case Type::i32:
@@ -133,10 +131,8 @@ struct InstrumentMemory : public WalkerPass<PostWalker<InstrumentMemory>> {
default:
return; // TODO: other types, unreachable, etc.
}
- curr->value =
- builder.makeCall(target,
- {builder.makeConst(Literal(int32_t(id))), curr->value},
- curr->value->type);
+ curr->value = builder.makeCall(
+ target, {builder.makeConst(int32_t(id)), curr->value}, curr->value->type);
}
void visitModule(Module* curr) {