IRBuilder.st
changeset 23 377bc46cad12
parent 22 6d3c5fd122e3
child 25 e14dfb33936f
equal deleted inserted replaced
22:6d3c5fd122e3 23:377bc46cad12
     1 "{ Package: 'stx:goodies/newcompiler' }"
     1 "{ Package: 'cvut:stx/goodies/newcompiler' }"
     2 
     2 
     3 Object subclass:#IRBuilder
     3 Object subclass:#IRBuilder
     4 	instanceVariableNames:'ir jumpBackTargetStacks jumpAheadStacks currentSequence
     4 	instanceVariableNames:'ir jumpBackTargetStacks jumpAheadStacks currentSequence
     5 		sourceMapNodes sourceMapByteIndex lastLine'
     5 		sourceMapNodes sourceMapByteIndex lastLine'
     6 	classVariableNames:''
     6 	classVariableNames:''
     7 	poolDictionaries:''
     7 	poolDictionaries:''
     8 	category:'NewCompiler-IR'
     8 	category:'NewCompiler-IR'
     9 !
     9 !
    10 
    10 
    11 IRBuilder comment:'I provide a simple interface for constructing an IRMethod.  For example, to create an ir method that compares first instVar to first arg and returns ''yes'' or ''no'' (same example as in BytecodeGenerator), do:
    11 IRBuilder comment:'I provide a simple interface for constructing an IRMethod.  For example, to create an ir method that compares first instVar to first arg and returns ''yes'' or ''no'' (same example as in BytecodeGenerator), do:
    12 
       
    13 	IRBuilder new
    12 	IRBuilder new
    14 		numRargs: 2;
    13 		numRargs: 2;
    15 		addTemps: #(self a z);		"rcvr, arg, & extra temp (not used here)"
    14 		addTemps: #(self a z);		"rcvr, arg, & extra temp (not used here)"
    16 		pushTemp: #self;
    15 		pushTemp: #self;
    17 		pushInstVar: 1;
    16 		pushInstVar: 1;
    22 		returnTop;
    21 		returnTop;
    23 		jumpAheadTarget: #else;
    22 		jumpAheadTarget: #else;
    24 		pushLiteral: ''no'';
    23 		pushLiteral: ''no'';
    25 		returnTop;
    24 		returnTop;
    26 		ir
    25 		ir
    27 
       
    28 Sending #compiledMethod to an ir method will generate its compiledMethod.  Sending #methodNode to it will decompile to its parse tree.
    26 Sending #compiledMethod to an ir method will generate its compiledMethod.  Sending #methodNode to it will decompile to its parse tree.
    29 '
    27 '
    30 !
    28 !
    31 
    29 
    32 
    30 
   457 ! !
   455 ! !
   458 
   456 
   459 !IRBuilder class methodsFor:'documentation'!
   457 !IRBuilder class methodsFor:'documentation'!
   460 
   458 
   461 version
   459 version
   462     ^'$Id$'
   460     ^ '$Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRBuilder.st,v 1.3 2009/10/08 11:57:58 fm Exp $'
   463 ! !
   461 !
       
   462 
       
   463 version_CVS
       
   464     ^ '$Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRBuilder.st,v 1.3 2009/10/08 11:57:58 fm Exp $'
       
   465 !
       
   466 
       
   467 version_SVN
       
   468     ^'§Id: IRBuilder.st 23 2009-08-19 20:28:12Z vranyj1 §'
       
   469 ! !