Changes On Branch kbk-isBoolean

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch kbk-isBoolean Excluding Merge-Ins

This is equivalent to a diff from 3bf74c48dc to bd009801ca

2018-12-27
04:12
Eliminate the 'isBoolean' instruction in favour of using the type checking machinery check-in: 0718166269 user: kbk tags: trunk
04:09
Eliminate the 'isBoolean' opcode in favour of 'instanceOf', to allow for type inferemce based on tryCvtToBoolean Closed-Leaf check-in: bd009801ca user: kbk tags: kbk-isBoolean
03:53
Open a branch for rework of 'isBoolean' so that it informs type inference check-in: 2a34883328 user: kbk tags: kbk-isBoolean
2018-12-18
15:12
OOPS: remove 'source' of unused file check-in: 3bf74c48dc user: kbk tags: trunk
02:32
Add a long-forgotten 'specializer.md' discussing what the specializer does. check-in: 7bd4d23ac9 user: kbk tags: trunk

Changes to codegen/build.tcl.

4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
    #	An LLVM value reference.

    method invokeExpanded {arguments flags ec {resultName ""}} {
	my ExtractVector $arguments
	my call ${tcl.invoke.expanded} [list $len $ary $flags $ec] $resultName
    }

    # Builder:isBoolean(INT BOOLEAN) --
    #
    #	Test if a value is a boolean. Quadcode implementation ('isBoolean').
    #
    # Parameters:
    #	value -	The value to test, as an LLVM value reference.
    #	name (optional) -
    #		A name to give to the result value.
    #
    # Results:
    #	An LLVM INT value reference containing a boolean value.

    method isBoolean(INT\040BOOLEAN) {value {name ""}} {
	# We know we've got one by the type logic; this is trivial
	my cast(BOOLEAN) [Const true bool] $name
    }

    # Builder:isBoolean(STRING) --
    #
    #	Test if a value is a boolean. Quadcode implementation ('isBoolean').
    #
    # Parameters:
    #	value -	The value to test, as an LLVM value reference.
    #	name (optional) -
    #		A name to give to the result value.
    #
    # Results:
    #	An LLVM INT value reference containing a boolean value.

    method isBoolean(STRING) {value {name ""}} {
	my call ${tcl.isBoolean} [list $value [Const false bool]] $name
    }

    # Builder:isTrue(INT) --
    #
    #	Tests whether a given value will cause 'jumpTrue' to jump;
    #	Quadcode implementation('jumpTrue', 'jumpFalse')
    #
    # Parameters:
    #	value - The value to test, as an LLVM value reference.







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







4488
4489
4490
4491
4492
4493
4494

































4495
4496
4497
4498
4499
4500
4501
    #	An LLVM value reference.

    method invokeExpanded {arguments flags ec {resultName ""}} {
	my ExtractVector $arguments
	my call ${tcl.invoke.expanded} [list $len $ary $flags $ec] $resultName
    }


































    # Builder:isTrue(INT) --
    #
    #	Tests whether a given value will cause 'jumpTrue' to jump;
    #	Quadcode implementation('jumpTrue', 'jumpFalse')
    #
    # Parameters:
    #	value - The value to test, as an LLVM value reference.

Changes to codegen/compile.tcl.

