From 85349aca42b0aa47b57f7786234f01b38aba39e8 Mon Sep 17 00:00:00 2001 From: Etienne Wodey Date: Tue, 5 Mar 2024 18:23:53 +0100 Subject: [PATCH] SimpleModule: make entry point function name configurable. Signed-off-by: Etienne Wodey --- pyqir/pyqir/_simple.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyqir/pyqir/_simple.py b/pyqir/pyqir/_simple.py index 256754c9..b2d00ef5 100644 --- a/pyqir/pyqir/_simple.py +++ b/pyqir/pyqir/_simple.py @@ -32,6 +32,7 @@ def __init__( num_qubits: int, num_results: int, context: Optional[Context] = None, + entrypoint_name: str = "main", ) -> None: """ Initializes a simple module. @@ -40,6 +41,7 @@ def __init__( :param str num_qubits: The number of statically allocated qubits. :param int num_results: The number of statically allocated results. :param Optional[Context] context: The LLVM context. + :param str entrypoint_name: The name of the entry point function. """ if context is None: @@ -57,7 +59,9 @@ def __init__( self._num_qubits = num_qubits self._num_results = num_results - entry_point = pyqir.entry_point(self._module, "main", num_qubits, num_results) + entry_point = pyqir.entry_point( + self._module, entrypoint_name, num_qubits, num_results + ) self._builder.insert_at_end(BasicBlock(context, "entry", entry_point)) @property