mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-20 09:30:43 +00:00
Autogenerate a table of intrinsic names, so we can map from intrinsic ID to
LLVM intrinsic function name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26771 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3f8b8913bc
commit
fda6affb95
@ -110,6 +110,9 @@ void IntrinsicEmitter::run(std::ostream &OS) {
|
||||
// Emit the enum information.
|
||||
EmitEnumInfo(Ints, OS);
|
||||
|
||||
// Emit the intrinsic ID -> name table.
|
||||
EmitIntrinsicToNameTable(Ints, OS);
|
||||
|
||||
// Emit the function name recognizer.
|
||||
EmitFnNameRecognizer(Ints, OS);
|
||||
|
||||
@ -158,9 +161,6 @@ EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
char LastChar = 0;
|
||||
for (std::map<std::string, std::string>::iterator I = IntMapping.begin(),
|
||||
E = IntMapping.end(); I != E; ++I) {
|
||||
assert(I->first.size() > 5 && std::string(I->first.begin(),
|
||||
I->first.begin()+5) == "llvm." &&
|
||||
"Invalid intrinsic name!");
|
||||
if (I->first[5] != LastChar) {
|
||||
LastChar = I->first[5];
|
||||
OS << " case '" << LastChar << "':\n";
|
||||
@ -175,6 +175,22 @@ EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
OS << "#endif\n\n";
|
||||
}
|
||||
|
||||
void IntrinsicEmitter::
|
||||
EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
std::ostream &OS) {
|
||||
std::vector<std::string> Names;
|
||||
for (unsigned i = 0, e = Ints.size(); i != e; ++i)
|
||||
Names.push_back(Ints[i].Name);
|
||||
std::sort(Names.begin(), Names.end());
|
||||
|
||||
OS << "// Intrinsic ID to name table\n";
|
||||
OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n";
|
||||
OS << " // Note that entry #0 is the invalid intrinsic!\n";
|
||||
for (unsigned i = 0, e = Names.size(); i != e; ++i)
|
||||
OS << " \"" << Names[i] << "\",\n";
|
||||
OS << "#endif\n\n";
|
||||
}
|
||||
|
||||
static void EmitTypeVerify(std::ostream &OS, const std::string &Val,
|
||||
Record *ArgType) {
|
||||
OS << " Assert1(" << Val << "->getTypeID() == "
|
||||
|
@ -31,6 +31,8 @@ namespace llvm {
|
||||
|
||||
void EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
std::ostream &OS);
|
||||
void EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
std::ostream &OS);
|
||||
void EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
std::ostream &OS);
|
||||
void EmitModRefInfo(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
|
Loading…
Reference in New Issue
Block a user