--- /dev/null
+X(A)
+X(B)
+X(S)
+X(Y)
+X(keep)
+X(src)
+X(whitebox)
+X(blackbox)
+X(allconst)
+X(allseq)
+X(anyconst)
+X(anyseq)
+X(defaultvalue)
+X(fsm_encoding)
+X(full_case)
+X(gclk)
+X(initial_top)
+X(is_interface)
+X(mem2reg)
+X(noblackbox)
+X(nolatches)
+X(nomem2reg)
+X(nosync)
+X(parallel_case)
+X(top)
+X(wand)
+X(wor)
 
 int RTLIL::IdString::last_created_idx_ptr_;
 #endif
 
-IdString RTLIL::ID::A;
-IdString RTLIL::ID::B;
-IdString RTLIL::ID::Y;
-IdString RTLIL::ID::keep;
-IdString RTLIL::ID::whitebox;
-IdString RTLIL::ID::blackbox;
+#define X(_id) IdString RTLIL::ID::_id;
+#include "constids.inc"
+#undef X
+
 dict<std::string, std::string> RTLIL::constpad;
 
 RTLIL::Const::Const()
 
        };
 
        namespace ID {
-               // defined in rtlil.cc, initialized in yosys.cc
-               extern IdString A, B, Y;
-               extern IdString keep;
-               extern IdString whitebox;
-               extern IdString blackbox;
+#define X(_id) extern IdString _id;
+#include "constids.inc"
+#undef X
        };
 
        extern dict<std::string, std::string> constpad;
 
                return;
        already_setup = true;
 
-       RTLIL::ID::A = "\\A";
-       RTLIL::ID::B = "\\B";
-       RTLIL::ID::Y = "\\Y";
-       RTLIL::ID::keep = "\\keep";
-       RTLIL::ID::whitebox = "\\whitebox";
-       RTLIL::ID::blackbox = "\\blackbox";
+#define X(_id) RTLIL::ID::_id = "\\" # _id;
+#include "constids.inc"
+#undef X
 
        #ifdef WITH_PYTHON
                PyImport_AppendInittab((char*)"libyosys", INIT_MODULE);