Files
clang-p2996/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
Anirudh Prasad 1bc0e857bf [SystemZ][z/OS] Enable the AllowAtInName attribute for the HLASM dialect
- Currently, LLVM supports symbols of the name "token1@token2".
- "token2" is used to identify whether an appropriate symbol reference can be used for the symbol.
- Now, if the symbol reference couldn't be found, the AsmParser usually emits an error, unless the backend is configured to accept the "@" in a symbol name
- Thus, this patch aims to do that. It sets the `AllowAtInName` attribute in the SystemZ backend for the HLASM dialect.
- Setting this attribute ensures that, if a particular symbol reference is found, it uses that. If it doesn't, and there exists an "@" in the symbol name, it will use that instead of explicitly erroring out.

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D103111
2021-05-26 10:49:57 -04:00

48 lines
1.6 KiB
C++

//===-- SystemZMCAsmInfo.cpp - SystemZ asm properties ---------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SystemZMCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
using namespace llvm;
SystemZMCAsmInfo::SystemZMCAsmInfo(const Triple &TT) {
CodePointerSize = 8;
CalleeSaveStackSlotSize = 8;
IsLittleEndian = false;
AssemblerDialect = TT.isOSzOS() ? AD_HLASM : AD_ATT;
MaxInstLength = 6;
CommentString = AssemblerDialect == AD_HLASM ? "*" : "#";
RestrictCommentStringToStartOfStatement = (AssemblerDialect == AD_HLASM);
AllowAdditionalComments = (AssemblerDialect == AD_ATT);
AllowAtAtStartOfIdentifier = (AssemblerDialect == AD_HLASM);
AllowDollarAtStartOfIdentifier = (AssemblerDialect == AD_HLASM);
AllowHashAtStartOfIdentifier = (AssemblerDialect == AD_HLASM);
DotIsPC = (AssemblerDialect == AD_ATT);
StarIsPC = (AssemblerDialect == AD_HLASM);
EmitGNUAsmStartIndentationMarker = (AssemblerDialect == AD_ATT);
AllowAtInName = (AssemblerDialect == AD_HLASM);
ZeroDirective = "\t.space\t";
Data64bitsDirective = "\t.quad\t";
UsesELFSectionDirectiveForBSS = true;
SupportsDebugInformation = true;
ExceptionsType = ExceptionHandling::DwarfCFI;
}
bool SystemZMCAsmInfo::isAcceptableChar(char C) const {
if (AssemblerDialect == AD_ATT)
return MCAsmInfo::isAcceptableChar(C);
return MCAsmInfo::isAcceptableChar(C) || C == '#';
}