mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-19 02:42:58 +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:
parent
7e8443fd5a
commit
dba382b16a
@ -411,3 +411,19 @@ void clearbit(int *target, int 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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user