Is there a processor that do arithmetic operations on a stack and not on registers? To keep performance, of course, that processor should cache top block of a stack in the same type of memory that is used for registers.
I read in a paper (David R. Ditzel, H.R. McLellan. Register Allocation for Free: The C Machine Stack Cache.) that a cache is slower 2 times than registers because of:
- indirect addressing during every access to the cache;
- cache miss when the stack grows.
The paper is old. Maybe, improvements of processor design appeared that makes stack cache viable? I feel that it will reduce complexity of compilers and optimize copying between registers and the rest of memory.
Update 2012-10-18. Because this concept was well-known (not to me), I change the question to “… Modern processors?”
Update 2012-10-18. I feel I must say explicitly that I'm not talking about “zero address machine”. Caching and “zero address” are orthogonal. My hypothetical processor may have even 5-ary addition like “r3 := r0+r2+r11+r5+r8”. “r n” means the memory cell at sp+n, where sp is a stack pointer. sp changes before and after a code block. A very unusual program changes sp at every arithmetic operation.