Index: llvm/include/llvm/MC/MCAsmInfo.h =================================================================== --- llvm/include/llvm/MC/MCAsmInfo.h +++ llvm/include/llvm/MC/MCAsmInfo.h @@ -122,10 +122,14 @@ /// other when on the same line. Defaults to ';' const char *SeparatorString; - /// This indicates the comment character used by the assembler. Defaults to + /// This indicates the comment string used by the assembler. Defaults to /// "#" StringRef CommentString; + /// This indicates whether the comment string is only accepted as a comment + /// at the beginning of statements. Defaults to false. + bool RestrictCommentStringToStartOfStatement = false; + /// This is appended to emitted labels. Defaults to ":" const char *LabelSuffix; @@ -549,6 +553,9 @@ unsigned getCommentColumn() const { return 40; } StringRef getCommentString() const { return CommentString; } + bool getRestrictCommentStringToStartOfStatement() const { + return RestrictCommentStringToStartOfStatement; + } const char *getLabelSuffix() const { return LabelSuffix; } bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; } Index: llvm/lib/MC/MCParser/AsmLexer.cpp =================================================================== --- llvm/lib/MC/MCParser/AsmLexer.cpp +++ llvm/lib/MC/MCParser/AsmLexer.cpp @@ -659,6 +659,9 @@ } bool AsmLexer::isAtStartOfComment(const char *Ptr) { + if (MAI.getRestrictCommentStringToStartOfStatement() && !IsAtStartOfStatement) + return false; + StringRef CommentString = MAI.getCommentString(); if (CommentString.size() == 1) Index: llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp =================================================================== --- llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp +++ llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp @@ -23,7 +23,8 @@ MaxInstLength = 6; - CommentString = "#"; + CommentString = AssemblerDialect == AD_HLASM ? "*" : "#"; + RestrictCommentStringToStartOfStatement = (AssemblerDialect == AD_HLASM); ZeroDirective = "\t.space\t"; Data64bitsDirective = "\t.quad\t"; UsesELFSectionDirectiveForBSS = true;