translator: add division to types
This commit is contained in:
@@ -18,6 +18,9 @@ class LLVMBooleanType() : LLVMType() {
|
|||||||
override fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMBooleanType(), "add nsw i1 $firstOp, $secondOp")
|
LLVMExpression(LLVMBooleanType(), "add nsw i1 $firstOp, $secondOp")
|
||||||
|
|
||||||
|
override fun operatorDiv(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
|
LLVMExpression(LLVMBooleanType(), "sdiv i1 $firstOp, $secondOp")
|
||||||
|
|
||||||
override fun operatorLt(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorLt(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMBooleanType(), "icmp slt i1 $firstOp, $secondOp")
|
LLVMExpression(LLVMBooleanType(), "icmp slt i1 $firstOp, $secondOp")
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ class LLVMDoubleType() : LLVMType() {
|
|||||||
override fun operatorInc(firstOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorInc(firstOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMDoubleType(), "fadd double $firstOp, 1.0")
|
LLVMExpression(LLVMDoubleType(), "fadd double $firstOp, 1.0")
|
||||||
|
|
||||||
|
override fun operatorDiv(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
|
LLVMExpression(LLVMDoubleType(), "fdiv double $firstOp, 1.0")
|
||||||
|
|
||||||
override fun operatorDec(firstOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorDec(firstOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMDoubleType(), "fsub double $firstOp, 1.0")
|
LLVMExpression(LLVMDoubleType(), "fsub double $firstOp, 1.0")
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ class LLVMFloatType() : LLVMType() {
|
|||||||
override fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMFloatType(), "fadd float $firstOp, $secondOp")
|
LLVMExpression(LLVMFloatType(), "fadd float $firstOp, $secondOp")
|
||||||
|
|
||||||
|
override fun operatorDiv(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
|
LLVMExpression(LLVMFloatType(), "fdiv float $firstOp, 1.0")
|
||||||
|
|
||||||
override fun operatorInc(firstOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorInc(firstOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMDoubleType(), "fadd float $firstOp, 1.0")
|
LLVMExpression(LLVMDoubleType(), "fadd float $firstOp, 1.0")
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ class LLVMIntType() : LLVMType() {
|
|||||||
override fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMIntType(), "add nsw i32 $firstOp, $secondOp")
|
LLVMExpression(LLVMIntType(), "add nsw i32 $firstOp, $secondOp")
|
||||||
|
|
||||||
|
override fun operatorDiv(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
|
LLVMExpression(LLVMIntType(), "sdiv i32 $firstOp, $secondOp")
|
||||||
|
|
||||||
override fun operatorInc(firstOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorInc(firstOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMIntType(), "add nsw i32 $firstOp, 1")
|
LLVMExpression(LLVMIntType(), "add nsw i32 $firstOp, 1")
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ class LLVMLongType() : LLVMType() {
|
|||||||
override fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMLongType(), "add nsw i64 $firstOp, $secondOp")
|
LLVMExpression(LLVMLongType(), "add nsw i64 $firstOp, $secondOp")
|
||||||
|
|
||||||
|
override fun operatorDiv(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
|
LLVMExpression(LLVMLongType(), "sdiv i64 $firstOp, $secondOp")
|
||||||
|
|
||||||
override fun operatorLt(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorLt(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMBooleanType(), "icmp slt i64 $firstOp, $secondOp")
|
LLVMExpression(LLVMBooleanType(), "icmp slt i64 $firstOp, $secondOp")
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ class LLVMShortType() : LLVMType() {
|
|||||||
override fun operatorMod(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
override fun operatorMod(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
LLVMExpression(LLVMShortType(), "srem i16 $firstOp, $secondOp")
|
LLVMExpression(LLVMShortType(), "srem i16 $firstOp, $secondOp")
|
||||||
|
|
||||||
|
override fun operatorDiv(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression =
|
||||||
|
LLVMExpression(LLVMShortType(), "sdiv i16 $firstOp, $secondOp")
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return other is LLVMShortType
|
return other is LLVMShortType
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ abstract class LLVMType() : Cloneable {
|
|||||||
open fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
open fun operatorPlus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
||||||
open fun operatorTimes(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
open fun operatorTimes(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
||||||
open fun operatorMinus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
open fun operatorMinus(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
||||||
|
open fun operatorDiv(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
||||||
open fun operatorLt(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
open fun operatorLt(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
||||||
open fun operatorGt(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
open fun operatorGt(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
||||||
open fun operatorLeq(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
open fun operatorLeq(firstOp: LLVMSingleValue, secondOp: LLVMSingleValue): LLVMExpression = throw UnimplementedException()
|
||||||
|
|||||||
Reference in New Issue
Block a user