MSP430F5359: TI's CGT C/C++ compiler/assembler: How does inline asm() (assembly language) access C/C++'s variables?

Part Number: MSP430F5359

Tool/software:

Background: I'm most familiar with IAR's icc430 C/C++ compilation environment and a newbie at using TI's CGT MSP430 environment.

In the IAR world, if I want to embed a bit of inline assembly language into an otherwise-C/C++ routine, I can say something like this:

Checksum_T Checksums::computeChecksum( uint32 const FirstByteInRegion_Address, uint32 const RegionBytecount, Checksum_T const Seed )
{
   Checksum_T checksum = Seed;
   U16ConstPointer20_T Byte_ptr              = (U16ConstPointer20_T)FirstByteInRegion_Address;
   uint32                           remainingWords = RegionBytecount / 2UL;

   while ( remainingWords != 0UL )
   {
      checksum += *Byte_ptr;
      asm( "ADC.W %0"           /* Add the end-around-carry to the accumulating checksum value (can be either %0 or %1) */
               : "=r"( checksum )   /* %0 is our output parameter ("checksum")                                                                            */
               : "r"( checksum )     /* %1 is our input parameter ("checksum")                                                                              */
               : "cc" );                    /* The list of clobbered resources (just the Condition Codes)                                                  */
      Byte_ptr++;
      remainingWords--;
   }

   return( checksum );
}

The %0, =r, r, and cc stuff creates an interface with the C compiler whereby the C compiler sets the assembly language pseudo-operand %0 to point to C's “checksum” data value. It also lets the C compiler know which of its resources my inline assembly code will affect or destroy so the compiler knows to avoid those/save those/accept values back from me.

Looking through SLAU132Y (the CGT Compiler manual) and SLAU131Y (the Assembler manual), I don't see any similar facility so it looks like I would need to read the assembly listings and customize my inline assembly code to access the correct resources (as determined by the C/C++ compiler). In fact, the Compiler manual states that what I'm asking is impossible:

The __asm statement does not provide any way to refer to local variables. If your assembly code
needs to refer to local variables, you will need to write the entire function in assembly code.

And later:

Do not change the value of a C/C++ variable when using an asm statement. This is because the
compiler does not verify such statements. They are inserted as is into the assembly code, and
potentially can cause problems if you are not sure of their effect.

Although I could imagine that if I were willing to accept a certain risk that the compiler could move things around “behind my back” (without notice), I could still write the code I'm proposing.

Do I understand the situation correctly? It's okay if this facility doesn't exist in CGT but it is one place where the IAR environment has a more-convenient implementation than does CGT environment.

**Attention** This is a public forum