Skip to content

Commit fae9438

Browse files
a few changes
1 parent d52e445 commit fae9438

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

llvm/lib/Target/Z80/GISel/Z80CallLowering.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
using namespace llvm;
3030
using namespace MIPatternMatch;
3131

32-
cl::opt<bool> ReturnSRet("z80-return-sret", cl::desc("Return sret pointers"),
33-
cl::init(true), cl::Hidden);
32+
static cl::opt<bool> ReturnSRet("z80-return-sret", cl::desc("Return sret pointers"),
33+
cl::init(true), cl::Hidden);
3434

3535
#define DEBUG_TYPE "z80-call-lowering"
3636

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

+8-9
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ static cl::opt<bool> EscapeNonPrint(
2424
"Avoid outputting non-printable ascii characters to assembly files."),
2525
cl::Hidden);
2626

27-
// TODO: Put this somewhere more appropriate for a global
28-
cl::opt<bool> GasStyle(
27+
cl::opt<bool> Z80GasStyle(
2928
"z80-gas-style",
3029
cl::desc("Use GAS style assembly syntax instead of FASMG style."),
3130
cl::NotHidden);
@@ -36,8 +35,8 @@ Z80MCAsmInfoELF::Z80MCAsmInfoELF(const Triple &T) {
3635
bool Is16Bit = T.isArch16Bit() || T.getEnvironment() == Triple::CODE16;
3736
CodePointerSize = CalleeSaveStackSlotSize = Is16Bit ? 2 : 3;
3837
MaxInstLength = 6;
39-
40-
if (!GasStyle) {
38+
39+
if (!Z80GasStyle) {
4140
DollarIsPC = true;
4241
SeparatorString = nullptr;
4342
CommentString = ";";
@@ -92,7 +91,7 @@ MCSection *Z80MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
9291
}
9392

9493
bool Z80MCAsmInfoELF::isAcceptableChar(char C) const {
95-
return MCAsmInfo::isAcceptableChar(C) || C == '%' || C == '^';
94+
return Z80GasStyle ? MCAsmInfo::isAcceptableChar(C) : (MCAsmInfo::isAcceptableChar(C) || C == '%' || C == '^');
9695
}
9796

9897
bool Z80MCAsmInfoELF::shouldOmitSectionDirective(StringRef SectionName) const {
@@ -102,10 +101,10 @@ bool Z80MCAsmInfoELF::shouldOmitSectionDirective(StringRef SectionName) const {
102101
const char *Z80MCAsmInfoELF::getBlockDirective(int64_t Size) const {
103102
switch (Size) {
104103
default: return nullptr;
105-
case 1: return GasStyle ? "\t.byte" : "\tdb\t";
106-
case 2: return GasStyle ? "\t.short" : "\tdw\t";
107-
case 3: return GasStyle ? "\t.long" : "\tdl\t";
108-
case 4: return GasStyle ? "\t.quad" : "\tdd\t";
104+
case 1: return Z80GasStyle ? "\t.byte" : "\tdb\t";
105+
case 2: return Z80GasStyle ? "\t.short" : "\tdw\t";
106+
case 3: return Z80GasStyle ? "\t.long" : "\tdl\t";
107+
case 4: return Z80GasStyle ? "\t.quad" : "\tdd\t";
109108
}
110109
}
111110

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

+9-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
using namespace llvm;
2121

22-
extern cl::opt<bool> GasStyle;
22+
extern cl::opt<bool> Z80GasStyle;
2323

2424
Z80TargetStreamer::Z80TargetStreamer(MCStreamer &S)
2525
: MCTargetStreamer(S) {}
@@ -35,36 +35,34 @@ void Z80TargetAsmStreamer::emitLabel(MCSymbol *Symbol) {
3535

3636
void Z80TargetAsmStreamer::emitAlign(Align Alignment) {
3737
if (auto Mask = Alignment.value() - 1)
38-
GasStyle ? OS << "\t.skip\t($$ - $) and " << Mask << '\n' : OS << "\trb\t($$ - $) and " << Mask << '\n';
38+
Z80GasStyle ? OS << "\t.skip\t($$ - $) and " << Mask << '\n' : OS << "\trb\t($$ - $) and " << Mask << '\n';
3939
}
4040

4141
void Z80TargetAsmStreamer::emitBlock(uint64_t NumBytes) {
4242
if (NumBytes)
43-
GasStyle ? OS << "\t.skip\t" << NumBytes << '\n' : OS << "\trb\t" << NumBytes << '\n';
43+
Z80GasStyle ? OS << "\t.skip\t" << NumBytes << '\n' : OS << "\trb\t" << NumBytes << '\n';
4444
}
4545

4646
void Z80TargetAsmStreamer::emitLocal(MCSymbol *Symbol) {
47-
if (!GasStyle) {
48-
OS << "\tprivate\t";
49-
Symbol->print(OS, MAI);
50-
OS << '\n';
51-
}
47+
Z80GasStyle ? OS << "\t.local\t" : OS << "\tprivate\t";
48+
Symbol->print(OS, MAI);
49+
OS << '\n';
5250
}
5351

5452
void Z80TargetAsmStreamer::emitWeakGlobal(MCSymbol *Symbol) {
55-
GasStyle ? OS << "\t.weak\t" : OS << "\tweak\t";
53+
Z80GasStyle ? OS << "\t.weak\t" : OS << "\tweak\t";
5654
Symbol->print(OS, MAI);
5755
OS << '\n';
5856
}
5957

6058
void Z80TargetAsmStreamer::emitGlobal(MCSymbol *Symbol) {
61-
GasStyle ? OS << "\t.globl\t" : OS << "\tpublic\t";
59+
Z80GasStyle ? OS << "\t.global\t" : OS << "\tpublic\t";
6260
Symbol->print(OS, MAI);
6361
OS << '\n';
6462
}
6563

6664
void Z80TargetAsmStreamer::emitExtern(MCSymbol *Symbol) {
67-
GasStyle ? OS << "\t.extern\t" : OS << "\textern\t";
65+
Z80GasStyle ? OS << "\t.extern\t" : OS << "\textern\t";
6866
Symbol->print(OS, MAI);
6967
OS << '\n';
7068
}

0 commit comments

Comments
 (0)