mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-13 04:24:40 +00:00
add a simple optimization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26062 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -411,3 +411,19 @@ void clearbit(int *target, int bit) {
|
|||||||
*target &= ~(1 << bit);
|
*target &= ~(1 << bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===---------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
Easy: Global addresses are not always allowed as immediates. For this:
|
||||||
|
|
||||||
|
int dst = 0; int *ptr = 0;
|
||||||
|
void foo() { ptr = &dst; }
|
||||||
|
|
||||||
|
we get this:
|
||||||
|
|
||||||
|
_foo:
|
||||||
|
movl $_dst, %eax
|
||||||
|
movl %eax, _ptr
|
||||||
|
ret
|
||||||
|
|
||||||
|
When: "movl $_dst, _ptr" is sufficient.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user