mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-03 14:08:57 +00:00
add some notes for simplifylibcalls optimizations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61385 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2e24342570
commit
9cf8ef63c6
@ -1461,3 +1461,28 @@ void foo (int a, struct T b)
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
simplifylibcalls should do several optimizations for strspn/strcspn:
|
||||
|
||||
strcspn(x, "") -> strlen(x)
|
||||
strcspn("", x) -> 0
|
||||
strspn("", x) -> 0
|
||||
strspn(x, "") -> strlen(x)
|
||||
strspn(x, "a") -> strchr(x, 'a')-x
|
||||
|
||||
strcspn(x, "a") -> inlined loop for up to 3 letters (similarly for strspn):
|
||||
|
||||
size_t __strcspn_c3 (__const char *__s, int __reject1, int __reject2,
|
||||
int __reject3) {
|
||||
register size_t __result = 0;
|
||||
while (__s[__result] != '\0' && __s[__result] != __reject1 &&
|
||||
__s[__result] != __reject2 && __s[__result] != __reject3)
|
||||
++__result;
|
||||
return __result;
|
||||
}
|
||||
|
||||
This should turn into a switch on the character. See PR3253 for some notes on
|
||||
codegen.
|
||||
|
||||
456.hmmer apparently uses strcspn and strspn a lot. 471.omnetpp uses strspn.
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user