mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Implement Function::getIntrinsicID without it needing to call Value::getName,
which allocates a string. This speeds up instcombine on 447.dealII by 5%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34318 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
638417f788
commit
3b515802f6
@ -160,12 +160,15 @@ void Function::dropAllReferences() {
|
|||||||
/// llvm/Intrinsics.h.
|
/// llvm/Intrinsics.h.
|
||||||
///
|
///
|
||||||
unsigned Function::getIntrinsicID() const {
|
unsigned Function::getIntrinsicID() const {
|
||||||
const std::string& Name = this->getName();
|
const ValueName *ValName = this->getValueName();
|
||||||
if (Name.size() < 5 || Name[4] != '.' || Name[0] != 'l' || Name[1] != 'l'
|
unsigned Len = ValName->getKeyLength();
|
||||||
|
const char *Name = ValName->getKeyData();
|
||||||
|
|
||||||
|
if (Len < 5 || Name[4] != '.' || Name[0] != 'l' || Name[1] != 'l'
|
||||||
|| Name[2] != 'v' || Name[3] != 'm')
|
|| Name[2] != 'v' || Name[3] != 'm')
|
||||||
return 0; // All intrinsics start with 'llvm.'
|
return 0; // All intrinsics start with 'llvm.'
|
||||||
|
|
||||||
assert(Name.size() != 5 && "'llvm.' is an invalid intrinsic name!");
|
assert(Len != 5 && "'llvm.' is an invalid intrinsic name!");
|
||||||
|
|
||||||
#define GET_FUNCTION_RECOGNIZER
|
#define GET_FUNCTION_RECOGNIZER
|
||||||
#include "llvm/Intrinsics.gen"
|
#include "llvm/Intrinsics.gen"
|
||||||
|
@ -81,17 +81,19 @@ EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
OS << "// Function name -> enum value recognizer code.\n";
|
OS << "// Function name -> enum value recognizer code.\n";
|
||||||
OS << "#ifdef GET_FUNCTION_RECOGNIZER\n";
|
OS << "#ifdef GET_FUNCTION_RECOGNIZER\n";
|
||||||
OS << " switch (Name[5]) {\n";
|
OS << " switch (Name[5]) {\n";
|
||||||
OS << " default: break;\n";
|
OS << " default:\n";
|
||||||
// Emit the intrinsics in sorted order.
|
// Emit the intrinsics in sorted order.
|
||||||
char LastChar = 0;
|
char LastChar = 0;
|
||||||
for (std::map<std::string, std::string>::iterator I = IntMapping.begin(),
|
for (std::map<std::string, std::string>::iterator I = IntMapping.begin(),
|
||||||
E = IntMapping.end(); I != E; ++I) {
|
E = IntMapping.end(); I != E; ++I) {
|
||||||
if (I->first[5] != LastChar) {
|
if (I->first[5] != LastChar) {
|
||||||
LastChar = I->first[5];
|
LastChar = I->first[5];
|
||||||
|
OS << " break;\n";
|
||||||
OS << " case '" << LastChar << "':\n";
|
OS << " case '" << LastChar << "':\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " if (Name == \"" << I->first << "\") return Intrinsic::"
|
OS << " if (Len == " << I->first.size()
|
||||||
|
<< " && !strcmp(Name, \"" << I->first << "\")) return Intrinsic::"
|
||||||
<< I->second << ";\n";
|
<< I->second << ";\n";
|
||||||
}
|
}
|
||||||
OS << " }\n";
|
OS << " }\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user