Prevention register promotion at the isel codegen phase

I am trying to implement mem-mem operations, but I can’t seem to figure out how to prevent register promotion for most cases.

I can successfully compile:
int foo(int a, int b){
return a + b;

because it gets matched to store(add(load)(load)), but when I attempt to compile:

int foo(int a, int b, int c){
return a + b + c;

I can’t match the add anymore since it is of the form store(add(add(load)(load))(load)). I think I need to figure out how to force a load/store between the two adds. I am not sure where to load/store to though, I need to allocate a spill location or something I assume.

Any insight would be greatly appreciated.