turning off block inlining and the list library for the moment; need to analyze il and generate cleaner code
This commit is contained in:
parent
a8af8dc9b6
commit
11f461886a
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(: collect-general-jump-targets ((Listof Statement) -> (Listof Symbol)))
|
(: collect-general-jump-targets ((Listof Statement) -> (Listof Symbol)))
|
||||||
;; collects all the labels that are potential targets for GOTOs or branches.
|
;; collects all the labels that are potential targets for GOTOs or branches.
|
||||||
(define (collect-general-jump-targets stmts)
|
(define (collect-general-jump-targets stmts)
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
|
|
||||||
|
|
||||||
(define-type Blockht (HashTable Symbol BasicBlock))
|
(define-type Blockht (HashTable Symbol BasicBlock))
|
||||||
(define-type Bodyht (HashTable (Listof UnlabeledStatement) Symbol))
|
|
||||||
|
;; We want maps from unlabeled statements to their respective blocks.
|
||||||
|
(define-type Bodyht (HashTable (Listof UnlabeledStatement) (Listof Symbol)))
|
||||||
|
|
||||||
|
|
||||||
(: optimize-basic-blocks ((Listof BasicBlock) -> (Listof BasicBlock)))
|
(: optimize-basic-blocks ((Listof BasicBlock) -> (Listof BasicBlock)))
|
||||||
|
@ -24,20 +26,25 @@
|
||||||
(: blockht : Blockht)
|
(: blockht : Blockht)
|
||||||
(define blockht (make-hasheq))
|
(define blockht (make-hasheq))
|
||||||
|
|
||||||
(: bodyht : Blockht)
|
(: bodyht : Bodyht)
|
||||||
(define bodyht (make-hasheq))
|
(define bodyht (make-hasheq))
|
||||||
|
|
||||||
|
;; First, scan through the blocks, and pick up their names and bodies.
|
||||||
(for ([b blocks])
|
(for ([b blocks])
|
||||||
(hash-set! blockht (BasicBlock-name b) b))
|
(hash-set! blockht (BasicBlock-name b) b)
|
||||||
|
|
||||||
|
(when (hash-has-key? bodyht (BasicBlock-stmts b))
|
||||||
|
(log-debug (format "block ~a has the same content as another block" (BasicBlock-name b))))
|
||||||
(define inlined-blocks
|
(hash-set! bodyht (BasicBlock-stmts b)
|
||||||
|
(cons (BasicBlock-name b)
|
||||||
|
(hash-ref bodyht (BasicBlock-stmts b) (lambda () '())))))
|
||||||
|
|
||||||
|
blocks
|
||||||
|
#;(define inlined-blocks
|
||||||
(map (lambda: ([b : BasicBlock])
|
(map (lambda: ([b : BasicBlock])
|
||||||
(optimize-block b blockht))
|
(optimize-block b blockht))
|
||||||
blocks))
|
blocks))
|
||||||
|
#;inlined-blocks)
|
||||||
inlined-blocks)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang s-exp "kernel.rkt"
|
#lang s-exp "kernel.rkt"
|
||||||
(provide (all-from-out "kernel.rkt")
|
(provide (all-from-out "kernel.rkt")
|
||||||
(all-from-out "private/list.rkt"))
|
#;(all-from-out "private/list.rkt"))
|
||||||
(require racket/private/modbeg
|
(require racket/private/modbeg
|
||||||
"private/list.rkt")
|
#;"private/list.rkt")
|
Loading…
Reference in New Issue
Block a user