diff --git a/include/circt/Dialect/Sim/SimOps.td b/include/circt/Dialect/Sim/SimOps.td index 06a6cc8fd2c0..0c776ba5d6c3 100644 --- a/include/circt/Dialect/Sim/SimOps.td +++ b/include/circt/Dialect/Sim/SimOps.td @@ -150,7 +150,7 @@ def DPICallOp : SimOp<"func.dpi.call", } def FormatLitOp : SimOp<"fmt.lit", [Pure, ConstantLike]> { - let summary = "Literal string token"; + let summary = "Literal string fragment"; let description = [{ Creates a constant, raw ASCII string literal for formatted printing. The given string attribute will be outputted as is, @@ -300,7 +300,7 @@ def FormatStringConcatOp : SimOp<"fmt.concat", [Pure]> { let extraClassDeclaration = [{ /// Returns true iff all of the input strings are primitive - /// (i.e. non-concatenated) tokens or block arguments. + /// (i.e. non-concatenated) fragments or block arguments. bool isFlat() { return llvm::none_of(getInputs(), [](Value operand) { return !!operand.getDefiningOp(); diff --git a/include/circt/Dialect/Sim/SimTypes.td b/include/circt/Dialect/Sim/SimTypes.td index 90c901b5236b..6c9c3736751a 100644 --- a/include/circt/Dialect/Sim/SimTypes.td +++ b/include/circt/Dialect/Sim/SimTypes.td @@ -19,10 +19,10 @@ def FormatStringType : SimTypeDef<"FormatString"> { let summary = "Format string type"; let description = [{ - A format string type represents either a single formatting token or the - concatenation of an arbitrary but finite number of tokens. - A formatting token is either a static string literal or the association of - a dynamic hardware value with a format specifier. + A format string type represents either a single formatting fragment or the + concatenation of an arbitrary but finite number of fragments. + A formatting fragment is either a static string literal or the association + of a dynamic hardware value with a format specifier. }]; } diff --git a/lib/Dialect/Sim/SimOps.cpp b/lib/Dialect/Sim/SimOps.cpp index 7ae834a12931..adbd35e5b51a 100644 --- a/lib/Dialect/Sim/SimOps.cpp +++ b/lib/Dialect/Sim/SimOps.cpp @@ -220,7 +220,7 @@ LogicalResult FormatStringConcatOp::getFlattenedInputs( bool isCyclic = false; // Perform a DFS on this operation's concatenated operands, - // collect the leaf format string tokens. + // collect the leaf format string fragments. concatStack.insert({*this, 0}); while (!concatStack.empty()) { auto &top = concatStack.back(); diff --git a/lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp b/lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp index bab4db6485df..8622b25bd486 100644 --- a/lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp +++ b/lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp @@ -44,7 +44,7 @@ struct ProceduralizeSimPass : impl::ProceduralizeSimBase { private: LogicalResult proceduralizePrintOps(Value clock, ArrayRef printOps); - SmallVector getPrintTokens(PrintFormattedOp op); + SmallVector getPrintFragments(PrintFormattedOp op); void cleanup(); // Mapping Clock -> List of printf ops @@ -60,8 +60,8 @@ LogicalResult ProceduralizeSimPass::proceduralizePrintOps( // List of uniqued values to become arguments of the TriggeredOp. SmallSetVector arguments; - // Map printf ops -> flattened list of tokens - SmallDenseMap, 4> tokenMap; + // Map printf ops -> flattened list of fragments + SmallDenseMap, 4> fragmentMap; SmallVector locs; SmallDenseSet alwaysEnabledConditions; @@ -82,7 +82,7 @@ LogicalResult ProceduralizeSimPass::proceduralizePrintOps( // Accumulate locations locs.push_back(printOp.getLoc()); - // Get the flat list of formatting tokens and collect leaf tokens + // Get the flat list of formatting fragments and collect leaf fragments SmallVector flatString; if (auto concatInput = printOp.getInput().getDefiningOp()) { @@ -96,22 +96,22 @@ LogicalResult ProceduralizeSimPass::proceduralizePrintOps( flatString.push_back(printOp.getInput()); } - auto &tokenList = tokenMap[printOp]; - assert(tokenList.empty() && "printf operation visited twice."); + auto &fragmentList = fragmentMap[printOp]; + assert(fragmentList.empty() && "printf operation visited twice."); - for (auto &token : flatString) { - auto *fmtOp = token.getDefiningOp(); + for (auto &fragment : flatString) { + auto *fmtOp = fragment.getDefiningOp(); if (!fmtOp) { printOp.emitError("Proceduralization of format strings passed as block " "argument is unsupported."); return failure(); } - tokenList.push_back(fmtOp); - // For non-literal tokens, the value to be formatted has to become an + fragmentList.push_back(fmtOp); + // For non-literal fragments, the value to be formatted has to become an // argument. if (!llvm::isa(fmtOp)) { auto fmtVal = getFormattedValue(fmtOp); - assert(!!fmtVal && "Unexpected foramtting token op."); + assert(!!fmtVal && "Unexpected foramtting fragment op."); arguments.insert(fmtVal); } } @@ -161,18 +161,18 @@ LogicalResult ProceduralizeSimPass::proceduralizePrintOps( } } - // Create a copy of the required token operations within the TriggeredOp's - // body. - auto tokens = tokenMap[printOp]; + // Create a copy of the required fragment operations within the + // TriggeredOp's body. + auto fragments = fragmentMap[printOp]; SmallVector clonedOperands; builder.setInsertionPointToStart(trigOp.getBodyBlock()); - for (auto *token : tokens) { - auto &fmtCloned = cloneMap[token]; + for (auto *fragment : fragments) { + auto &fmtCloned = cloneMap[fragment]; if (!fmtCloned) - fmtCloned = builder.clone(*token, argumentMapper); + fmtCloned = builder.clone(*fragment, argumentMapper); clonedOperands.push_back(fmtCloned->getResult(0)); } - // Concatenate tokens to a single value if necessary. + // Concatenate fragments to a single value if necessary. Value procPrintInput; if (clonedOperands.size() != 1) procPrintInput = builder.createOrFold( @@ -208,7 +208,7 @@ LogicalResult ProceduralizeSimPass::proceduralizePrintOps( return success(); } -// Prune the DAGs of formatting tokens left outside of the newly created +// Prune the DAGs of formatting fragments left outside of the newly created // TriggeredOps. void ProceduralizeSimPass::cleanup() { SmallVector cleanupNextList;