diff options
| author | Stefan Weigl-Bosker <stefan@s00.xyz> | 2026-02-19 18:51:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-19 18:51:48 -0500 |
| commit | c2d4209f85f46cc91163bc47cc43db252c94acf6 (patch) | |
| tree | 8d7f73ce6c3c89863418382d8d553a06c668bbb3 /willow/lib/IR/IRBuilder.cpp | |
| parent | d11fbc8268f5775ad783f8570478daad4a9e81cf (diff) | |
| download | compiler-c2d4209f85f46cc91163bc47cc43db252c94acf6.tar.gz | |
[willow]: more cleanup, tests (#12)
Diffstat (limited to 'willow/lib/IR/IRBuilder.cpp')
| -rw-r--r-- | willow/lib/IR/IRBuilder.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/willow/lib/IR/IRBuilder.cpp b/willow/lib/IR/IRBuilder.cpp index 62e7a98..ab62082 100644 --- a/willow/lib/IR/IRBuilder.cpp +++ b/willow/lib/IR/IRBuilder.cpp @@ -2,7 +2,7 @@ namespace willow { -AddInst *IRBuilder::BuildAdd(Type type, Value *lhs, Value *rhs, +AddInst *IRBuilder::buildAdd(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new AddInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -11,7 +11,7 @@ AddInst *IRBuilder::BuildAdd(Type type, Value *lhs, Value *rhs, return inst; } -MulInst *IRBuilder::BuildMul(Type type, Value *lhs, Value *rhs, +MulInst *IRBuilder::buildMul(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new MulInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -20,7 +20,7 @@ MulInst *IRBuilder::BuildMul(Type type, Value *lhs, Value *rhs, return inst; } -SubInst *IRBuilder::BuildSub(Type type, Value *lhs, Value *rhs, +SubInst *IRBuilder::buildSub(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new SubInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -29,7 +29,7 @@ SubInst *IRBuilder::BuildSub(Type type, Value *lhs, Value *rhs, return inst; } -DivInst *IRBuilder::BuildDiv(Type type, Value *lhs, Value *rhs, +DivInst *IRBuilder::buildDiv(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new DivInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -38,7 +38,7 @@ DivInst *IRBuilder::BuildDiv(Type type, Value *lhs, Value *rhs, return inst; } -ModInst *IRBuilder::BuildMod(Type type, Value *lhs, Value *rhs, +ModInst *IRBuilder::buildMod(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new ModInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -47,7 +47,7 @@ ModInst *IRBuilder::BuildMod(Type type, Value *lhs, Value *rhs, return inst; } -ShlInst *IRBuilder::BuildShl(Type type, Value *lhs, Value *rhs, +ShlInst *IRBuilder::buildShl(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new ShlInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -56,7 +56,7 @@ ShlInst *IRBuilder::BuildShl(Type type, Value *lhs, Value *rhs, return inst; } -ShrInst *IRBuilder::BuildShr(Type type, Value *lhs, Value *rhs, +ShrInst *IRBuilder::buildShr(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new ShrInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -65,7 +65,7 @@ ShrInst *IRBuilder::BuildShr(Type type, Value *lhs, Value *rhs, return inst; } -AshlInst *IRBuilder::BuildAshl(Type type, Value *lhs, Value *rhs, +AshlInst *IRBuilder::buildAshl(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new AshlInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -74,7 +74,7 @@ AshlInst *IRBuilder::BuildAshl(Type type, Value *lhs, Value *rhs, return inst; } -AshrInst *IRBuilder::BuildAshr(Type type, Value *lhs, Value *rhs, +AshrInst *IRBuilder::buildAshr(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new AshrInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -83,7 +83,7 @@ AshrInst *IRBuilder::BuildAshr(Type type, Value *lhs, Value *rhs, return inst; } -EqInst *IRBuilder::BuildEq(Value *lhs, Value *rhs, +EqInst *IRBuilder::buildEq(Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new EqInst{ctx.types().IntType(1), lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -92,7 +92,7 @@ EqInst *IRBuilder::BuildEq(Value *lhs, Value *rhs, return inst; } -LtInst *IRBuilder::BuildLt(Value *lhs, Value *rhs, +LtInst *IRBuilder::buildLt(Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new LtInst{ctx.types().IntType(1), lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -101,7 +101,7 @@ LtInst *IRBuilder::BuildLt(Value *lhs, Value *rhs, return inst; } -GtInst *IRBuilder::BuildGt(Value *lhs, Value *rhs, +GtInst *IRBuilder::buildGt(Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new GtInst{ctx.types().IntType(1), lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -110,7 +110,7 @@ GtInst *IRBuilder::BuildGt(Value *lhs, Value *rhs, return inst; } -LeInst *IRBuilder::BuildLe(Value *lhs, Value *rhs, +LeInst *IRBuilder::buildLe(Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new LeInst{ctx.types().IntType(1), lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -119,7 +119,7 @@ LeInst *IRBuilder::BuildLe(Value *lhs, Value *rhs, return inst; } -GeInst *IRBuilder::BuildGe(Value *lhs, Value *rhs, +GeInst *IRBuilder::buildGe(Value *lhs, Value *rhs, std::optional<Location> loc) { auto *inst = new GeInst{ctx.types().IntType(1), lhs, rhs, loc}; insert_point->insertAfter(*inst); @@ -128,33 +128,33 @@ GeInst *IRBuilder::BuildGe(Value *lhs, Value *rhs, return inst; } -AndInst *IRBuilder::BuildAnd(Value *lhs, Value *rhs, +AndInst *IRBuilder::buildAnd(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { - auto *inst = new AndInst{ctx.types().IntType(1), lhs, rhs, loc}; + auto *inst = new AndInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); insert_point++; return inst; } -OrInst *IRBuilder::BuildOr(Value *lhs, Value *rhs, +OrInst *IRBuilder::buildOr(Type type, Value *lhs, Value *rhs, std::optional<Location> loc) { - auto *inst = new OrInst{ctx.types().IntType(1), lhs, rhs, loc}; + auto *inst = new OrInst{type, lhs, rhs, loc}; insert_point->insertAfter(*inst); insert_point++; return inst; } -NotInst *IRBuilder::BuildNot(Value *val, std::optional<Location> loc) { - auto *inst = new NotInst{ctx.types().IntType(1), val, loc}; +NotInst *IRBuilder::buildNot(Type type, Value *val, std::optional<Location> loc) { + auto *inst = new NotInst{type, val, loc}; insert_point->insertAfter(*inst); insert_point++; return inst; } -JmpInst *IRBuilder::BuildJmp(BasicBlock *dst, std::optional<Location> loc) { +JmpInst *IRBuilder::buildJmp(BasicBlock *dst, std::optional<Location> loc) { auto *inst = new JmpInst{ctx.types().VoidType(), dst, loc}; insert_point->insertAfter(*inst); @@ -163,7 +163,7 @@ JmpInst *IRBuilder::BuildJmp(BasicBlock *dst, std::optional<Location> loc) { return inst; } -BrInst *IRBuilder::BuildBr(Value *predicate, BasicBlock *truedst, +BrInst *IRBuilder::buildBr(Value *predicate, BasicBlock *truedst, BasicBlock *falsedst, std::optional<Location> loc) { auto *inst = new BrInst{ctx.types().VoidType(), predicate, truedst, falsedst, loc}; @@ -173,14 +173,14 @@ BrInst *IRBuilder::BuildBr(Value *predicate, BasicBlock *truedst, return inst; } -RetInst *IRBuilder::BuildRet(Value *val, std::optional<Location> loc) { +RetInst *IRBuilder::buildRet(Value *val, std::optional<Location> loc) { auto *inst = new RetInst{ctx.types().VoidType(), val, loc}; insert_point->insertAfter(*inst); insert_point++; return inst; } -RetInst *IRBuilder::BuildRet(std::optional<Location> loc) { +RetInst *IRBuilder::buildRet(std::optional<Location> loc) { auto *inst = new RetInst{ctx.types().VoidType(), loc}; insert_point->insertAfter(*inst); insert_point++; @@ -188,7 +188,7 @@ RetInst *IRBuilder::BuildRet(std::optional<Location> loc) { return inst; } -PhiInst *IRBuilder::BuildPhi( +PhiInst *IRBuilder::buildPhi( Type ty, std::initializer_list<std::pair<BasicBlock *, Value *>> args, std::optional<Location> loc) { auto *inst = new PhiInst(ty, args, loc); @@ -198,7 +198,7 @@ PhiInst *IRBuilder::BuildPhi( return inst; } -AllocaInst *IRBuilder::BuildAlloca(Type ty, std::optional<Location> loc) { +AllocaInst *IRBuilder::buildAlloca(Type ty, std::optional<Location> loc) { Type pty = ctx.types().PtrType(ty); auto *inst = new AllocaInst(pty, loc); insert_point->insertAfter(*inst); |