tclquadcode

Check-in [dc00e24c34]
Login

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

Overview
Comment:Make retrograde type inference hack work again.
Timelines: family | ancestors | descendants | both | kbk-free-values
Files: files | file ages | folders
SHA1:dc00e24c34c6219805907533e9032dd9dc3fca6b
User & Date: kbk 2015-03-09 01:53:35
Context
2015-03-09
02:16
One more bug in retrograde type inference Closed-Leaf check-in: 0e3f87c0ab user: kbk tags: kbk-free-values
01:57
merge changes that restore retrograde type inference hack check-in: 06eeceb52e user: kbk tags: llvm-integration-memory-part2
01:53
Make retrograde type inference hack work again. check-in: dc00e24c34 user: kbk tags: kbk-free-values
2015-03-08
02:01
Added logic to free values that will no longer be used. Results in a new quadcode instruction, 'free', whose input parameter is the value to be dismissed. check-in: 32281c70dd user: kbk tags: kbk-free-values
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to quadcode.tcl.

2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
....
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
#	Returns a type code
#
# Totally half-arsed implementation needed to get the LLVM connection going

proc requiredInputType {q v} {
    switch -exact -- [lindex $q 0] {
	invoke {
	    if {[lindex $q 2 0] eq "literal" && [lindex $q 2 2] == -1} {
		switch [lindex [builtinCommandType [lindex $q 2 1]] 0 0] {
		    INT {
			return $dataType::INT
		    }
		    DOUBLE {
			return $dataType::DOUBLE
		    }
................................................................................
    }

    # constrain all parameter types according to how they are used in the
    # three address code

    foreach q $quads {
	foreach v [lrange $q 2 end] {
	    if {[lindex $v 0] eq {var} && [lindex $v 2] == -1} {
		set t [requiredInputType $q $v]
		dict set vtypes $v [expr {[dict get $vtypes $v] & $t}]
	    }
	}
    }
}








|







 







|







2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
....
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
#	Returns a type code
#
# Totally half-arsed implementation needed to get the LLVM connection going

proc requiredInputType {q v} {
    switch -exact -- [lindex $q 0] {
	invoke {
	    if {[lindex $q 2 0] eq "literal" && [llength [lindex $q 2]] < 3} {
		switch [lindex [builtinCommandType [lindex $q 2 1]] 0 0] {
		    INT {
			return $dataType::INT
		    }
		    DOUBLE {
			return $dataType::DOUBLE
		    }
................................................................................
    }

    # constrain all parameter types according to how they are used in the
    # three address code

    foreach q $quads {
	foreach v [lrange $q 2 end] {
	    if {[lindex $v 0] eq {var} && [llength $v] < 3} {
		set t [requiredInputType $q $v]
		dict set vtypes $v [expr {[dict get $vtypes $v] & $t}]
	    }
	}
    }
}