Skip to content

Commit d2b4050

Browse files
Merge pull request #3 from atirut-w/gas-fixes
Various GAS syntax fixes
2 parents a2fbfab + ab47d49 commit d2b4050

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

llvm/lib/Target/Z80/MCTargetDesc/Z80MCAsmInfo.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,28 @@ Z80MCAsmInfoELF::Z80MCAsmInfoELF(const Triple &T) {
3838

3939
// Common to both GAS and fasmg
4040
CommentString = ";";
41+
AscizDirective = nullptr;
4142
Code32Directive = Code64Directive = nullptr;
4243
UseIntegratedAssembler = false;
4344
AssemblerDialect = !Is16Bit;
4445
HasFunctionAlignment = false;
4546
ExceptionsType = ExceptionHandling::SjLj;
4647

47-
if (!Z80GasStyle) {
48+
if (Z80GasStyle) {
49+
Code16Directive = ".assume\tADL = 0";
50+
Code24Directive = ".assume\tADL = 1";
51+
AsciiDirective = ByteListDirective = Data8bitsDirective = "\tdb\t";
52+
Data16bitsDirective = "\tdw\t";
53+
Data24bitsDirective = "\td24\t";
54+
Data32bitsDirective = "\td32\t";
55+
} else {
4856
Code16Directive = "assume\tadl = 0";
4957
Code24Directive = "assume\tadl = 1";
5058
DollarIsPC = true;
5159
SeparatorString = nullptr;
5260
PrivateGlobalPrefix = PrivateLabelPrefix = "";
5361
SupportsQuotedNames = false;
54-
ZeroDirective = AscizDirective = nullptr;
62+
ZeroDirective = nullptr;
5563
BlockSeparator = " dup ";
5664
AsciiDirective = ByteListDirective = Data8bitsDirective = "\tdb\t";
5765
NumberLiteralSyntax = ANLS_PlainDecimal;

llvm/lib/Target/Z80/MCTargetDesc/Z80TargetStreamer.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ void Z80TargetAsmStreamer::emitLabel(MCSymbol *Symbol) {
3434
}
3535

3636
void Z80TargetAsmStreamer::emitAlign(Align Alignment) {
37-
if (auto Mask = Alignment.value() - 1)
38-
Z80GasStyle ? OS << "\t.skip\t($$ - $) and " << Mask << '\n' : OS << "\trb\t($$ - $) and " << Mask << '\n';
37+
if (auto Mask = Alignment.value() - 1) {
38+
if (Z80GasStyle) {
39+
OS << "\t.balign\t" << Alignment.value() << '\n';
40+
} else {
41+
OS << "\trb\t($$ - $) and " << Mask << '\n';
42+
}
43+
}
3944
}
4045

4146
void Z80TargetAsmStreamer::emitBlock(uint64_t NumBytes) {

0 commit comments

Comments
 (0)