You can determine how the code should be generated for subsystem blocks by the 'Function Packaging' parameter, which is, by default, set to 'Auto' for Simulink to automatically determine the packaging.
Making the subsystem reference 'Atomic' (which tells Simulink to treat the block as a single unit while generating code) and changing the 'Function Packaging' parameter to 'Reusable' results in the generation of reusable functions with call by reference implementations. The packaging can be set to 'Reusable' from Block Parameters of the subsystem > Check 'Treat as atomic unit' > Code Generation > Function Packaging > Reusable function.
The below sample model shows how to change the packaging and also the code generated for the model step function as a result -
The subsystem used in the reference -
Code generated -
Here, it can be seen that the 'exampleModel_SubsystemReference' can be reused and the data store variable is passed to the function via call by reference as the second parameter from the model step ('exampleModel_step').
Hope this answers your question! Thanks!