From 228344ebece46e7d951a1641aeb1cb15bbfdcbff Mon Sep 17 00:00:00 2001 From: Jonathan Frech Date: Fri, 30 Sep 2022 18:45:04 +0200 Subject: [PATCH] minor --- .../main/scala/effekt/generator/llvm/PrettyPrinter.scala | 9 +++++++-- .../main/scala/effekt/generator/llvm/Transformer.scala | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/effekt/shared/src/main/scala/effekt/generator/llvm/PrettyPrinter.scala b/effekt/shared/src/main/scala/effekt/generator/llvm/PrettyPrinter.scala index b1f7d986b7..c5629fecd5 100644 --- a/effekt/shared/src/main/scala/effekt/generator/llvm/PrettyPrinter.scala +++ b/effekt/shared/src/main/scala/effekt/generator/llvm/PrettyPrinter.scala @@ -26,10 +26,15 @@ define ${show(returnType)} ${globalName(name)}(${commaSeparated(parameters.map(s case Verbatim(content) => content case GlobalVariableArray(name, IntegerType8(), ConstantArray(IntegerType8(), members)) => - val bytes = members.map { ini => ini match { case ConstantInteger8(b) => b; case _ => ??? } } + val bytes = members.map { ini => ini match { + case ConstantInteger8(b) => b + case _ => ??? + }} val escaped = bytes.map(b => "\\" + f"$b%02x").mkString; s"@$name = private constant [${bytes.length} x i8] c\"$escaped\"" - case GlobalVariableArray(name, typ, initializer) => C.abort(s"cannot compile non-i8 constant array: $name = [ x ${typ}] ${initializer}") + + case GlobalVariableArray(name, typ, initializer) => + C.abort(s"cannot compile non-i8 constant array: $name = [ x ${typ}] ${initializer}") } def show(basicBlock: BasicBlock)(using Context): LLVMString = basicBlock match { diff --git a/effekt/shared/src/main/scala/effekt/generator/llvm/Transformer.scala b/effekt/shared/src/main/scala/effekt/generator/llvm/Transformer.scala index 3e3ad507ba..39de12fbf7 100644 --- a/effekt/shared/src/main/scala/effekt/generator/llvm/Transformer.scala +++ b/effekt/shared/src/main/scala/effekt/generator/llvm/Transformer.scala @@ -284,7 +284,7 @@ object Transformer { val res = positiveType val args = List(ConstantInt(utf8.size), LocalReference(PointerType(IntegerType8()), s"$bind.lit.decayed")) - val argsT = List(IntegerType64(), PointerType(IntegerType8())) // TODO: argsT = args.map { ??? } + val argsT = List(IntegerType64(), PointerType(IntegerType8())) emit(Call(bind, res, ConstantGlobal(FunctionType(res, argsT), "c_buffer_construct"), args)) eraseValues(List(v), freeVariables(rest)); @@ -671,5 +671,4 @@ object Transformer { def setStackPointer(stackPointer: Operand)(using C: BlockContext) = C.stackPointer = stackPointer; - }