Reconstructing the Types of Stack-Machine Codes

Oukseh Lee <cookcu@ruby.kaist.ac.kr>
17 Oct 1998 01:55:09 -0400

          From comp.compilers

Related articles
Reconstructing the Types of Stack-Machine Codes cookcu@ruby.kaist.ac.kr (Oukseh Lee) (1998-10-17)
Re: Reconstructing the Types of Stack-Machine Codes anton@mips.complang.tuwien.ac.at (1998-10-18)
Re: Reconstructing the Types of Stack-Machine Codes M-Jourdan@calva.net (1998-10-18)
Re: Reconstructing the Types of Stack-Machine Codes andrewf@slhosiery.com.au (Andrew Fry) (1998-10-18)
Re: Reconstructing the Types of Stack-Machine Codes cwm2n@cobra.cs.virginia.edu (Christopher W. Milner) (1998-10-21)
Re: Reconstructing the Types of Stack-Machine Codes kers@hplb.hpl.hp.com (1998-10-24)
Re: Reconstructing the Types of Stack-Machine Codes Jan.Vitek@cui.unige.ch (1998-10-30)
| List of all articles for this month |
From: Oukseh Lee <cookcu@ruby.kaist.ac.kr>
Newsgroups: comp.compilers
Date: 17 Oct 1998 01:55:09 -0400
Organization: KREONet news service
Keywords: code, question

Hello,


I'm working on developing an EM-to-PowerPC compiler where EM is a
stack-machine intermediate language of Amsterdam compiler kit. I
found that if we know the types of runtime EM stack, it is possible to
generate more efficient target code.


So I design a type analysis of runtime stack by abstract
interpretation. However I'm afraid someone made similar type analysis
of runtime stack before, because I think it's very simple technique.


Whoever knows about TYPE ANALYSIS of STACK-MACHINE CODES?
Please make me know. Thanks in advance.


P.S.
An example to explain why type information help us to generate more
efficient target code:


For example, for input code (a),
assuming possible control-flow is A->C and B->C,


    A: push 1 A: rsp <- rsp+1 A: r1 <- 1
          push 2 M[rsp] <- 1 r2 <- 2
          jump B rsp <- rsp+1 jump B
    B: push 3 M[rsp] <- 2 B: r1 <- 3
          push 4 jump B r2 <- 4
    C: add B: rsp <- rsp+1 C: ... <- r1+r2
                                          M[rsp] <- 3
                                          rsp <- rsp+1
                                          M[rsp] <- 4
                                    C: ... <- M[rsp]+M[rsp-1]
                                          rsp <- rsp -2


                                    *rsp: register for stack *r1,r2: integer registers
                                                pointer


    (a) input (b) stack-emulation (c) efficient
                                            target code target code


If we know the top of stack before C is two integer, instead of
stack-emulation target code such as (b), we can generate more
efficient target code such as (c).
--
Oukseh Lee, KAIST.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.