LLVMTypeVoid.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 12 Oct 2015 20:52:13 +0100
changeset 50 dbda820d4d24
parent 27 b26354bbff25
child 53 bbf3a88e2358
permissions -rw-r--r--
Support for creating recursive structures. And few inspector enhancements to inspect types...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
    Copyright (C) 2015-now Jan Vrany
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
    This code is not an open-source (yet). You may use this code
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
    for your own experiments and projects, given that:
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
    * all modification to the code will be sent to the
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
      original author for inclusion in future releases
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
    * this is not used in any commercial software
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
    This license is provisional and may (will) change in
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
    a future.
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
"
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
"{ Package: 'jv:llvm_s' }"
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
"{ NameSpace: Smalltalk }"
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
LLVMType subclass:#LLVMTypeVoid
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
	instanceVariableNames:''
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
	classVariableNames:''
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
	poolDictionaries:''
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
	category:'LLVM-S-Core-Types'
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
!
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
!LLVMTypeVoid class methodsFor:'documentation'!
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
copyright
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
"
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
    Copyright (C) 2015-now Jan Vrany
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
    This code is not an open-source (yet). You may use this code
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
    for your own experiments and projects, given that:
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
    * all modification to the code will be sent to the
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
      original author for inclusion in future releases
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
    * this is not used in any commercial software
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
    This license is provisional and may (will) change in
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
    a future.
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
"
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
! !
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
50
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    43
!LLVMTypeVoid methodsFor:'accessing'!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    44
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    45
sizeInBits
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    46
    "For integer, pointer, FP  types, return the size in bits. For all 
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    47
     other types, throw an LLVMTypeError.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    48
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    49
     LLVMType int32 sizeInBits -> 32
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    50
     LLVMType int1 sizeInBits  -> 1
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    51
    "
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    52
    ^ 0
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    53
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    54
    "Created: / 12-10-2015 / 18:27:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    55
! !
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    56
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    57
!LLVMTypeVoid methodsFor:'converting'!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    58
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    59
array: numberOfElements
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    60
    "Create a fixed-size array whose elements are of type of receiver
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    61
     `LLVMType int8 array: 13` returns `[ 13 x i8 ]`"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    62
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    63
    self shouldNotImplement
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    64
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    65
    "Created: / 12-10-2015 / 18:28:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    66
!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    67
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    68
pointer
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    69
    "Return a pointer to the type represented by the receiver.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    70
     `LLVMType int32 pointer` returns int32_t*"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    71
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    72
    self shouldNotImplement
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    73
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    74
    "Created: / 12-10-2015 / 18:27:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    75
!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    76
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    77
vector: numberOfElements
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    78
    "Create a fixed-size vector whose elements are of type of receiver."
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    79
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    80
   self shouldNotImplement
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    81
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    82
    "Created: / 12-10-2015 / 18:27:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    83
! !
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 27
diff changeset
    84
27
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
!LLVMTypeVoid methodsFor:'testing'!
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
isVoidType
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
    ^true
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
    "Created: / 13-08-2015 / 16:52:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
! !
b26354bbff25 LLVM type system refactored to use a subclass per kind.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92