Index: include/llvm/MC/MCAsmInfo.h =================================================================== --- include/llvm/MC/MCAsmInfo.h +++ include/llvm/MC/MCAsmInfo.h @@ -128,6 +128,12 @@ /// a plain private symbol should be used. Defaults to "". StringRef LinkerPrivateGlobalPrefix; + /// For an assignment x = y, generate it as: + /// AssignmentDirective x AssignmentOperator y + /// The default directive is empty and the default operator is '='. + const char *AssignmentDirective; + const char *AssignmentOperator; + /// If these are nonempty, they contain a directive to emit before and after /// an inline assembly statement. Defaults to "#APP\n", "#NO_APP\n" const char *InlineAsmStart; @@ -486,6 +492,9 @@ return getPrivateGlobalPrefix(); } + const char *getAssignmentDirective() const { return AssignmentDirective; } + const char *getAssignmentOperator() const { return AssignmentOperator; } + const char *getInlineAsmStart() const { return InlineAsmStart; } const char *getInlineAsmEnd() const { return InlineAsmEnd; } const char *getCode16Directive() const { return Code16Directive; } Index: lib/MC/MCAsmInfo.cpp =================================================================== --- lib/MC/MCAsmInfo.cpp +++ lib/MC/MCAsmInfo.cpp @@ -29,6 +29,8 @@ LinkerPrivateGlobalPrefix = ""; InlineAsmStart = "APP"; InlineAsmEnd = "NO_APP"; + AssignmentDirective = ""; + AssignmentOperator = " = "; Code16Directive = ".code16"; Code32Directive = ".code32"; Code64Directive = ".code64"; Index: lib/MC/MCAsmStreamer.cpp =================================================================== --- lib/MC/MCAsmStreamer.cpp +++ lib/MC/MCAsmStreamer.cpp @@ -528,8 +528,11 @@ } void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { + StringRef Dir = MAI->getAssignmentDirective(); + if (!Dir.empty()) + OS << Dir << ' '; Symbol->print(OS, MAI); - OS << " = "; + OS << MAI->getAssignmentOperator(); Value->print(OS, MAI); EmitEOL(); Index: lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp =================================================================== --- lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp +++ lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp @@ -28,6 +28,8 @@ LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; + AssignmentDirective = ".set"; + AssignmentOperator = ", "; ZeroDirective = "\t.space\t"; AscizDirective = "\t.string\t"; Index: test/MC/Hexagon/assign.s =================================================================== --- /dev/null +++ test/MC/Hexagon/assign.s @@ -0,0 +1,7 @@ +# RUN: llvm-mc -arch=hexagon %s -filetype=asm -o - | FileCheck %s + +# Check that the assignment is printed using ".set". +# CHECK: .set x, y + +.set x, y +