[M3devel] completing M3CG_Binary.Op?

Jay K jay.krell at cornell.edu
Thu Oct 11 07:46:07 CEST 2012


Tony, I think you might not understand, or have it backwards.

In my code I do use cvt_int.It is the existing M3CG_Wr and M3CG_BinWr that don't.It seems like a pretty pointless transformation there, and I'd rathernot make it in my code.The comments in the change describe what we already currently do for "files", that I do not want to do for in-memory.

For example, M3CG_Wr.m3:
PROCEDURE set_compare  (u: U;  s: ByteSize;  op: CompareOp;  t: IType) =  (* s1.t := (s1.B  op  s0.B)  ; pop *)  CONST OpName = ARRAY CompareOp OF TEXT {                   "set_eq", "set_ne", "set_gt", "set_ge", "set_lt", "set_le" };  BEGIN    Cmd   (u, OpName [op]);    Int   (u, s);    TName (u, t);    NL    (u);  END set_compare;

but in my M3CG_MultiPass.m3 (not necessarily the commited version!)
PROCEDURE set_compare(self: T; byte_size: ByteSize; op: CompareOp; type: IType) =BEGINself.Add(NEW(set_compare_t, op := Op.set_compare, byte_size := byte_size, compare_op := op, type := type));END set_compare;

so -- ok with my change?
Thank you, - Jay


From: jay.krell at cornell.edu
Date: Wed, 10 Oct 2012 20:08:41 -0700
To: hosking at cs.purdue.edu
CC: m3devel at elegosoft.com; jay.krell at cornell.edu
Subject: Re: [M3devel] completing M3CG_Binary.Op?

I agree I could do the transforms that M3CG_Wr does but I'd rather leave things untranformed. You understand? It is the existing code that changes to "different" "instructions" instead of channeling the interface a bit more directly. I want a more direct form.

 - Jay (briefly/pocket-sized-computer-aka-phone)
On Oct 10, 2012, at 5:18 PM, Antony Hosking <hosking at cs.purdue.edu> wrote:

Why not simply capture the state of the existing ops?  e.g,, cvt_int.


On Oct 10, 2012, at 7:33 PM, Jay K <jay.krell at cornell.edu> wrote:
Look at M3CG_MultiPass.

For each function, it creates a record to hold the parameters.
    So they can be later be looped over in a different order and/or multiple times.
The record includes an enum.
I need an enum that looks almost exactly like M3CG_Binary.Op,
except that I need those few missing elements.
 
 M3CG_MultiPass already has most of this, except 
   1) I somehow forgot got to handle a bunch of them  
   2) I need the below diff for it to be complete, or some other nearly identical enum instead.  
 
 - Jay
 
Subject: Re: [M3devel] completing M3CG_Binary.Op?
From: hosking at cs.purdue.edu
Date: Wed, 10 Oct 2012 12:13:51 -0400
CC: m3devel at elegosoft.com
To: jay.krell at cornell.edu

I still don’t understand why the change is needed.

On Oct 10, 2012, at 11:53 AM, Jay K <jay.krell at cornell.edu> wrote:M3CG.T, M3CG_Ops.T also same thing, I use them interchangably in email and checkin comments. My code is more careful.
 - Jay
From: hosking at cs.purdue.edu
Date: Wed, 10 Oct 2012 02:33:13 -0400
To: jay.krell at cornell.edu
CC: m3devel at elegosoft.com
Subject: Re: [M3devel] completing M3CG_Binary.Op?

Hmm.  But the M3CG calls don’t include those operations.  e.g., cvt_int is defined in M3CG_Ops.  Why wouldn’t you just have a record for that?
On Oct 10, 2012, at 1:59 AM, Jay <jay.krell at cornell.edu> wrote:
I have an array of records, one per M3CG.T call. See M3CG_MultiPass -- which I guess is where I'd put the enum, if I can't reuse the existing one.

 - Jay (briefly/pocket-sized-computer-aka-phone)
On Oct 9, 2012, at 10:35 PM, Antony Hosking <hosking at cs.purdue.edu> wrote:

Why?
On Oct 10, 2012, at 12:52 AM, Jay <jay.krell at cornell.edu> wrote:I need an enumeration with a member per M3CG.T method. M3CG_Binary.Op is very nearly it.

 - Jay (briefly/pocket-sized-computer-aka-phone)
On Oct 9, 2012, at 9:36 PM, Antony Hosking <hosking at cs.purdue.edu> wrote:

Forgive me, but I don’t understand the purpose of this change.

On Oct 10, 2012, at 12:08 AM, Jay K <jay.krell at cornell.edu> wrote:M3CG_Binary.Op currently representswhat we write to ".mc" files for the gccbackend to read in. This is very very closeto what you'd want to fully represent M3CG.T.

It missing an operation that takes a function pointer -- can'tbe stored in a file. It is missing operations that get convertedto different operations by M3CG_Wr. There is no realvalue in the transform but it doesn't hurt either.

I'd like to add the missing operations.It seems like a very sensible reasonable change to me.


===================================================================RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_BinRd.m3,vretrieving revision 1.19diff -u -r1.19 M3CG_BinRd.m3--- M3CG_BinRd.m3	4 Sep 2012 14:29:54 -0000	1.19+++ M3CG_BinRd.m3	10 Oct 2012 04:04:19 -0000@@ -37,7 +37,7 @@   END;  CONST-  CmdMap = ARRAY Bop OF Cmd {+  CmdMap = ARRAY [Bop.begin_unit..Bop.fetch_and_xor] OF Cmd {     Cmd {Bop.begin_unit, begin_unit},     Cmd {Bop.end_unit, end_unit},     Cmd {Bop.import_unit, import_unit},Index: M3CG_Binary.i3===================================================================RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG_Binary.i3,vretrieving revision 1.6diff -u -r1.6 M3CG_Binary.i3--- M3CG_Binary.i3	1 Nov 2010 09:59:44 -0000	1.6+++ M3CG_Binary.i3	10 Oct 2012 04:04:19 -0000@@ -38,7 +38,17 @@     call_indirect, pop_param, pop_struct, pop_static_link,     load_procedure, load_static_link, comment,     store_ordered, load_ordered, exchange, compare_exchange, fence,-    fetch_and_add, fetch_and_sub, fetch_and_or, fetch_and_and, fetch_and_xor+    fetch_and_add, fetch_and_sub, fetch_and_or, fetch_and_and, fetch_and_xor,++    (* These only occur in memory, not in files.+       Conversely, what they are converted to only occur in files,+       not in memory. *)+    set_error_handler,  (* disk: contains a pointer, silently skipped *)+    compare             (* converted to eq/ne/etc. *)+    cvt_int,            (* converted to trunc/ceiling/etc. *)+    fetch_and_op,       (* converted to fetch_and_add/fetch_and_sub/etc. *)+    if_compare,         (* converted to if_eq/if_ne/etc. *)+    set_compare,        (* converted to set_eq/set_ne/etc. *)   };
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20121011/477b9713/attachment-0002.html>


More information about the M3devel mailing list