465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
			my SetErrorLine $errorCode \
			    [$b maybe [$b frame.value $res]]
		    }
		    my StoreResult $tgt $res
		}
		"bitor" - "bitxor" - "bitand" - "lshift" - "rshift" -
		"add" - "sub" - "mult" - "uminus" - "uplus" - "land" - "lor" -
		"isBoolean" - "eq" - "neq" - "lt" - "gt" - "le" - "ge" -
		"not" -
		"streq" - "bitnot" - "strcase" - "strclass" - "strcmp" -
		"strfind" - "strlen" - "strmap" - "strmatch" - "strrfind" -
		"strtrim" - "resolveCmd" - "arrayExists" - "directExists" -
		"arrayElementExists" - "directArrayExists" -
		"initArrayIfNotExists" - "extractScalar" - "extractArray" -
		"arraySet" - "arrayUnset" - "arrayGet" {







|







465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
			my SetErrorLine $errorCode \
			    [$b maybe [$b frame.value $res]]
		    }
		    my StoreResult $tgt $res
		}
		"bitor" - "bitxor" - "bitand" - "lshift" - "rshift" -
		"add" - "sub" - "mult" - "uminus" - "uplus" - "land" - "lor" -
		"eq" - "neq" - "lt" - "gt" - "le" - "ge" -
		"not" -
		"streq" - "bitnot" - "strcase" - "strclass" - "strcmp" -
		"strfind" - "strlen" - "strmap" - "strmatch" - "strrfind" -
		"strtrim" - "resolveCmd" - "arrayExists" - "directExists" -
		"arrayElementExists" - "directArrayExists" -
		"initArrayIfNotExists" - "extractScalar" - "extractArray" -
		"arraySet" - "arrayUnset" - "arrayGet" {

Changes to quadcode/pre.tcl.

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	    dictLappend dictSet dictSetOrUnset dictSize dictUnset
	    div
	    eq expand exists expon extractArray extractCallFrame extractExists
	    extractFail extractMaybe extractScalar
	    frameArgs frameDepth
	    ge gt
	    initIfNotExists
	    instanceOf isBoolean
	    le
	    listAppend listConcat listIn listIndex listLength listRange
	    listSet
	    lshift lt
	    maptoint mod moveFromCallFrame mult
	    narrowToType neq not
	    purify







|







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	    dictLappend dictSet dictSetOrUnset dictSize dictUnset
	    div
	    eq expand exists expon extractArray extractCallFrame extractExists
	    extractFail extractMaybe extractScalar
	    frameArgs frameDepth
	    ge gt
	    initIfNotExists
	    instanceOf
	    le
	    listAppend listConcat listIn listIndex listLength listRange
	    listSet
	    lshift lt
	    maptoint mod moveFromCallFrame mult
	    narrowToType neq not
	    purify

Changes to quadcode/translate.tcl.

1099
1100
1101
1102
1103
1104
1105





1106

1107
1108
1109
1110
1111
1112
1113
		my quads copy $res $val
	    }
	    tryCvtToNumeric {	# No effect on value
	    }
	    tryCvtToBoolean {	# Push whether we're dealing with a boolean
		set val [list temp [expr {$depth - 1}]]
		set res [list temp $depth]





		my quads isBoolean $res $val

	    }
	    numericType -
	    resolveCmd -
	    strlen {		# Unary operations
		set v0 [list temp [incr depth -1]]
		set r $v0
		my quads [lindex $insn 0] $r $v0







>
>
>
>
>
|
>







1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
		my quads copy $res $val
	    }
	    tryCvtToNumeric {	# No effect on value
	    }
	    tryCvtToBoolean {	# Push whether we're dealing with a boolean
		set val [list temp [expr {$depth - 1}]]
		set res [list temp $depth]
		set typecode [quadcode::dataType::typeUnion \
				  $quadcode::dataType::IMPURE \
				  $quadcode::dataType::BOOLEAN]
		set v0 [list temp [incr depth -1]]
		set r $v0
		my quads [list instanceOf $typecode \
			   [quadcode::nameOfType $typecode]] $res $val
	    }
	    numericType -
	    resolveCmd -
	    strlen {		# Unary operations
		set v0 [list temp [incr depth -1]]
		set r $v0
		my quads [lindex $insn 0] $r $v0

Changes to quadcode/types.tcl.

622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
	dictExists -
	foreachMayStep -
	dictIterDone -
	eq -
	ge -
	gt -
	instanceOf -
	isBoolean -
	land -
	le -
	lor -
	lt -
	neq -
	strclass -
	streq -







<







622
623
624
625
626
627
628

629
630
631
632
633
634
635
	dictExists -
	foreachMayStep -
	dictIterDone -
	eq -
	ge -
	gt -
	instanceOf -

	land -
	le -
	lor -
	lt -
	neq -
	strclass -
	streq -