Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bruteforceboy committed Nov 13, 2024
1 parent 00d5f11 commit ce67cb9
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,10 @@ cir::AllocaOp findAlloca(mlir::Operation *op) {
return {};
}

mlir::Value createNonPrimitiveValue(mlir::Value Src, mlir::Type Ty,
LowerFunction &LF) {
/// Creates a coerced value from \param Src having a type of \param Ty which is
/// a non primitive type
mlir::Value createCoercedNonPrimitive(mlir::Value Src, mlir::Type Ty,
LowerFunction &LF) {
if (auto Load = mlir::dyn_cast<LoadOp>(Src.getDefiningOp())) {
auto &bld = LF.getRewriter();
auto Addr = Load.getAddr();
Expand Down Expand Up @@ -309,7 +311,8 @@ mlir::Value createNonPrimitiveValue(mlir::Value Src, mlir::Type Ty,

return newLoad;
}
return {};

cir_cconv_unreachable("NYI");
}

/// After the calling convention is lowered, an ABI-agnostic type might have to
Expand All @@ -335,7 +338,7 @@ mlir::Value castReturnValue(mlir::Value Src, mlir::Type Ty, LowerFunction &LF) {

auto intTy = mlir::dyn_cast<IntType>(Ty);
if (intTy && !intTy.isPrimitive())
return createNonPrimitiveValue(Src, Ty, LF);
return createCoercedNonPrimitive(Src, Ty, LF);

llvm::TypeSize DstSize = LF.LM.getDataLayout().getTypeAllocSize(Ty);

Expand Down

0 comments on commit ce67cb9

Please sign in to comment.