mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-30 09:01:19 +00:00
Instruction mapper generator v1)
This commit is contained in:
parent
dc9e1482d4
commit
7dda80b67c
1887
llvm/utils/TableGen/Capstone/CapstoneGenMapper.h
Normal file
1887
llvm/utils/TableGen/Capstone/CapstoneGenMapper.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -44,6 +44,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "Capstone/CapstoneGenInfo.h"
|
||||
#include "Capstone/CapstoneGenMapper.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -55,4 +56,8 @@ void EmitCapstone(RecordKeeper &RK, raw_ostream &OS) {
|
||||
.run(OS);
|
||||
}
|
||||
|
||||
void EmitCapstoneMapper(RecordKeeper &RK, raw_ostream &OS) {
|
||||
CapstoneGenMapper(RK).run(OS);
|
||||
}
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -58,6 +58,7 @@ enum ActionType {
|
||||
GenDirectivesEnumDecl,
|
||||
GenDirectivesEnumImpl,
|
||||
GenCapstone,
|
||||
GenCapstoneMapper,
|
||||
};
|
||||
|
||||
namespace llvm {
|
||||
@ -141,7 +142,9 @@ cl::opt<ActionType> Action(
|
||||
clEnumValN(GenDirectivesEnumImpl, "gen-directive-impl",
|
||||
"Generate directive related implementation code"),
|
||||
clEnumValN(GenCapstone, "gen-capstone",
|
||||
"Generate file for capstone engine")));
|
||||
"Generate file for capstone engine"),
|
||||
clEnumValN(GenCapstoneMapper, "gen-capstone-mapper",
|
||||
"Generate instruction mapper for capstone")));
|
||||
|
||||
cl::OptionCategory PrintEnumsCat("Options for -print-enums");
|
||||
cl::opt<std::string> Class("class", cl::desc("Print Enum list for this class"),
|
||||
@ -218,15 +221,13 @@ bool LLVMTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
|
||||
case GenOptRST:
|
||||
EmitOptRST(Records, OS);
|
||||
break;
|
||||
case PrintEnums:
|
||||
{
|
||||
case PrintEnums: {
|
||||
for (Record *Rec : Records.getAllDerivedDefinitions(Class))
|
||||
OS << Rec->getName() << ", ";
|
||||
OS << "\n";
|
||||
break;
|
||||
}
|
||||
case PrintSets:
|
||||
{
|
||||
case PrintSets: {
|
||||
SetTheory Sets;
|
||||
Sets.addFieldExpander("Set", "Elements");
|
||||
for (Record *Rec : Records.getAllDerivedDefinitions("Set")) {
|
||||
@ -278,11 +279,14 @@ bool LLVMTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
|
||||
case GenCapstone:
|
||||
EmitCapstone(Records, OS);
|
||||
break;
|
||||
case GenCapstoneMapper:
|
||||
EmitCapstoneMapper(Records, OS);
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
InitLLVM X(argc, argv);
|
||||
|
@ -94,6 +94,7 @@ void EmitAutomata(RecordKeeper &RK, raw_ostream &OS);
|
||||
void EmitDirectivesDecl(RecordKeeper &RK, raw_ostream &OS);
|
||||
void EmitDirectivesImpl(RecordKeeper &RK, raw_ostream &OS);
|
||||
void EmitCapstone(RecordKeeper &RK, raw_ostream &OS);
|
||||
void EmitCapstoneMapper(RecordKeeper &RK, raw_ostream &OS);
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user