--- a/LLVMDWARFEncoding.st Mon Feb 08 19:02:53 2016 +0000
+++ b/LLVMDWARFEncoding.st Fri Feb 12 11:50:22 2016 +0000
@@ -163,5 +163,12 @@
^LLVM_DW_ATE_unsigned_fixed
! !
+!LLVMDWARFEncoding class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
LLVMDWARFEncoding initialize!
--- a/LLVMExamples.st Mon Feb 08 19:02:53 2016 +0000
+++ b/LLVMExamples.st Fri Feb 12 11:50:22 2016 +0000
@@ -562,5 +562,33 @@
"Created: / 14-08-2015 / 06:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 06-02-2016 / 15:28:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+example8_data_at_fixed_address
+ "
+ Creates a function that returns an int value at fixed address
+ (known at compilation time)
+ "
+
+ | module
+ functionType function asm glb val |
+
+ module := LLVMModule newWithName: testSelector.
+
+ functionType := LLVMType function: { } returning: LLVMType int32.
+ function := module addFunctionNamed: 'test' type: functionType.
+
+ asm := function builder.
+ glb := asm int: (LLVMConstant uintptr: 1234) toPtr: LLVMType int32 pointer.
+ val := asm load: (asm gep: glb at: #(1)).
+ asm ret: val.
+
+ self halt.
+ "
+ LLVMExamples new example8_data_at_fixed_address
+ "
+
+ "Created: / 11-02-2016 / 20:15:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 11:11:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
--- a/LLVMIRBuilder.st Mon Feb 08 19:02:53 2016 +0000
+++ b/LLVMIRBuilder.st Fri Feb 12 11:50:22 2016 +0000
@@ -343,6 +343,42 @@
^ LLVM BuildBitCast: self _: value _: type _: name.
"Created: / 12-10-2015 / 18:36:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+int: value toPtr: type
+ ^ self int: value toPtr: type as: ''
+
+ "Created: / 11-02-2016 / 20:35:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+int: value toPtr: type as: name
+ self assertIsIntegerValue: value.
+ self assertIsType: type.
+ self assert: type isPointerType description: 'Type is not an pointer type'.
+ self assertIsString: name.
+
+ ^ LLVM BuildIntToPtr: self _: value _: type _: name.
+
+ "Created: / 11-02-2016 / 20:39:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+ptr: value toInt: type
+ ^ self ptr: value toInt: type as: ''
+
+ "Created: / 11-02-2016 / 20:40:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+ptr: value toInt: type as: name
+ self assertIsValue: value.
+ self assert: value type isPointerType description: 'Value is not of an pointer type'.
+ self assertIsType: type.
+ self assert: type isIntegerType description: 'Type is not an integer type'.
+ self assertIsString: name.
+
+ ^ LLVM BuildPtrToInt: self _: value _: type _: name.
+
+ "Created: / 11-02-2016 / 20:40:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2016 / 11:55:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMIRBuilder methodsFor:'instructions - memory'!
@@ -433,6 +469,23 @@
^ LLVM BuildCall: self _: function _: argumentsArray _: argumentsSize _: name
"Created: / 10-08-2015 / 18:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+select: condition then: then else: else
+ ^ self select: condition then: then else: else as: ''
+
+ "Created: / 09-02-2016 / 20:39:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+select: cond then: then else: else as: name
+
+ self assertIsValue: cond ofType: LLVMType int1.
+ self assertIsValueOfSameType: then as: else.
+ self assertIsString: name.
+
+ ^ LLVM BuildSelect: self _: cond _: then _: else _: name.
+
+ "Created: / 09-02-2016 / 20:40:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMIRBuilder methodsFor:'instructions - terminators'!
--- a/LLVMObject.st Mon Feb 08 19:02:53 2016 +0000
+++ b/LLVMObject.st Fri Feb 12 11:50:22 2016 +0000
@@ -304,6 +304,18 @@
"Modified: / 14-09-2015 / 11:09:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+assertIsIntegerValue:value
+ <resource: #skipInDebuggersWalkBack>
+
+ | type |
+
+ self assertIsValue: value.
+ type := value type.
+ self assert:(type isIntegerType) message: 'Value is not of an integer type'
+
+ "Created: / 11-02-2016 / 20:36:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
assertIsMetadata: value
<resource: #skipInDebuggersWalkBack>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LLVMTypeFloatingPoint.st Fri Feb 12 11:50:22 2016 +0000
@@ -0,0 +1,63 @@
+"
+ Copyright (C) 2015-now Jan Vrany
+
+ This code is not an open-source (yet). You may use this code
+ for your own experiments and projects, given that:
+
+ * all modification to the code will be sent to the
+ original author for inclusion in future releases
+ * this is not used in any commercial software
+
+ This license is provisional and may (will) change in
+ a future.
+"
+"{ Package: 'jv:llvm_s' }"
+
+"{ NameSpace: Smalltalk }"
+
+LLVMTypeScalar subclass:#LLVMTypeFloatingPoint
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'LLVM-S-Core-Types'
+!
+
+!LLVMTypeFloatingPoint class methodsFor:'documentation'!
+
+copyright
+"
+ Copyright (C) 2015-now Jan Vrany
+
+ This code is not an open-source (yet). You may use this code
+ for your own experiments and projects, given that:
+
+ * all modification to the code will be sent to the
+ original author for inclusion in future releases
+ * this is not used in any commercial software
+
+ This license is provisional and may (will) change in
+ a future.
+"
+! !
+
+!LLVMTypeFloatingPoint class methodsFor:'queries'!
+
+isAbstract
+ "Return if this class is an abstract class.
+ True is returned here for myself only; false for subclasses.
+ Abstract subclasses must redefine again."
+
+ ^ self == LLVMTypeFloatingPoint.
+! !
+
+!LLVMTypeFloatingPoint methodsFor:'converting'!
+
+vector: numberOfElements
+ "Create a fixed-size vector whose elements are of type of receiver."
+
+ self assertIsIntegerUnsigned: numberOfElements.
+ ^ LLVM VectorType: self _: numberOfElements
+
+ "Created: / 13-08-2015 / 18:59:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+