Hi Eli, Yep I was being stupid. Please find attached a patch for initial changes to get MASM working. There is still one problem that I am looking into around changing alignments within SEGMENTS. The problem is that MASM allows 2,4,16,256 alignments, default being 16, but LLVM is sometimes generating 32 alignment, for example, consider the following code: float bar(float fy, float fx) { static const double foo[ 241] = { 6.24188099959573430842e-02, 6.63088949198234745008e-02, } } Is generating the data segment: _data segment PARA 'DATA' __2E_str: ; .str db 'out',0 __2E_str1: ; .str1 db 'in',0 public ___some_other_sruct_data ALIGN 4 ___some_other_sruct_data: ; dd 7 ; 0x7 dd 3 ; 0x3 dd __2E_str db 12 dup(0) dd 7 ; 0x7 dd 3 ; 0x3 dd __2E_str1 db 12 dup(0) db 12 dup(0) sgv: ; sgv db 1 dup(0) ALIGN 4 lvgv: ; lvgv ALIGN 32 foo: ; dq 4589156319577832937 ; double value: 6.241881e-002 dq 4589442480094401190 ; double value: 6.630889e-002 MASM reports the following error: error A2189:invalid combination with segment alignment : 32 Regards, Ben -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Eli Friedman Sent: Tuesday, June 16, 2009 12:10 AM To: LLVM Developers Mailing List Subject: Re: [LLVMdev] x86 Intel Syntax and MASM 9.x On Mon, Jun 15, 2009 at 11:21 PM, Gaster, Benedict<Benedict.Gaster at amd.com> wrote:> I can get this two work with additional changes to X86InstrInfocpp but > the problem I have with this approach is that it introduces a lot of > duplication, when all I really want to do is parameterize the final > field in the string "shl{b}\t{%cl, $dst|$dst, %CL}". I was wondering > (hoping :-) if you knew of a better method to handling this?I think you're missing the whole point of the "|" construct; the left side is AT&T syntax, the right side is Intel syntax. -Eli _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- A non-text attachment was scrubbed... Name: masm.patch Type: application/octet-stream Size: 15767 bytes Desc: masm.patch URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090616/691a2731/attachment.obj>
Hello, Benedict> There is still one problem that I am looking into around changing > alignments within SEGMENTS. The problem is that MASM allows 2,4,16,256 > alignments, default being 16, but LLVM is sometimes generating 32 > alignment, for example, consider the following code:That's correct. MASM is too weak to represent even slightly non-trivial program. In your particular case - LLVM IR can set up any alignment it want. Also note the FIXME's in the X86IntelAsmPrinter.cpp wrt the alignment. You might try to round up the alignment to the highest allowed value, but this might be an overkill... -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University.
On Tue, Jun 16, 2009 at 9:39 AM, Gaster, Benedict<Benedict.Gaster at amd.com> wrote:> Hi Eli, > > Yep I was being stupid. > > Please find attached a patch for initial changes to get MASM working.Patch looks fine except that it has tabs (LLVM uses only spaces for indentation). Also, can you generate the patch using "svn diff"? It's currently in some unusual format which "patch" doesn't recognize.> There is still one problem that I am looking into around changing > alignments within SEGMENTS. The problem is that MASM allows 2,4,16,256 > alignments, default being 16, but LLVM is sometimes generating 32 > alignment, for example, consider the following code:Huh. For correctness, I guess you'll have to round up the alignment, and abort on anything higher than 256. (Also, perhaps the front-end should avoid generating such constructs in the first place when targeting Windows, but that's a separate issue.) -Eli
Hi Anton, Indeed your work around of rounding up to supported alignment is what I have implemented but it was not clear to me that this should be submitted back. As you point out as there are many other FIXMEs with the X86IntelAsmPrinter maybe this is the "fix" for now. Regards, Ben -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Anton Korobeynikov Sent: Tuesday, June 16, 2009 11:15 AM To: LLVM Developers Mailing List Subject: Re: [LLVMdev] x86 Intel Syntax and MASM 9.x Hello, Benedict> There is still one problem that I am looking into around changing > alignments within SEGMENTS. The problem is that MASM allows 2,4,16,256 > alignments, default being 16, but LLVM is sometimes generating 32 > alignment, for example, consider the following code:That's correct. MASM is too weak to represent even slightly non-trivial program. In your particular case - LLVM IR can set up any alignment it want. Also note the FIXME's in the X86IntelAsmPrinter.cpp wrt the alignment. You might try to round up the alignment to the highest allowed value, but this might be an overkill... -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Hi, Eli> Huh. For correctness, I guess you'll have to round up the alignment, > and abort on anything higher than 256. (Also, perhaps the front-end > should avoid generating such constructs in the first place when > targeting Windows, but that's a separate issue.)It depends on frontend :) I don't see why, for example, llvm-gcc for mingw32 should not generate such globals. Everything is perfect with gas. Also, for example, masm does not support weak symbols which is a requirement for more or less non-trivial C++ code -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Hi Eli, Sorry about that Visual Studio seems to have inserted tabs and I used an internal diff tool. Anyway, I synced TOT LLVM and made the changes with Emacs and the svn diff is attached. Regards, Ben -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Eli Friedman Sent: Tuesday, June 16, 2009 11:19 AM To: LLVM Developers Mailing List Subject: Re: [LLVMdev] x86 Intel Syntax and MASM 9.x On Tue, Jun 16, 2009 at 9:39 AM, Gaster, Benedict<Benedict.Gaster at amd.com> wrote:> Hi Eli, > > Yep I was being stupid. > > Please find attached a patch for initial changes to get MASM working.Patch looks fine except that it has tabs (LLVM uses only spaces for indentation). Also, can you generate the patch using "svn diff"? It's currently in some unusual format which "patch" doesn't recognize.> There is still one problem that I am looking into around changing > alignments within SEGMENTS. The problem is that MASM allows 2,4,16,256 > alignments, default being 16, but LLVM is sometimes generating 32 > alignment, for example, consider the following code:Huh. For correctness, I guess you'll have to round up the alignment, and abort on anything higher than 256. (Also, perhaps the front-end should avoid generating such constructs in the first place when targeting Windows, but that's a separate issue.) -Eli _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- A non-text attachment was scrubbed... Name: masm.diff Type: application/octet-stream Size: 14450 bytes Desc: masm.diff URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090616/dce8d0f6/attachment.obj>