I want to implement push and pop operations in an LLVM assembly.
The alloca command does not follow the concept of stack, push and pop.
Examples:
PUSH
x 86
subl $4, %esp
movl %eax, 0(%esp)
or
pushl %eax
MIPS
addi $sp, $sp, -4
sw $t2, 0($sp)
POP
x 86
movl 0(%esp), %eax
addl $4, %esp
or
popl %eax
MIPS
lw $t2, 0($sp)
addi $sp, $sp, 4
EDIT 1:
I need a platform independent solution.
First
I want to use the top of the stack to store temporary objects.
"a * b + c * d + e * f" , . "a * b" , "a" "b" , , , "a * b", "a" "".
call_function( &Object(), &(a + b) );
"& Object()" , , .
. , . , , .