Default HasSetDirective to true, since most targets have it.
The targets that claim to not have it probably do, or it is
spelled differently. These include Blackfin, Mips, Alpha, and
PIC16. All of these except pic16 are normal ELF targets, so
they almost certainly have it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94585
91177308-0d34-0410-b5e6-
96231b3b80d8
20 files changed:
///
const char *ExternDirective; // Defaults to NULL.
///
const char *ExternDirective; // Defaults to NULL.
- /// SetDirective - This is the name of a directive that can be used to tell
- /// the assembler to set the value of a variable to some expression.
- const char *SetDirective; // Defaults to null.
+ /// HasSetDirective - True if the assembler supports the .set directive.
+ bool HasSetDirective; // Defaults to true.
/// HasLCOMMDirective - This is true if the target supports the .lcomm
/// directive.
/// HasLCOMMDirective - This is true if the target supports the .lcomm
/// directive.
- bool HasLCOMMDirective; // Defaults to false.
+ bool HasLCOMMDirective; // Defaults to false.
/// COMMDirectiveAlignmentIsInBytes - True is COMMDirective's optional
/// alignment is to be specified in bytes instead of log2(n).
/// COMMDirectiveAlignmentIsInBytes - True is COMMDirective's optional
/// alignment is to be specified in bytes instead of log2(n).
const char *getExternDirective() const {
return ExternDirective;
}
const char *getExternDirective() const {
return ExternDirective;
}
- const char *getSetDirective() const {
- return SetDirective;
- }
+ bool hasSetDirective() const { return HasSetDirective; }
bool hasLCOMMDirective() const { return HasLCOMMDirective; }
bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
bool getCOMMDirectiveAlignmentIsInBytes() const {
bool hasLCOMMDirective() const { return HasLCOMMDirective; }
bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
bool getCOMMDirectiveAlignmentIsInBytes() const {
- if (MAI->getSetDirective()) {
+ if (MAI->hasSetDirective()) {
OutStreamer.AddBlankLine();
for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
I != E; ++I) {
OutStreamer.AddBlankLine();
for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
I != E; ++I) {
printVisibility(Name, I->getVisibility());
printVisibility(Name, I->getVisibility());
- O << MAI->getSetDirective() << ' ' << *Name << ", " << *Target << '\n';
+ O << "\t.set\t" << *Name << ", " << *Target << '\n';
// .set directive for each unique entry. This reduces the number of
// relocations the assembler will generate for the jump table.
if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 &&
// .set directive for each unique entry. This reduces the number of
// relocations the assembler will generate for the jump table.
if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 &&
- MAI->getSetDirective()) {
+ MAI->hasSetDirective()) {
SmallPtrSet<const MachineBasicBlock*, 16> EmittedSets;
const TargetLowering *TLI = TM.getTargetLowering();
const MCExpr *Base = TLI->getPICJumpTableRelocBaseExpr(&MF, JTI,
SmallPtrSet<const MachineBasicBlock*, 16> EmittedSets;
const TargetLowering *TLI = TM.getTargetLowering();
const MCExpr *Base = TLI->getPICJumpTableRelocBaseExpr(&MF, JTI,
const MachineBasicBlock *MBB = JTBBs[ii];
if (!EmittedSets.insert(MBB)) continue;
const MachineBasicBlock *MBB = JTBBs[ii];
if (!EmittedSets.insert(MBB)) continue;
- O << MAI->getSetDirective() << ' '
<< *GetJTSetSymbol(JTI, MBB->getNumber()) << ','
<< *MBB->getSymbol(OutContext) << '-' << *Base << '\n';
}
<< *GetJTSetSymbol(JTI, MBB->getNumber()) << ','
<< *MBB->getSymbol(OutContext) << '-' << *Base << '\n';
}
// If we have emitted set directives for the jump table entries, print
// them rather than the entries themselves. If we're emitting PIC, then
// emit the table entries as differences between two text section labels.
// If we have emitted set directives for the jump table entries, print
// them rather than the entries themselves. If we're emitting PIC, then
// emit the table entries as differences between two text section labels.
- if (MAI->getSetDirective()) {
+ if (MAI->hasSetDirective()) {
// If we used .set, reference the .set's symbol.
Value = MCSymbolRefExpr::Create(GetJTSetSymbol(UID, MBB->getNumber()),
OutContext);
// If we used .set, reference the .set's symbol.
Value = MCSymbolRefExpr::Create(GetJTSetSymbol(UID, MBB->getNumber()),
OutContext);
void DwarfPrinter::EmitDifference(const char *TagHi, unsigned NumberHi,
const char *TagLo, unsigned NumberLo,
bool IsSmall) {
void DwarfPrinter::EmitDifference(const char *TagHi, unsigned NumberHi,
const char *TagLo, unsigned NumberLo,
bool IsSmall) {
- if (MAI->getSetDirective() != 0) {
+ if (MAI->hasSetDirective()) {
O << "\t.set\t";
PrintLabelName("set", SetCounter, Flavor);
O << ",";
O << "\t.set\t";
PrintLabelName("set", SetCounter, Flavor);
O << ",";
else
printAbsolute = MAI->isAbsoluteDebugSectionOffsets();
else
printAbsolute = MAI->isAbsoluteDebugSectionOffsets();
- if (MAI->getSetDirective() != 0 && useSet) {
+ if (MAI->hasSetDirective() && useSet) {
O << "\t.set\t";
PrintLabelName("set", SetCounter, Flavor);
O << ",";
O << "\t.set\t";
PrintLabelName("set", SetCounter, Flavor);
O << ",";
TextAlignFillValue = 0;
GPRel32Directive = 0;
GlobalDirective = "\t.globl\t";
TextAlignFillValue = 0;
GPRel32Directive = 0;
GlobalDirective = "\t.globl\t";
+ HasSetDirective = true;
HasLCOMMDirective = false;
COMMDirectiveAlignmentIsInBytes = true;
HasDotTypeDotSizeDirective = true;
HasLCOMMDirective = false;
COMMDirectiveAlignmentIsInBytes = true;
HasDotTypeDotSizeDirective = true;
PrivateGlobalPrefix = "L"; // Prefix for private global symbols
WeakRefDirective = "\t.weak\t";
LinkOnceDirective = "\t.linkonce same_size\n";
PrivateGlobalPrefix = "L"; // Prefix for private global symbols
WeakRefDirective = "\t.weak\t";
LinkOnceDirective = "\t.linkonce same_size\n";
- SetDirective = "\t.set\t";
// Doesn't support visibility:
HiddenVisibilityAttr = ProtectedVisibilityAttr = MCSA_Invalid;
// Doesn't support visibility:
HiddenVisibilityAttr = ProtectedVisibilityAttr = MCSA_Invalid;
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
HasMachoZeroFillDirective = true; // Uses .zerofill
HasStaticCtorDtorReferenceInStaticMode = true;
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
HasMachoZeroFillDirective = true; // Uses .zerofill
HasStaticCtorDtorReferenceInStaticMode = true;
- SetDirective = "\t.set";
HiddenVisibilityAttr = MCSA_PrivateExtern;
// Doesn't support protected visibility.
HiddenVisibilityAttr = MCSA_PrivateExtern;
// Doesn't support protected visibility.
AbsoluteDebugSectionOffsets = true;
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
AbsoluteDebugSectionOffsets = true;
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
- SetDirective = "\t.set\t";
HasLCOMMDirective = true;
DwarfRequiresFrameSection = false;
HasLCOMMDirective = true;
DwarfRequiresFrameSection = false;
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
- bool UseSet= MAI->getSetDirective() && TM.getRelocationModel() == Reloc::PIC_;
+ bool UseSet= MAI->hasSetDirective() && TM.getRelocationModel() == Reloc::PIC_;
SmallPtrSet<MachineBasicBlock*, 8> JTSets;
for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
MachineBasicBlock *MBB = JTBBs[i];
bool isNew = JTSets.insert(MBB);
if (UseSet && isNew) {
SmallPtrSet<MachineBasicBlock*, 8> JTSets;
for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
MachineBasicBlock *MBB = JTBBs[i];
bool isNew = JTSets.insert(MBB);
if (UseSet && isNew) {
- O << MAI->getSetDirective() << ' '
<< *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB) << ','
<< *MBB->getSymbol(OutContext) << '-' << *JTISymbol << '\n';
}
<< *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB) << ','
<< *MBB->getSymbol(OutContext) << '-' << *JTISymbol << '\n';
}
PrivateGlobalPrefix = "$";
GPRel32Directive = ".gprel32";
WeakRefDirective = "\t.weak\t";
PrivateGlobalPrefix = "$";
GPRel32Directive = ".gprel32";
WeakRefDirective = "\t.weak\t";
+ HasSetDirective = false;
BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT) {
GlobalPrefix = "_";
CommentString = "//";
BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT) {
GlobalPrefix = "_";
CommentString = "//";
+ HasSetDirective = false;
SPULinuxMCAsmInfo::SPULinuxMCAsmInfo(const Target &T, const StringRef &TT) {
ZeroDirective = "\t.space\t";
SPULinuxMCAsmInfo::SPULinuxMCAsmInfo(const Target &T, const StringRef &TT) {
ZeroDirective = "\t.space\t";
- SetDirective = "\t.set";
Data64bitsDirective = "\t.quad\t";
AlignmentIsInBytes = false;
HasLCOMMDirective = true;
Data64bitsDirective = "\t.quad\t";
AlignmentIsInBytes = false;
HasLCOMMDirective = true;
MSP430MCAsmInfo::MSP430MCAsmInfo(const Target &T, const StringRef &TT) {
PrivateGlobalPrefix = ".L";
WeakRefDirective ="\t.weak\t";
MSP430MCAsmInfo::MSP430MCAsmInfo(const Target &T, const StringRef &TT) {
PrivateGlobalPrefix = ".L";
WeakRefDirective ="\t.weak\t";
- SetDirective = "\t.set\t";
PCSymbol=".";
CommentString = ";";
PCSymbol=".";
CommentString = ";";
CommentString = "#";
ZeroDirective = "\t.space\t";
GPRel32Directive = "\t.gpword\t";
CommentString = "#";
ZeroDirective = "\t.space\t";
GPRel32Directive = "\t.gpword\t";
+ HasSetDirective = false;
RomData8bitsDirective = " dw ";
RomData16bitsDirective = " rom_di ";
RomData32bitsDirective = " rom_dl ";
RomData8bitsDirective = " dw ";
RomData16bitsDirective = " rom_di ";
RomData32bitsDirective = " rom_dl ";
+ HasSetDirective = false;
// Set it to false because we weed to generate c file name and not bc file
// name.
// Set it to false because we weed to generate c file name and not bc file
// name.
AbsoluteEHSectionOffsets = false;
ZeroDirective = "\t.space\t";
AbsoluteEHSectionOffsets = false;
ZeroDirective = "\t.space\t";
- SetDirective = "\t.set";
Data64bitsDirective = is64Bit ? "\t.quad\t" : 0;
HasLCOMMDirective = true;
AssemblerDialect = 0; // Old-Style mnemonics.
Data64bitsDirective = is64Bit ? "\t.quad\t" : 0;
HasLCOMMDirective = true;
AssemblerDialect = 0; // Old-Style mnemonics.
UsesELFSectionDirectiveForBSS = true;
WeakRefDirective = "\t.weak\t";
UsesELFSectionDirectiveForBSS = true;
WeakRefDirective = "\t.weak\t";
- SetDirective = "\t.set\t";
PrivateGlobalPrefix = ".L";
}
PrivateGlobalPrefix = ".L";
}
SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT) {
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT) {
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
- SetDirective = "\t.set\t";
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
- SetDirective = "\t.set\t";
PCSymbol = ".";
// Set up DWARF directives
PCSymbol = ".";
// Set up DWARF directives
cast<PointerType>(GV->getType())->getElementType())) {
O << MAI->getGlobalDirective() << *Sym;
O << ".globound" << "\n";
cast<PointerType>(GV->getType())->getElementType())) {
O << MAI->getGlobalDirective() << *Sym;
O << ".globound" << "\n";
- O << MAI->getSetDirective() << *Sym;
+ O << "\t.set\t" << *Sym;
O << ".globound" << "," << ATy->getNumElements() << "\n";
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
// TODO Use COMDAT groups for LinkOnceLinkage
O << ".globound" << "," << ATy->getNumElements() << "\n";
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
// TODO Use COMDAT groups for LinkOnceLinkage
AscizDirective = ".asciiz";
WeakDefDirective = "\t.weak\t";
WeakRefDirective = "\t.weak\t";
AscizDirective = ".asciiz";
WeakDefDirective = "\t.weak\t";
WeakRefDirective = "\t.weak\t";
- SetDirective = "\t.set\t";
// Debug
HasLEB128 = true;
// Debug
HasLEB128 = true;