I am new to compilers so maybe what I am about to describe is normal behaviour. My current retargeting efforts are starting to generate working code. However, it has a lot of the instruction sequence below in there:
#1 stw r1,-2(bp)
#2 ldw r4, -2(bp)
#3 addi r4,1,r4
#4 stw r4,-2(bp)
#5 ldw r1, -2(bp)
We are storing something in memory from register-1 (R1). Then reloading that value in R4. Do something with it. Store it in memory. Then immediately reloading that again.
It's obvious instructions #2 and #5 could be avoided with better register selection. Is this something i can tweak in my .md file somehow? Or is this just normal compiler behaviour?
Thanks,
Erwin
I fully agree of course.
I was just wondering if there was something obvious I was missing in the lcc machine description language.
What I gather is that any optimisation for these types of occurrences will be separate from lcc.
Thx,
Erwin
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 152:20:02 |
| Calls: | 12,091 |
| Calls today: | 4 |
| Files: | 15,000 |
| Messages: | 6,517,636 |