<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Those comments were from me, since I went through<br>and 1) added the C mode 2) tried to clean up what<br>I percieve as rather messy, and still messy.<BR> <BR><br>You helped my vocabulary here -- it should be "cartesian factored".<br>Rather than every "product" be its own case.<BR> <BR><br>I moved it toward that, but it still confusing.<BR> <BR><br>Basically you want a set of available steps, and<br>then just sequence them, possibly omitting some of them.<BR> <BR><br>I can see how you might have roughly 10 choices,<br>depending on if you are outputing bitcode or LLVM assembly<br>or building LLVM data structures, and linking to LLVM or not,<br>and LLVM is producing assembly or object files.<BR> <BR><br>I would suggest that LLVM produing assembly is not a useful choice.<br>Remove that from the matrix.<br>Have it produce object files if you can.<br>For debugging, you can fiddle with the switches or dump the files<br>afterward.<BR> <BR><br>If you are producing cm3cg IR files like for m3cc, likely you don't need builder support.<br>You can use the "external object" mode plus config file stuff.<br>I started that way for C and didn't change the builder initially.<br>But it was slower. I don't remember why i needed builder support,<br>vs. the existing "internal object" mode,<br>maybe to more easily reuse the existing support for compiling C.<br>My mode is kind of "internal plus run some quake code".<br>I guess I could setup linkage so the C backend could call the quake<br>code w/o the builder knowing about it.<br>Maybe I should try that, so we can get back to the original set of modes.<BR> <BR> <BR>Basically "external" means "produce cm3cg IR files".<BR>"Internal" means don't produce them.<BR>And then "assembly" means "run assembler after backend"<BR>and "object" means don't run assembler because we already have objects. <BR> <BR> <BR>Whether or not the m3cg IR files are being converted to C and then objects<BR>or gcc internals and then objects, or LLVM internals and then objects,<BR>the builder doesn't need to know or act differently.<BR>It just runs the quake function m3_backend or such, and it decides,<BR>via a separate factor from mode to run llvm or cm3cg on the IR file.<BR> <BR><br>Basically, let's say we have n different external backends producing<br>object files. That doesn't imply any new modes. But some other variable<br>that affects the quake code that runs cm3cg.<BR> <BR> <BR>Thank you for the confirmation as to which mode you are using.<BR> <BR> <BR> - Jay<br><br><br><br> <BR><div>> Date: Fri, 11 Sep 2015 15:13:43 -0500<br>> From: rodney_bates@lcwb.coop<br>> To: m3devel@elegosoft.com<br>> Subject: Re: [M3devel] LLVM builder modes Int/Ext/StAlone<br>> <br>> Yes, I put in all the modes I thought of while working in there, as it's a lot easier<br>> to do it when you are familiar with the code than refamiliarize later.  There were<br>> already some with comments like "No such back end".  Only the StAloneLlvm ones<br>> have an actual back end.  The others are intended for modes that link in at least<br>> some of llvm into cm3.  As discussed, we may not want to do this.<br>> <br>> The only mode I have tried is StAloneLlvmAsm.  This is running to compile completion<br>> on small examples and passing a good few of the compiler tests.  Right now, I am working<br>> on the ones that pass using m3cc and fail using m3llvm, before trying to build the real code.<br>> <br>> On 09/10/2015 08:53 PM, Jay K wrote:<br>> > Here is what I get: some "crash", some "fail", some get the file format mixed up, some work!<br>> > 6 modes. 4 crash, 1 appears to work, 1 appears close<br>> ><br>> ><br>> > jair:m3core jay$ for a in \<br>> > IntLlvmObj \<br>> > IntLlvmAsm \<br>> > ExtLlvmObj \<br>> > ExtLlvmAsm \<br>> > StAloneLlvmObj \<br>> > StAloneLlvmAsm; \<br>> ><br>> > do rm AMD64_DARWIN/RT0.io ; echo $a;cm3 -DM3_BACKEND_MODE=$a -keep -commands; done<br>> ><br>> > IntLlvmObj<br>> > *** runtime error:<br>> > ***    Segmentation violation - possible attempt to dereference NIL<br>> > ***    pc = 0x1030edca3 = set_error_handler + 0x5b in ../src/M3CG.m3<br>> > ***<br>> ><br>> > IntLlvmAsm<br>> > *** runtime error:<br>> > ***    Segmentation violation - possible attempt to dereference NIL<br>> > ***<br>> ><br>> > ExtLlvmObj<br>> > *** runtime error:<br>> > ***    Segmentation violation - possible attempt to dereference NIL<br>> > ***    pc = 0x10e8b0ca3 = set_error_handler + 0x5b in ../src/M3CG.m3<br>> ><br>> > ExtLlvmAsm<br>> > *** runtime error:<br>> > ***    Segmentation violation - possible attempt to dereference NIL<br>> ><br>> > StAloneLlvmObj<br>> > m3llvm -b -d -o RT0.ib RT0.ic<br>> > llc -disable-fp-elim -filetype=obj  -relocation-model=pic RT0.ib -o RT0.io<br>> ><br>> > => success?<br>> ><br>> > except for:<br>> > error: /Library/Developer/CommandLineTools/usr/bin/libtool: file: RT0.io is not an object file (not allowed in a library)<br>> ><br>> ><br>> > StAloneLlvmAsm<br>> > close, maybe just a config problem<br>> > m3llvm -b -d -o RT0.ib RT0.ic<br>> > llc -disable-fp-elim -filetype=asm  -relocation-model=pic RT0.ib -o RT0.is<br>> > fg++ -m64 -arch x86_64 -c -x assembler RT0.is -o RT0.io<br>> > RT0.is:5:2: error: unknown directive<br>> ><br>> ><br>> > I assume we should ignore Int and Ext and focus on StAlone for now.<br>> ><br>> ><br>> >   - Jay<br>> ><br>> ><br>> > _______________________________________________<br>> > M3devel mailing list<br>> > M3devel@elegosoft.com<br>> > https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel<br>> ><br>> <br>> -- <br>> Rodney Bates<br>> rodney.m.bates@acm.org<br>> _______________________________________________<br>> M3devel mailing list<br>> M3devel@elegosoft.com<br>> https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel<br></div>                                      </div></body>
</html>