Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrech committed Sep 30, 2022
1 parent a07065b commit 228344e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -671,5 +671,4 @@ object Transformer {

def setStackPointer(stackPointer: Operand)(using C: BlockContext) =
C.stackPointer = stackPointer;

}

0 comments on commit 228344e

Please sign in to comment.