[llvm] Treat ';' and '\n' as assembly instruction separators in collectAsmInstrs (PR #149365)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 18 13:51:29 PDT 2025
================
@@ -60,17 +60,41 @@ FunctionType *InlineAsm::getFunctionType() const {
return FTy;
}
-void InlineAsm::collectAsmStrs(SmallVectorImpl<StringRef> &AsmStrs) const {
+SmallVector<StringRef> InlineAsm::collectAsmInstrs() const {
+ if (AsmString.empty())
+ return {};
StringRef AsmStr(AsmString);
- AsmStrs.clear();
-
- // TODO: 1) Unify delimiter for inline asm, we also meet other delimiters
- // for example "\0A", ";".
- // 2) Enhance StringRef. Some of the special delimiter ("\0") can't be
- // split in StringRef. Also empty StringRef can not call split (will stuck).
- if (AsmStr.empty())
- return;
- AsmStr.split(AsmStrs, "\n\t", -1, false);
+ // First break the assembly string into lines.
+ SmallVector<StringRef, 4> AsmLines;
+ AsmStr.split(AsmLines, '\n', -1, false);
----------------
mingmingl-llvm wrote:
sg.
https://github.com/llvm/llvm-project/pull/149365
More information about the llvm-commits
mailing list