mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:50:30 +00:00
[tblgen] GCC/MS builtin to target intrisics map.
Patch by Ettore Speziale Allow TableGen to generate static functions to perform GCC/MS builtin name to target specific intrinsic ID mapping. https://reviews.llvm.org/D31150 llvm-svn: 300735
This commit is contained in:
parent
84d0c8fabe
commit
3ace9dee64
@ -27,6 +27,8 @@ class StringToOffsetTable {
|
||||
std::string AggregateString;
|
||||
|
||||
public:
|
||||
bool Empty() const { return StringOffset.empty(); }
|
||||
|
||||
unsigned GetOrAddStringOffset(StringRef Str, bool appendZero = true) {
|
||||
auto IterBool =
|
||||
StringOffset.insert(std::make_pair(Str, AggregateString.size()));
|
||||
|
@ -84,14 +84,11 @@ void IntrinsicEmitter::run(raw_ostream &OS) {
|
||||
// Emit the intrinsic parameter attributes.
|
||||
EmitAttributes(Ints, OS);
|
||||
|
||||
// Individual targets don't need GCC builtin name mappings.
|
||||
if (!TargetOnly) {
|
||||
// Emit code to translate GCC builtins into LLVM intrinsics.
|
||||
EmitIntrinsicToBuiltinMap(Ints, true, OS);
|
||||
// Emit code to translate GCC builtins into LLVM intrinsics.
|
||||
EmitIntrinsicToBuiltinMap(Ints, true, OS);
|
||||
|
||||
// Emit code to translate MS builtins into LLVM intrinsics.
|
||||
EmitIntrinsicToBuiltinMap(Ints, false, OS);
|
||||
}
|
||||
// Emit code to translate MS builtins into LLVM intrinsics.
|
||||
EmitIntrinsicToBuiltinMap(Ints, false, OS);
|
||||
|
||||
EmitSuffix(OS);
|
||||
}
|
||||
@ -756,6 +753,17 @@ void IntrinsicEmitter::EmitIntrinsicToBuiltinMap(
|
||||
<< "Builtin(const char "
|
||||
<< "*TargetPrefixStr, StringRef BuiltinNameStr) {\n";
|
||||
}
|
||||
|
||||
if (Table.Empty()) {
|
||||
OS << " return ";
|
||||
if (!TargetPrefix.empty())
|
||||
OS << "(" << TargetPrefix << "Intrinsic::ID)";
|
||||
OS << "Intrinsic::not_intrinsic;\n";
|
||||
OS << "}\n";
|
||||
OS << "#endif\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
OS << " static const char BuiltinNames[] = {\n";
|
||||
Table.EmitCharArray(OS);
|
||||
OS << " };\n\n";
|
||||
|
Loading…
Reference in New Issue
Block a user