Merge pull request #68 from davipo/master
Fix corrupted text and example in section 7.3 of docs / source / doc / kaleidoscope
This commit is contained in:
commit
777eea719c
2 changed files with 335 additions and 334 deletions
|
|
@ -121,8 +121,8 @@ to talk about how LLVM represents stack variables.
|
||||||
In LLVM, all memory accesses are explicit with load/store instructions,
|
In LLVM, all memory accesses are explicit with load/store instructions,
|
||||||
and it is carefully designed not to have (or need) an "address-of"
|
and it is carefully designed not to have (or need) an "address-of"
|
||||||
operator. Notice how the type of the @G/@H global variables is actually
|
operator. Notice how the type of the @G/@H global variables is actually
|
||||||
"i32\ *" even though the variable is defined as "i32". What this means
|
"i32\*" even though the variable is defined as "i32". What this means
|
||||||
is that @G defines* space* for an i32 in the global data area, but its
|
is that @G defines *space* for an i32 in the global data area, but its
|
||||||
*name* actually refers to the address for that space. Stack variables
|
*name* actually refers to the address for that space. Stack variables
|
||||||
work the same way, except that instead of being declared with global
|
work the same way, except that instead of being declared with global
|
||||||
variable definitions, they are declared with the `LLVM alloca
|
variable definitions, they are declared with the `LLVM alloca
|
||||||
|
|
@ -133,11 +133,11 @@ instruction <http://www.llvm.org/docs/LangRef.html#i_alloca>`_:
|
||||||
|
|
||||||
define i32 @example() {
|
define i32 @example() {
|
||||||
entry:
|
entry:
|
||||||
%X = alloca i32 ; type of %X is i32 *.
|
%X = alloca i32 ; type of %X is i32*
|
||||||
...
|
...
|
||||||
%tmp = load i32* %X ; load the stack value %X from the stack.
|
%tmp = load i32* %X ; load the stack value %X from the stack
|
||||||
%tmp2 = add i32 %tmp, 1 ; increment it store i32 %tmp2,
|
%tmp2 = add i32 %tmp, 1 ; increment it
|
||||||
i32* %X ; store it back
|
store i32 %tmp2, i32* %X ; store it back
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,334 +26,335 @@ some examples:
|
||||||
|
|
||||||
tr = Type.float()
|
tr = Type.float()
|
||||||
|
|
||||||
r1 = Constant.real(tr, "3.141592") # create from a string r2 =
|
r1 = Constant.real(tr, "3.141592") # create from a string
|
||||||
Constant.real(tr, 1.61803399) # create from a Python float {%
|
r2 = Constant.real(tr, 1.61803399) # create from a Python float
|
||||||
endhighlight %}
|
|
||||||
|
|
||||||
# llvm.core.Constant
|
# llvm.core.Constant
|
||||||
- This will become a table of contents (this text will be scraped).
|
- This will become a table of contents (this text will be scraped).
|
||||||
{:toc}
|
{:toc}
|
||||||
|
|
||||||
Static factory methods
|
|
||||||
----------------------
|
Static factory methods
|
||||||
|
----------------------
|
||||||
``null(ty)``
|
|
||||||
~~~~~~~~~~~~
|
``null(ty)``
|
||||||
|
~~~~~~~~~~~~
|
||||||
A null value (all zeros) of type ``ty``
|
|
||||||
|
A null value (all zeros) of type ``ty``
|
||||||
``all_ones(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~
|
``all_ones(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~
|
||||||
All 1's value of type ``ty``
|
|
||||||
|
All 1's value of type ``ty``
|
||||||
``undef(ty)``
|
|
||||||
~~~~~~~~~~~~~
|
``undef(ty)``
|
||||||
|
~~~~~~~~~~~~~
|
||||||
An undefined value of type ``ty``
|
|
||||||
|
An undefined value of type ``ty``
|
||||||
``int(ty, value)``
|
|
||||||
~~~~~~~~~~~~~~~~~~
|
``int(ty, value)``
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
Integer of type ``ty``, with value ``value`` (a Python int or long)
|
|
||||||
|
Integer of type ``ty``, with value ``value`` (a Python int or long)
|
||||||
``int_signextend(ty, value)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
``int_signextend(ty, value)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Integer of signed type ``ty`` (use for signed types)
|
|
||||||
|
Integer of signed type ``ty`` (use for signed types)
|
||||||
``real(ty, value)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~
|
``real(ty, value)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~
|
||||||
Floating point value of type ``ty``, with value ``value`` (a Python
|
|
||||||
float)
|
Floating point value of type ``ty``, with value ``value`` (a Python
|
||||||
|
float)
|
||||||
``stringz(value)``
|
|
||||||
~~~~~~~~~~~~~~~~~~
|
``stringz(value)``
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
A null-terminated string. ``value`` is a Python string
|
|
||||||
|
A null-terminated string. ``value`` is a Python string
|
||||||
``string(value)``
|
|
||||||
~~~~~~~~~~~~~~~~~
|
``string(value)``
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
As ``string(ty)``, but not null terminated
|
|
||||||
|
As ``string(ty)``, but not null terminated
|
||||||
``array(ty, consts)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~
|
``array(ty, consts)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
Array of type ``ty``, initialized with ``consts`` (an iterable yielding
|
|
||||||
``Constant`` objects of the appropriate type)
|
Array of type ``ty``, initialized with ``consts`` (an iterable yielding
|
||||||
|
``Constant`` objects of the appropriate type)
|
||||||
``struct(ty, consts)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
``struct(ty, consts)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Struct (unpacked) of type ``ty``, initialized with ``consts`` (an
|
|
||||||
iterable yielding ``Constant`` objects of the appropriate type)
|
Struct (unpacked) of type ``ty``, initialized with ``consts`` (an
|
||||||
|
iterable yielding ``Constant`` objects of the appropriate type)
|
||||||
``packed_struct(ty, consts)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
``packed_struct(ty, consts)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
As ``struct(ty, consts)`` but packed
|
|
||||||
|
As ``struct(ty, consts)`` but packed
|
||||||
``vector(consts)``
|
|
||||||
~~~~~~~~~~~~~~~~~~
|
``vector(consts)``
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
Vector, initialized with ``consts`` (an iterable yielding ``Constant``
|
|
||||||
objects of the appropriate type)
|
Vector, initialized with ``consts`` (an iterable yielding ``Constant``
|
||||||
|
objects of the appropriate type)
|
||||||
``sizeof(ty)``
|
|
||||||
~~~~~~~~~~~~~~
|
``sizeof(ty)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Constant value representing the sizeof the type ``ty``
|
|
||||||
|
Constant value representing the sizeof the type ``ty``
|
||||||
Methods
|
|
||||||
-------
|
Methods
|
||||||
|
-------
|
||||||
The following operations on constants are supported. For more details on
|
|
||||||
any operation, consult the `Constant
|
The following operations on constants are supported. For more details on
|
||||||
Expressions <http://www.llvm.org/docs/LangRef.html#constantexprs>`_
|
any operation, consult the `Constant
|
||||||
section of the LLVM Language Reference.
|
Expressions <http://www.llvm.org/docs/LangRef.html#constantexprs>`_
|
||||||
|
section of the LLVM Language Reference.
|
||||||
``k.neg()``
|
|
||||||
~~~~~~~~~~~
|
``k.neg()``
|
||||||
|
~~~~~~~~~~~
|
||||||
negation, same as ``0 - k``
|
|
||||||
|
negation, same as ``0 - k``
|
||||||
``k.not_()``
|
|
||||||
~~~~~~~~~~~~
|
``k.not_()``
|
||||||
|
~~~~~~~~~~~~
|
||||||
1's complement of ``k``. Note trailing underscore.
|
|
||||||
|
1's complement of ``k``. Note trailing underscore.
|
||||||
``k.add(k2)``
|
|
||||||
~~~~~~~~~~~~~
|
``k.add(k2)``
|
||||||
|
~~~~~~~~~~~~~
|
||||||
``k + k2``, where ``k`` and ``k2`` are integers.
|
|
||||||
|
``k + k2``, where ``k`` and ``k2`` are integers.
|
||||||
``k.fadd(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.fadd(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
``k + k2``, where ``k`` and ``k2`` are floating-point.
|
|
||||||
|
``k + k2``, where ``k`` and ``k2`` are floating-point.
|
||||||
``k.sub(k2)``
|
|
||||||
~~~~~~~~~~~~~
|
``k.sub(k2)``
|
||||||
|
~~~~~~~~~~~~~
|
||||||
``k - k2``, where ``k`` and ``k2`` are integers.
|
|
||||||
|
``k - k2``, where ``k`` and ``k2`` are integers.
|
||||||
``k.fsub(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.fsub(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
``k - k2``, where ``k`` and ``k2`` are floating-point.
|
|
||||||
|
``k - k2``, where ``k`` and ``k2`` are floating-point.
|
||||||
``k.mul(k2)``
|
|
||||||
~~~~~~~~~~~~~
|
``k.mul(k2)``
|
||||||
|
~~~~~~~~~~~~~
|
||||||
``k * k2``, where ``k`` and ``k2`` are integers.
|
|
||||||
|
``k * k2``, where ``k`` and ``k2`` are integers.
|
||||||
``k.fmul(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.fmul(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
``k * k2``, where ``k`` and ``k2`` are floating-point.
|
|
||||||
|
``k * k2``, where ``k`` and ``k2`` are floating-point.
|
||||||
``k.udiv(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.udiv(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Quotient of unsigned division of ``k`` with ``k2``
|
|
||||||
|
Quotient of unsigned division of ``k`` with ``k2``
|
||||||
``k.sdiv(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.sdiv(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Quotient of signed division of ``k`` with ``k2``
|
|
||||||
|
Quotient of signed division of ``k`` with ``k2``
|
||||||
``k.fdiv(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.fdiv(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Quotient of floating point division of ``k`` with ``k2``
|
|
||||||
|
Quotient of floating point division of ``k`` with ``k2``
|
||||||
``k.urem(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.urem(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Reminder of unsigned division of ``k`` with ``k2``
|
|
||||||
|
Reminder of unsigned division of ``k`` with ``k2``
|
||||||
``k.srem(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.srem(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Reminder of signed division of ``k`` with ``k2``
|
|
||||||
|
Reminder of signed division of ``k`` with ``k2``
|
||||||
``k.frem(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.frem(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Reminder of floating point division of ``k`` with ``k2``
|
|
||||||
|
Reminder of floating point division of ``k`` with ``k2``
|
||||||
``k.and_(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.and_(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Bitwise and of ``k`` and ``k2``. Note trailing underscore.
|
|
||||||
|
Bitwise and of ``k`` and ``k2``. Note trailing underscore.
|
||||||
``k.or_(k2)``
|
|
||||||
~~~~~~~~~~~~~
|
``k.or_(k2)``
|
||||||
|
~~~~~~~~~~~~~
|
||||||
Bitwise or of ``k`` and ``k2``. Note trailing underscore.
|
|
||||||
|
Bitwise or of ``k`` and ``k2``. Note trailing underscore.
|
||||||
``k.xor(k2)``
|
|
||||||
~~~~~~~~~~~~~
|
``k.xor(k2)``
|
||||||
|
~~~~~~~~~~~~~
|
||||||
Bitwise exclusive-or of ``k`` and ``k2``.
|
|
||||||
|
Bitwise exclusive-or of ``k`` and ``k2``.
|
||||||
``k.icmp(icmp, k2)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
``k.icmp(icmp, k2)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
Compare ``k`` with ``k2`` using the predicate ``icmp``. See
|
|
||||||
`here <comparision.html#icmp>`_ for list of predicates for integer
|
Compare ``k`` with ``k2`` using the predicate ``icmp``. See
|
||||||
operands.
|
`here <comparision.html#icmp>`_ for list of predicates for integer
|
||||||
|
operands.
|
||||||
``k.fcmp(fcmp, k2)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
``k.fcmp(fcmp, k2)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
Compare ``k`` with ``k2`` using the predicate ``fcmp``. See
|
|
||||||
`here <comparision.html#fcmp>`_ for list of predicates for real
|
Compare ``k`` with ``k2`` using the predicate ``fcmp``. See
|
||||||
operands.
|
`here <comparision.html#fcmp>`_ for list of predicates for real
|
||||||
|
operands.
|
||||||
``k.shl(k2)``
|
|
||||||
~~~~~~~~~~~~~
|
``k.shl(k2)``
|
||||||
|
~~~~~~~~~~~~~
|
||||||
Shift ``k`` left by ``k2`` bits.
|
|
||||||
|
Shift ``k`` left by ``k2`` bits.
|
||||||
``k.lshr(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.lshr(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Shift ``k`` logically right by ``k2`` bits (new bits are 0s).
|
|
||||||
|
Shift ``k`` logically right by ``k2`` bits (new bits are 0s).
|
||||||
``k.ashr(k2)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.ashr(k2)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Shift ``k`` arithmetically right by ``k2`` bits (new bits are same as
|
|
||||||
previous sign bit).
|
Shift ``k`` arithmetically right by ``k2`` bits (new bits are same as
|
||||||
|
previous sign bit).
|
||||||
``k.gep(indices)``
|
|
||||||
~~~~~~~~~~~~~~~~~~
|
``k.gep(indices)``
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
GEP, see `LLVM docs <http://www.llvm.org/docs/GetElementPtr.html>`_.
|
|
||||||
|
GEP, see `LLVM docs <http://www.llvm.org/docs/GetElementPtr.html>`_.
|
||||||
``k.trunc(ty)``
|
|
||||||
~~~~~~~~~~~~~~~
|
``k.trunc(ty)``
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
Truncate ``k`` to a type ``ty`` of lower bitwidth.
|
|
||||||
|
Truncate ``k`` to a type ``ty`` of lower bitwidth.
|
||||||
``k.sext(ty)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.sext(ty)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Sign extend ``k`` to a type ``ty`` of higher bitwidth, while extending
|
|
||||||
the sign bit.
|
Sign extend ``k`` to a type ``ty`` of higher bitwidth, while extending
|
||||||
|
the sign bit.
|
||||||
``k.zext(ty)``
|
|
||||||
~~~~~~~~~~~~~~
|
``k.zext(ty)``
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
Sign extend ``k`` to a type ``ty`` of higher bitwidth, all new bits are
|
|
||||||
0s.
|
Sign extend ``k`` to a type ``ty`` of higher bitwidth, all new bits are
|
||||||
|
0s.
|
||||||
``k.fptrunc(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~~
|
``k.fptrunc(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
Truncate floating point constant ``k`` to floating point type ``ty`` of
|
|
||||||
lower size than k's.
|
Truncate floating point constant ``k`` to floating point type ``ty`` of
|
||||||
|
lower size than k's.
|
||||||
``k.fpext(ty)``
|
|
||||||
~~~~~~~~~~~~~~~
|
``k.fpext(ty)``
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
Extend floating point constant ``k`` to floating point type ``ty`` of
|
|
||||||
higher size than k's.
|
Extend floating point constant ``k`` to floating point type ``ty`` of
|
||||||
|
higher size than k's.
|
||||||
``k.uitofp(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~
|
``k.uitofp(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~
|
||||||
Convert an unsigned integer constant ``k`` to floating point constant of
|
|
||||||
type ``ty``.
|
Convert an unsigned integer constant ``k`` to floating point constant of
|
||||||
|
type ``ty``.
|
||||||
``k.sitofp(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~
|
``k.sitofp(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~
|
||||||
Convert a signed integer constant ``k`` to floating point constant of
|
|
||||||
type ``ty``.
|
Convert a signed integer constant ``k`` to floating point constant of
|
||||||
|
type ``ty``.
|
||||||
``k.fptoui(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~
|
``k.fptoui(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~
|
||||||
Convert a floating point constant ``k`` to an unsigned integer constant
|
|
||||||
of type ``ty``.
|
Convert a floating point constant ``k`` to an unsigned integer constant
|
||||||
|
of type ``ty``.
|
||||||
``k.fptosi(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~
|
``k.fptosi(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~
|
||||||
Convert a floating point constant ``k`` to a signed integer constant of
|
|
||||||
type ``ty``.
|
Convert a floating point constant ``k`` to a signed integer constant of
|
||||||
|
type ``ty``.
|
||||||
``k.ptrtoint(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~~~
|
``k.ptrtoint(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
Convert a pointer constant ``k`` to an integer constant of type ``ty``.
|
|
||||||
|
Convert a pointer constant ``k`` to an integer constant of type ``ty``.
|
||||||
``k.inttoptr(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~~~
|
``k.inttoptr(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
Convert an integer constant ``k`` to a pointer constant of type ``ty``.
|
|
||||||
|
Convert an integer constant ``k`` to a pointer constant of type ``ty``.
|
||||||
``k.bitcast(ty)``
|
|
||||||
~~~~~~~~~~~~~~~~~
|
``k.bitcast(ty)``
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
Convert ``k`` to a (equal-width) constant of type ``ty``.
|
|
||||||
|
Convert ``k`` to a (equal-width) constant of type ``ty``.
|
||||||
``k.select(cond,k2,k3)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
``k.select(cond,k2,k3)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Replace value with ``k2`` if the 1-bit integer constant ``cond`` is 1,
|
|
||||||
else with ``k3``.
|
Replace value with ``k2`` if the 1-bit integer constant ``cond`` is 1,
|
||||||
|
else with ``k3``.
|
||||||
``k.extract_element(idx)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
``k.extract_element(idx)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Extract value at ``idx`` (integer constant) from a vector constant
|
|
||||||
``k``.
|
Extract value at ``idx`` (integer constant) from a vector constant
|
||||||
|
``k``.
|
||||||
``k.insert_element(k2,idx)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
``k.insert_element(k2,idx)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Insert value ``k2`` (scalar constant) at index ``idx`` (integer
|
|
||||||
constant) of vector constant ``k``.
|
Insert value ``k2`` (scalar constant) at index ``idx`` (integer
|
||||||
|
constant) of vector constant ``k``.
|
||||||
``k.shuffle_vector(k2,mask)``
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
``k.shuffle_vector(k2,mask)``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Shuffle vector constant ``k`` based on vector constants ``k2`` and
|
|
||||||
``mask``.
|
Shuffle vector constant ``k`` based on vector constants ``k2`` and
|
||||||
|
``mask``.
|
||||||
--------------
|
|
||||||
|
--------------
|
||||||
# Other Constant Classes
|
|
||||||
The following subclasses of ``Constant`` do not provide additional
|
# Other Constant Classes
|
||||||
methods, **they serve only to provide richer type information.**
|
The following subclasses of ``Constant`` do not provide additional
|
||||||
|
methods, **they serve only to provide richer type information.**
|
||||||
Subclass \| LLVM C++ Class \| Remarks \|
|
|
||||||
---------\|----------------\|---------\| ``ConstantExpr`` \|
|
Subclass \| LLVM C++ Class \| Remarks \|
|
||||||
``llvmConstantExpr`` \| A constant expression \|
|
---------\|----------------\|---------\| ``ConstantExpr`` \|
|
||||||
``ConstantAggregateZero``\ \| ``llvmConstantAggregateZero``\ \| All-zero
|
``llvmConstantExpr`` \| A constant expression \|
|
||||||
constant \| ``ConstantInt``\ \| ``llvmConstantInt``\ \| An integer
|
``ConstantAggregateZero``\ \| ``llvmConstantAggregateZero``\ \| All-zero
|
||||||
constant \| ``ConstantFP``\ \| ``llvmConstantFP``\ \| A floating-point
|
constant \| ``ConstantInt``\ \| ``llvmConstantInt``\ \| An integer
|
||||||
constant \| ``ConstantArray``\ \| ``llvmConstantArray``\ \| An array
|
constant \| ``ConstantFP``\ \| ``llvmConstantFP``\ \| A floating-point
|
||||||
constant \| ``ConstantStruct``\ \| ``llvmConstantStruct``\ \| A
|
constant \| ``ConstantArray``\ \| ``llvmConstantArray``\ \| An array
|
||||||
structure constant \| ``ConstantVector``\ \| ``llvmConstantVector``\ \|
|
constant \| ``ConstantStruct``\ \| ``llvmConstantStruct``\ \| A
|
||||||
A vector constant \| ``ConstantPointerNull``\ \|
|
structure constant \| ``ConstantVector``\ \| ``llvmConstantVector``\ \|
|
||||||
``llvmConstantPointerNull``\ \| All-zero pointer constant \|
|
A vector constant \| ``ConstantPointerNull``\ \|
|
||||||
``UndefValue``\ \| ``llvmUndefValue``\ \| corresponds to ``undef`` of
|
``llvmConstantPointerNull``\ \| All-zero pointer constant \|
|
||||||
LLVM IR \|
|
``UndefValue``\ \| ``llvmUndefValue``\ \| corresponds to ``undef`` of
|
||||||
|
LLVM IR \|
|
||||||
These types are helpful in ``isinstance`` checks, like so:
|
|
||||||
|
These types are helpful in ``isinstance`` checks, like so:
|
||||||
{% highlight python %} ti = Type.int(32) k1 = Constant.int(ti, 42) #
|
|
||||||
int32_t k1 = 42; k2 = Constant.array(ti, [k1, k1]) # int32_t k2[] = {
|
{% highlight python %} ti = Type.int(32) k1 = Constant.int(ti, 42) #
|
||||||
k1, k1 };
|
int32_t k1 = 42; k2 = Constant.array(ti, [k1, k1]) # int32_t k2[] = {
|
||||||
|
k1, k1 };
|
||||||
assert isinstance(k1, ConstantInt) assert isinstance(k2, ConstantArray)
|
|
||||||
|
assert isinstance(k1, ConstantInt) assert isinstance(k2, ConstantArray)
|
||||||
|
|
||||||
|
|
||||||
Automatically Generated Documentation
|
Automatically Generated Documentation
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue