IC5Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Topic
  • No replies
Frank_O_Myers@IBM
Frank_O_Myers@IBM
5 Posts

Pinned topic Metal C inclusng a copy statement for globals

‏2011-05-24T14:41:29Z |
Hi,

I want to reference the IBM High Level Assembler Toolkit Structured Programming Macros in my __asm(...) statements. To do so, I need to insert a " COPY ASMSP" statement near the top of the generated assembly source file. Metal C seems to generate any statements inserted via "pragma insert_asm" much further down in the generated source file. How can I generate an insert of the " COPY ASMSP" near the top of the generated assembly source file?

Thanks, in advance, for all your help.

Frank Myers
Updated on 2011-05-24T19:04:22Z at 2011-05-24T19:04:22Z by Visda
  • Visda
    Visda
    22 Posts

    Re: Metal C inclusng a copy statement for globals

    ‏2011-05-24T19:04:22Z  
    Hello, Frank,

    I am assuming you have access to a z/OS XL C/C++ V1R10 or higher, because support for #pragma insert_asm was added to the Metal C in V1R10.
    There are two ways to get the HLASM statement near the top of the generated assembly source file. For both ways you have to provide your own prolog.

    1. Include the HLASM statement in the supplied prolog:
    e.g. #pragma prolog(foo, " COPY ASMSP"), the string enclosed in double quotes will appear in the generated assembly source file (relatively) near the top, more precisely write before the function start, e.g.
    COPY ASMSP 000025
    @@BGN@1 DS 0H 000025
    USING @@AUTO@1,13 000025
    STMH 14,1,88(13) 000025
    • { 000026

    2. Use &CCN_IASM_MACRO and &CCN_IASM_FRONT set symbols introduced in z/OS XL C/C++ V1R11. This feature was added to specifically address gathering and grouping the HLASM statements inserted via #pragma insert_asm in a HLASM Macro like shape and form write at the top of the HLASM generated source.
    e.g.
    /*insert-asm.c*/
    #pragma insert_asm(" COPY ASMSP")
    #pragma prolog(foo, " MYPROLOG")
    void foo() {
    return;
    }
    xlc -qmetal -S insert-asm.c
    TITLE '5694A01 V1.11 z/OS XL C X 000000
    ./insert_asm.c' 000000
    MACRO 000000
    @@IASM@ 000000
    COPY ASMSP 000008
    MEND 000008
    The set symbols are documented in Chapter 1, Metal C Programming Guide.

    Hope this helps.

    Thanks,
    Visda