[EMAIL PROTECTED] wrote: > my intention is to add a pass at the Gimple (maybe SSA) level. The > current problem is that I would like to generate code that saves the > contents of the stack to a different memory location. Is there a way to > access stack pointer and stack size (and the direction in which the > stack is growing) on the tree level? > > I already found STACK_SIZE and FRAME_ADDRESS on the RTL level, but would > like to avoid adding an RTL pass.
The stack doesn't exist yet at Gimple level. Stack slots are allocated later. Much, much later. > The explanation why I want to save the stack contents is the following: > Code: > > ... use stack variables > > __tm_atomic { /* begin transaction */ > > access shared locations in here > > } /* may rollback */ > > In case of a rollback the original context of the thread must be > restored so that it may execute the transaction again. This will be done > using setjmp/longjmp. To prevent instrumenting all accesses to stack > variables inside the transaction with STM runtime calls, the stack > should be copied back from memory and the previous state of the stack > variables is restored. > > Any suggestions are helpful, thank you very much. If this is to be done in the compiler at all, it's going to have to be done very late. Also, you'll be violating many of the assumptions the compiler makes about, for example, the state of registers and volatile variables. Andrew.