LLVMConstant.st
changeset 50 dbda820d4d24
parent 16 23e82cf19788
child 55 41b3437f1fc7
--- a/LLVMConstant.st	Wed Oct 07 06:10:55 2015 +0100
+++ b/LLVMConstant.st	Mon Oct 12 20:52:13 2015 +0100
@@ -59,6 +59,57 @@
 "
 ! !
 
+!LLVMConstant class methodsFor:'assertions'!
+
+assertIsType: type
+    <resource: #skipInDebuggersWalkBack>
+
+    self assert: type isLLVMType message: 'value is not an LLVMType'.
+
+    "Created: / 10-08-2015 / 06:26:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-09-2015 / 11:09:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 17-09-2015 / 16:51:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+assertIsValue: value
+    <resource: #skipInDebuggersWalkBack>
+
+    self assert: value isLLVMValue message: 'value is not an LLVMValue'.
+
+    "Created: / 08-08-2015 / 03:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-09-2015 / 11:09:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+assertIsValue: value ofKind: kind
+    <resource: #skipInDebuggersWalkBack>
+
+    self assert: value isLLVMValue message: 'value is not an LLVMValue'.
+    self assert: value type kind = kind message: 'value has incorrect kind'
+
+    "Created: / 10-08-2015 / 17:40:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-09-2015 / 11:09:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+assertIsValue: value ofType: type
+    <resource: #skipInDebuggersWalkBack>
+
+    self assert: value isLLVMValue message: 'value is not an LLVMValue'.
+    self assert: value type = type message: 'value has incorrect type'
+
+    "Created: / 08-08-2015 / 02:49:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-09-2015 / 11:09:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!LLVMConstant class methodsFor:'constants - construction'!
+
+bitcast: value to: type
+    self assertIsValue: value.
+    self assertIsType: type.
+    ^ LLVM ConstBitCast: value _: type.
+
+    "Created: / 12-10-2015 / 16:11:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !LLVMConstant class methodsFor:'constants - int - signed'!
 
 sint16:value