John,

Depending on the OPT, ARCH and TUNE compiler settings I suspect it may be an 
optimization to avoid AGI (Address Generation Interlock).  Nothing to do with 
alignment per se.

And to your desire to replace the C prologue and epilogue -- Check out Metal C. 
 It allows you to do precisely that.  You lose almost all I/O facilities 
though, and you are thus forced / allowed to use inline assembler I/O or your 
own custom-built I/O subroutines.

HTH

Peter

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of John McKown
Sent: Thursday, October 22, 2015 10:59 AM
To: [email protected]
Subject: Re: C lang. embedded HLASM latest z/OS 2.1

On Thu, Oct 22, 2015 at 9:40 AM, Elardus Engelbrecht <
[email protected]> wrote:

> John McKown wrote:
>
> >Mainly that the compiler inserted an NOPR 0 after my simple command.
>
> Hmmm, I remembered that Borland Turbo Pascal [1] could do that similar
> trick, but I don't have MSDOS and Pascal anymore.
>
> I never tried that [inserting machine code to speed up things] out with C
> and C++.
>
> > *000004 0700                           9          NOPR  0
> > 000074  581D  00B0        000009 |                 L        r1,176(r13,)
>
> Is that compiler action just for [full word / half word?] alignment?
> Increase/decrease the instruction length by 1 or 2 bytes with same or other
> instruction and see where it ends up.
>

​Hum, I inserted a second instruction "LR 2,1" after the first one:

                           000009 |       *      __asm(" L 1,%0\n LR
2,1":"=m"(i3)::"r1","r2");
 *000000 581D 00B0            000B0     8          L     1,176(13)
                                        000009
 *000004 1821                           9          LR    2,1
                                        000009
 *000006 0700                          10          NOPR  0
                                        000009
 000074  581D  00B0        000009 |                 L        r1,176(r13,)

 000078  1821              000009 |                 LR       r2,r1

 00007A  0700              000009 |                 NOPR     0
                           000010 |       *      printf("%.*s\n",i1,word);
​

​The NOPR is still there. I wonder if it is somehow used if I were to set a
break point in a debugging session. I.e. the NOPR is there so that it can
be overlain with the debug SVC or whatever is used.​

​I'm just doing this to see if I can get up to the real desire: to embed
assembler macros, such as TPG (TSO terminal I/O), in my C code. ​Although
it might actually be simpler to just continue writing LE enabled HLASM
"service" routines.
​ Hum, wish I had a way to make an HLASM "program" which could be "in
lined" by the C compiler in order to avoid the entry/exit code overhead. I
am still, perhaps stupidly, concerned with "CPU overhead".​ If I weren't I
could be a Windows programmer! <grin type="snide"/>

-- 


This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to