Intermediate code notes


I_DO_DECLARE is used for declarations.
	Its purpose is so the code generator can calculate how big things
	are; e.g., var a[1:x] :int where x is a variable.
	These are generated for all declarations that are not in the spec.

(I_REPLY,exp,,)
	exp points to the symbol table entry for the block to which
	this reply pertains.
	the type of this entry will be T_INITIAL, T_FINAL, T_PROC, T_INPUT.
	recall that for the latter 2, that entry points to the
	symbol table entry for the operation.
I_REPLY is generated only for T_INITIAL, T_FINAL, and operations
	whose restriction is {call} or {call,send}.
	The code generator generates code to test the invocation block
	for the latter.


I_INP's are used for input statements. Their meanings are:

    (I_INP_ALL,,) (I_INP_ALL_END,,)
	These are simply markers that are needed
	so that the intermediate code gets placed on the
	main list instead of the resource variable list.
	Required because we produce intermediate code
	for input statements at the end of each body.

    (I_INP_START, ,)
	This marks in the intermediate code list the
	start of an input statement. It is vital
	for the kind of intermediate code patching that
	we do for input statements that each input statement
	points to a different node in the ic list. So we
	emit one of these for each input statement.
	(The exact problem we had was nested input statements
	for which there were no intervening statements.)

    (I_INP_ACCESS,exp,,)
	Generate an access call to the RTS.
	exp is a pointer to a TK_CLASS node that contains
	a pointer to the class structure.

    (I_INP_GET_INV,,)
	Generate a call to the RTS to return the next invocation
	for the class. (Note: the code generator maintains a stack
	of classes and other info because input statements can
	be nested.)
	Always returns an invocation; if none, RTS will block us.

    (I_INP_MATCH,exp,lab)
	Compares the operation capability in the invocation structure
	with that described by exp, which is either a TK_IDENTIFIER
	node or, if the operation is subscripted, is a TK_INDEX node.
	lab is the label to branch if the match fails.

    (I_INP_REMOVE,,)
	Generate a call to the RTS to remove the invocation.

    (I_INP_GET_NAMED_INV,exp,)
	Optimization. Like I_INP_GET_INV, but exp is
	a TK_INPUT node that specifies which
	operation we want. No match required after this.
	Good for one armed input with no sched/synch
	where more than one in the class.

    (I_INP_GET_NAMED_INV_NB,,lab)
	Used in scheduling expression. Once we have determined
	what operation we want, we use this. The NB is for
	non-blocking: unlike I_INP_GET_NAMED_INV, this one
	does not block. Instead, it returns NULL when there
	are no more invocations; the GC then branches to lab.

    (I_INP_RECEIVE,exp,)
	Optimization. Use when there is one operation in the
	class and one arm on the input statement and no sched
	and no synch (probably no quantifier either).
	It's actions are the same as access, get_inv, and remove.
	exp is a TK_CLASS node as in I_INP_ACCESS.

    (I_INP_SEM_P,exp,)
	Optimization. Do a semaphore P operation.
	There are many criteria that an operation must
	meet to be a semaphore op; see the code for details.
	exp is a TK_INPUT node that specifies the operation.

    (I_INP_SET_MIN,exp,)
	Evaluate the scheduling exp and save
	its value and a pointer to current invocation as
	the minimum. (Used on the first invocation.)

    (I_INP_UPDATE_MIN,exp,)
	Evaluate the scheduling exp and compare its value
	to the current minimum; update the current minimum
	and pointer if necessary. (Used on subsequent invocations.)

    (I_INP_REMOVE_MIN,,)
	Generate a call to the RTS to remove the invocation.
	(When there was a scheduling expression;
	probably redundant with I_INP_REMOVE.)

    (I_INP_DONE,,)
	Generate a call to the RTS primitive input_done
	at the end of a leg of an input statement.
	Note there will be several of these in the intermediate code:
	one for normal, one for exit code, one for next code.
	The latter will be emitted, but discarded by em, if unused.

    (I_INP_END,,)
	Tells the code generator that done with the input statement
	so that it can clean up anything it needs to.
