Skip to content

Commit

Permalink
SimpleModule: make entry point function name configurable.
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Wodey <[email protected]>
  • Loading branch information
airwoodix committed Mar 5, 2024
1 parent caecc47 commit 85349ac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyqir/pyqir/_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 85349ac

Please sign in to comment.