You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -235,7 +230,7 @@ one to the other. Both blocks consist (only) of calls to [QIS
235
230
functions](#quantum-instruction-set). Any number of such calls may be performed.
236
231
To be compatible with the Base Profile the called functions must return void.
237
232
Any arguments to invoke them must be inlined into the call itself; they must be
238
-
constants or pointers of type `%Qubit*` or `%Result*`.
233
+
constants or pointers of type `ptr`.
239
234
240
235
The only difference between these two blocks is that the first one contains only
241
236
calls to functions that are *not* marked as irreversible by an attribute on the
@@ -268,8 +263,8 @@ must satisfy the following three requirements:
268
263
with an custom function attribute named `irreversible`. The use of
269
264
[attributes](#attributes) in general is outlined in the corresponding section.
270
265
271
-
- Parameters of type `%Result*`must be `writeonly` parameters; only the runtime
272
-
function `__quantum__rt__result_record_output` used for [output
266
+
- Parameters of type `ptr` identifying results must be `writeonly` parameters;
267
+
only the runtime function `__quantum__rt__result_record_output` used for [output
273
268
recording](#output-recording) may read a measurement result.
274
269
275
270
For more information about the relation between a profile specification and the
@@ -289,8 +284,8 @@ within a Base Profile compliant program:
289
284
|`call`| Used within a basic block to invoke any one of the declared QIS functions and runtime functions. | May optionally be preceded by a [`tail` marker](https://llvm.org/docs/LangRef.html#call-instruction). |
290
285
|`br`| Used to branch from one basic block to another. | The branching must be unconditional and occurs as the final instruction of a block to jump to the next one. |
291
286
|`ret`| Used to return the exit code of the program. | Must occur (only) as the last instruction of the final block in an entry point. |
292
-
|`inttoptr`| Used to cast an `i64` integer value to either a `%Qubit*` or a `%Result*`.| May be used as part of a function call only. |
293
-
|`getelementptr inbounds`| Used to create an `i8*` to pass a constant string for the purpose of labeling an output value. | May be used as part of a call to an output recording function only. |
287
+
|`inttoptr`| Used to cast an `i64` integer value to a `ptr`. | May be used as part of a function call only. |
288
+
|`getelementptr inbounds`| Used to create a `ptr` to pass a constant string for the purpose of labeling an output value.| May be used as part of a call to an output recording function only. |
294
289
295
290
See also the section on [data types and values](#data-types-and-values) for more
296
291
information about the creation and usage of LLVM values.
|__quantum__rt__initialize |`void(i8*)`| Initializes the execution environment. Sets all qubits to a zero-state if they are not dynamically managed. |
307
-
|__quantum__rt__tuple_record_output |`void(i64, i8*)`| Inserts a marker in the generated output that indicates the start of a tuple and how many tuple elements it has. The second parameter defines a string label for the tuple. Depending on the output schema, the label is included in the output or omitted. |
308
-
|__quantum__rt__array_record_output |`void(i64, i8*)`| Inserts a marker in the generated output that indicates the start of an array and how many array elements it has. The second parameter defines a string label for the array. Depending on the output schema, the label is included in the output or omitted. |
309
-
|__quantum__rt__result_record_output |`void(%Result*, i8*)`| Adds a measurement result to the generated output. The second parameter defines a string label for the result value. Depending on the output schema, the label is included in the output or omitted. |
301
+
|__quantum__rt__initialize |`void(ptr)`| Initializes the execution environment. Sets all qubits to a zero-state if they are not dynamically managed. |
302
+
|__quantum__rt__tuple_record_output |`void(i64, ptr)`| Inserts a marker in the generated output that indicates the start of a tuple and how many tuple elements it has. The second parameter defines a string label for the tuple. Depending on the output schema, the label is included in the output or omitted. |
303
+
|__quantum__rt__array_record_output |`void(i64, ptr)`| Inserts a marker in the generated output that indicates the start of an array and how many array elements it has. The second parameter defines a string label for the array. Depending on the output schema, the label is included in the output or omitted. |
304
+
|__quantum__rt__result_record_output |`void(ptr, ptr)`| Adds a measurement result to the generated output. The second parameter defines a string label for the result value. Depending on the output schema, the label is included in the output or omitted. |
310
305
311
306
### Initialization
312
307
@@ -324,7 +319,7 @@ to the runtime functions ending in `record_output` listed in the table
324
319
contained within the final block of an entry point function, i.e. the block that
325
320
terminates in a return instruction.
326
321
327
-
For all output recording functions, the `i8*` argument must be a non-null
322
+
For all output recording functions, the `ptr` argument must be a non-null
328
323
pointer to a global constant that contains a null-terminated string. A unique
329
324
string must be used for each call to an output recording function within the
330
325
same entry point. A backend may ignore that argument depending on the [output
@@ -357,15 +352,15 @@ of type `i64` in particular may be used as part of calls to output recording
357
352
functions; see the section on [output recording](#output-recording) for more
358
353
details.
359
354
360
-
The `%Qubit*` and `%Result*` data types must be supported by all backends.
355
+
The `ptr` data types must be supported by all backends.
361
356
Qubits and results can occur only as arguments in function calls and are
362
-
represented as a pointer of type`%Qubit*` and `%Result*` respectively, where
357
+
represented as a pointer type, where
363
358
the pointer itself identifies the qubit or result value rather than a memory
364
359
location where the value is stored: a 64-bit integer constant is cast to the
365
360
appropriate pointer type. A more detailed elaboration on the purpose of this
366
361
representation is given in the next subsection. The integer constant that is
367
-
cast must be in the interval `[0, numQubits)` for `%Qubit*` and `[0,
368
-
numResults)` for `%Result*`, where `numQubits` and `numResults` are the required
362
+
cast must be in the interval `[0, numQubits)` for qubits and `[0,
363
+
numResults)` for results, where `numQubits` and `numResults` are the required
369
364
number of qubits and results defined by the corresponding [entry point
370
365
attributes](#attributes). Since backends may look at the values of the
371
366
`required_num_qubits` and `required_num_results` attributes to determine whether
@@ -505,8 +500,8 @@ major and minor version of the specification that the QIR bitcode adheres to.
505
500
506
501
### Memory Management
507
502
508
-
Each bitcode file contains the information whether pointers of type `%Qubit*`
509
-
and `%Result*` point to a valid memory location, or whether a pointer merely
503
+
Each bitcode file contains the information whether instances of `ptr` used for
504
+
qubits and results point to a valid memory location, or whether a pointer merely
510
505
encodes an integer constant that identifies which qubit or result the value
511
506
refers to. This information is represented in the form of the two module flags
512
507
named `"dynamic_qubit_management"` and `"dynamic_result_management"`. Within the
0 commit comments