]> granicus.if.org Git - llvm/commitdiff
[Targets] Don't automatically include the scheduler class enum from *GenInstrInfo...
authorCraig Topper <craig.topper@intel.com>
Wed, 13 Dec 2017 07:26:17 +0000 (07:26 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 13 Dec 2017 07:26:17 +0000 (07:26 +0000)
Most of the targets don't need the scheduler class enum.

I have an X86 scheduler model change that causes some names in the enum to become about 18000 characters long. This is because using instregex in scheduler models causes the scheduler class to get named with every instruction that matches the regex concatenated together. MSVC has a limit of 4096 characters for an identifier name. Rather than trying to come up with way to reduce the name length, I'm just going to sidestep the problem by not including the enum in X86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320552 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h
lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h
utils/TableGen/InstrInfoEmitter.cpp

index 56bcff487174faa4f15e051d11392e114d411079..0b3563303ad04561d867962dd5a9f5232cb356cf 100644 (file)
@@ -60,7 +60,9 @@ createAMDGPUELFObjectWriter(bool Is64Bit, uint8_t OSABI,
 
 #define GET_INSTRINFO_ENUM
 #define GET_INSTRINFO_OPERAND_ENUM
+#define GET_INSTRINFO_SCHED_ENUM
 #include "AMDGPUGenInstrInfo.inc"
+#undef GET_INSTRINFO_SCHED_ENUM
 #undef GET_INSTRINFO_OPERAND_ENUM
 #undef GET_INSTRINFO_ENUM
 
index e53208fffee671cf55dda797e273139127fdb889..05d17c368dcc136e69bfad8151cf182cfc5152bd 100644 (file)
@@ -82,6 +82,7 @@ unsigned HexagonGetLastSlot();
 // Defines symbolic names for the Hexagon instructions.
 //
 #define GET_INSTRINFO_ENUM
+#define GET_INSTRINFO_SCHED_ENUM
 #include "HexagonGenInstrInfo.inc"
 
 #define GET_SUBTARGETINFO_ENUM
index 99fec6c554b0699f541fba075b2aadcde49a2caf..80a74c09a598aaacf9fe66113d3b93edd38de12f 100644 (file)
@@ -101,6 +101,7 @@ static inline bool isRunOfOnes(unsigned Val, unsigned &MB, unsigned &ME) {
 // Defines symbolic names for the PowerPC instructions.
 //
 #define GET_INSTRINFO_ENUM
+#define GET_INSTRINFO_SCHED_ENUM
 #include "PPCGenInstrInfo.inc"
 
 #define GET_SUBTARGETINFO_ENUM
index e270a17356f73b35283bd7ba4a0bb7ab4e2b9ec4..379e3245d066320bd2dcb3557c6c870eb382be84 100644 (file)
@@ -588,6 +588,14 @@ void InstrInfoEmitter::emitEnums(raw_ostream &OS) {
     OS << "    " << Inst->TheDef->getName() << "\t= " << Num++ << ",\n";
   OS << "    INSTRUCTION_LIST_END = " << Num << "\n";
   OS << "  };\n\n";
+  OS << "} // end " << Namespace << " namespace\n";
+  OS << "} // end llvm namespace\n";
+  OS << "#endif // GET_INSTRINFO_ENUM\n\n";
+
+  OS << "#ifdef GET_INSTRINFO_SCHED_ENUM\n";
+  OS << "#undef GET_INSTRINFO_SCHED_ENUM\n";
+  OS << "namespace llvm {\n\n";
+  OS << "namespace " << Namespace << " {\n";
   OS << "namespace Sched {\n";
   OS << "  enum {\n";
   Num = 0;
@@ -599,7 +607,7 @@ void InstrInfoEmitter::emitEnums(raw_ostream &OS) {
   OS << "} // end " << Namespace << " namespace\n";
   OS << "} // end llvm namespace\n";
 
-  OS << "#endif // GET_INSTRINFO_ENUM\n\n";
+  OS << "#endif // GET_INSTRINFO_SCHED_ENUM\n\n";
 }
 
 namespace llvm {