Skip to content

Various GAS syntax fixes #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: z80
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions llvm/lib/Target/Z80/MCTargetDesc/Z80MCAsmInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,28 @@ Z80MCAsmInfoELF::Z80MCAsmInfoELF(const Triple &T) {

// Common to both GAS and fasmg
CommentString = ";";
AscizDirective = nullptr;
Code32Directive = Code64Directive = nullptr;
UseIntegratedAssembler = false;
AssemblerDialect = !Is16Bit;
HasFunctionAlignment = false;
ExceptionsType = ExceptionHandling::SjLj;

if (!Z80GasStyle) {
if (Z80GasStyle) {
Code16Directive = ".assume\tADL = 0";
Code24Directive = ".assume\tADL = 1";
AsciiDirective = ByteListDirective = Data8bitsDirective = "\tdb\t";
Data16bitsDirective = "\tdw\t";
Data24bitsDirective = "\td24\t";
Data32bitsDirective = "\td32\t";
} else {
Code16Directive = "assume\tadl = 0";
Code24Directive = "assume\tadl = 1";
DollarIsPC = true;
SeparatorString = nullptr;
PrivateGlobalPrefix = PrivateLabelPrefix = "";
SupportsQuotedNames = false;
ZeroDirective = AscizDirective = nullptr;
ZeroDirective = nullptr;
BlockSeparator = " dup ";
AsciiDirective = ByteListDirective = Data8bitsDirective = "\tdb\t";
NumberLiteralSyntax = ANLS_PlainDecimal;
Expand Down
9 changes: 7 additions & 2 deletions llvm/lib/Target/Z80/MCTargetDesc/Z80TargetStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ void Z80TargetAsmStreamer::emitLabel(MCSymbol *Symbol) {
}

void Z80TargetAsmStreamer::emitAlign(Align Alignment) {
if (auto Mask = Alignment.value() - 1)
Z80GasStyle ? OS << "\t.skip\t($$ - $) and " << Mask << '\n' : OS << "\trb\t($$ - $) and " << Mask << '\n';
if (auto Mask = Alignment.value() - 1) {
if (Z80GasStyle) {
OS << "\t.balign\t" << Alignment.value() << '\n';
} else {
OS << "\trb\t($$ - $) and " << Mask << '\n';
}
}
}

void Z80TargetAsmStreamer::emitBlock(uint64_t NumBytes) {
Expand Down