Add '--decorations node' for inserting debug comments into emitted code.

This commit is contained in:
Wilson Snyder
2024-01-24 21:51:47 -05:00
parent c8a40e0b52
commit 354a534d68
25 changed files with 558 additions and 332 deletions
+5 -5
View File
@@ -66,7 +66,7 @@ class EmitCConstPool final : public EmitCConstInit {
void emitVars(const AstConstPool* poolp) {
std::vector<const AstVar*> varps;
for (AstNode* nodep = poolp->modp()->stmtsp(); nodep; nodep = nodep->nextp()) {
if (const AstVar* const varp = VN_CAST(nodep, Var)) { varps.push_back(varp); }
if (const AstVar* const varp = VN_CAST(nodep, Var)) varps.push_back(varp);
}
if (varps.empty()) return; // Constant pool is empty, so we are done
@@ -81,11 +81,11 @@ class EmitCConstPool final : public EmitCConstInit {
maybeSplitCFile();
const string nameProtect = topClassName() + "__ConstPool__" + varp->nameProtect();
puts("\n");
puts("extern const ");
puts(varp->dtypep()->cType(nameProtect, false, false));
puts(" = ");
putns(varp, "extern const ");
putns(varp, varp->dtypep()->cType(nameProtect, false, false));
putns(varp, " = ");
iterateConst(varp->valuep());
puts(";\n");
putns(varp, ";\n");
// Keep track of stats
if (VN_IS(varp->dtypep(), UnpackArrayDType)) {
++m_tablesEmitted;