diff options
| author | Reid Kleckner <rnk@google.com> | 2018-06-23 02:02:38 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2018-06-23 02:02:38 +0000 |
| commit | f5890e4e4317c1bb9a25f29a44ab009604f09e4b (patch) | |
| tree | d565302ce953c36187b0ad7bb71e115f671e97c9 /llvm/utils/TableGen/IntrinsicEmitter.cpp | |
| parent | 5c25346912689400f5a786790bde6138b2d96d07 (diff) | |
| download | bcm5719-llvm-f5890e4e4317c1bb9a25f29a44ab009604f09e4b.tar.gz bcm5719-llvm-f5890e4e4317c1bb9a25f29a44ab009604f09e4b.zip | |
[IR] Split Intrinsics.inc into enums and implementations
Implements PR34259
Intrinsics.h is a very popular header. Most LLVM TUs care about things
like dbg_value, but they don't care how they are implemented. After I
split these out, IntrinsicImpl.inc is 1.7 MB, so this saves each LLVM TU
from scanning 1.7 MB of source that gets pre-processed away.
It also means we can modify intrinsic properties without triggering a
full rebuild, but that's probably less of a win.
I think the next best thing to do would be to split out the target
intrinsics into their own header. Very, very few TUs care about
target-specific intrinsics. It's very hard to split up the target
independent intrinsics like llvm.expect, assume, and dbg.value, though.
llvm-svn: 335407
Diffstat (limited to 'llvm/utils/TableGen/IntrinsicEmitter.cpp')
| -rw-r--r-- | llvm/utils/TableGen/IntrinsicEmitter.cpp | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp index 78a17cde468..65d74ef90a4 100644 --- a/llvm/utils/TableGen/IntrinsicEmitter.cpp +++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -34,7 +34,7 @@ public: IntrinsicEmitter(RecordKeeper &R, bool T) : Records(R), TargetOnly(T) {} - void run(raw_ostream &OS); + void run(raw_ostream &OS, bool Enums); void EmitPrefix(raw_ostream &OS); @@ -56,7 +56,7 @@ public: // IntrinsicEmitter Implementation //===----------------------------------------------------------------------===// -void IntrinsicEmitter::run(raw_ostream &OS) { +void IntrinsicEmitter::run(raw_ostream &OS, bool Enums) { emitSourceFileHeader("Intrinsic Function Source Fragment", OS); CodeGenIntrinsicTable Ints(Records, TargetOnly); @@ -66,29 +66,31 @@ void IntrinsicEmitter::run(raw_ostream &OS) { EmitPrefix(OS); - // Emit the enum information. - EmitEnumInfo(Ints, OS); - - // Emit the target metadata. - EmitTargetInfo(Ints, OS); + if (Enums) { + // Emit the enum information. + EmitEnumInfo(Ints, OS); + } else { + // Emit the target metadata. + EmitTargetInfo(Ints, OS); - // Emit the intrinsic ID -> name table. - EmitIntrinsicToNameTable(Ints, OS); + // Emit the intrinsic ID -> name table. + EmitIntrinsicToNameTable(Ints, OS); - // Emit the intrinsic ID -> overload table. - EmitIntrinsicToOverloadTable(Ints, OS); + // Emit the intrinsic ID -> overload table. + EmitIntrinsicToOverloadTable(Ints, OS); - // Emit the intrinsic declaration generator. - EmitGenerator(Ints, OS); + // Emit the intrinsic declaration generator. + EmitGenerator(Ints, OS); - // Emit the intrinsic parameter attributes. - EmitAttributes(Ints, OS); + // Emit the intrinsic parameter attributes. + EmitAttributes(Ints, OS); - // 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); } @@ -839,6 +841,12 @@ void IntrinsicEmitter::EmitIntrinsicToBuiltinMap( OS << "#endif\n\n"; } -void llvm::EmitIntrinsics(RecordKeeper &RK, raw_ostream &OS, bool TargetOnly) { - IntrinsicEmitter(RK, TargetOnly).run(OS); +void llvm::EmitIntrinsicEnums(RecordKeeper &RK, raw_ostream &OS, + bool TargetOnly) { + IntrinsicEmitter(RK, TargetOnly).run(OS, /*Enums=*/true); +} + +void llvm::EmitIntrinsicImpl(RecordKeeper &RK, raw_ostream &OS, + bool TargetOnly) { + IntrinsicEmitter(RK, TargetOnly).run(OS, /*Enums=*/false); } |

