/// the assembler to set the value of a variable to some expression.
const char *SetDirective; // Defaults to null.
- /// LCOMMDirective - This is the name of a directive (if supported) that can
- /// be used to efficiently declare a local (internal) block of zero
- /// initialized data in the .bss/.data section. The syntax expected is:
- /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES
- /// @endverbatim
- const char *LCOMMDirective; // Defaults to null.
+ /// HasLCOMMDirective - This is true if the target supports the .lcomm
+ /// directive.
+ bool HasLCOMMDirective; // Defaults to false.
- const char *COMMDirective; // Defaults to "\t.comm\t".
-
/// COMMDirectiveTakesAlignment - True if COMMDirective take a third
/// argument that specifies the alignment of the declaration.
bool COMMDirectiveTakesAlignment; // Defaults to true.
const char *getSetDirective() const {
return SetDirective;
}
- const char *getLCOMMDirective() const {
- return LCOMMDirective;
- }
- const char *getCOMMDirective() const {
- return COMMDirective;
- }
+ bool hasLCOMMDirective() const { return HasLCOMMDirective; }
bool getCOMMDirectiveTakesAlignment() const {
return COMMDirectiveTakesAlignment;
}
/// @param DescValue - The value to set into the n_desc field.
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
- /// EmitCommonSymbol - Emit a common or local common symbol.
+ /// EmitCommonSymbol - Emit a common symbol.
///
/// @param Symbol - The common symbol to emit.
/// @param Size - The size of the common symbol.
/// @param ByteAlignment - The alignment of the symbol if
- /// non-zero. This must be a power of 2 on some targets.
- virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
+ /// non-zero. This must be a power of 2.
+ virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) = 0;
+ /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
+ ///
+ /// @param Symbol - The common symbol to emit.
+ /// @param Size - The size of the common symbol.
+ virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) = 0;
+
/// EmitZerofill - Emit a the zerofill section and an option symbol.
///
/// @param Section - The zerofill section to create and or to put the symbol
return;
}
- if (const char *LComm = MAI->getLCOMMDirective()) {
+ if (MAI->hasLCOMMDirective()) {
// .lcomm _foo, 42
- O << LComm << *GVSym << ',' << Size << '\n';
+ OutStreamer.EmitLocalCommonSymbol(GVSym, Size);
return;
}
PICJumpTableDirective = 0;
GlobalDirective = "\t.globl\t";
SetDirective = 0;
- LCOMMDirective = 0;
- COMMDirective = "\t.comm\t";
+ HasLCOMMDirective = false;
COMMDirectiveTakesAlignment = true;
HasDotTypeDotSizeDirective = true;
HasSingleParameterDotFile = true;
MCAsmInfoCOFF::MCAsmInfoCOFF() {
GlobalPrefix = "_";
- LCOMMDirective = "\t.lcomm\t";
+ HasLCOMMDirective = true;
COMMDirectiveTakesAlignment = false;
HasDotTypeDotSizeDirective = false;
HasSingleParameterDotFile = false;
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
- virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
+ virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment);
+ /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
+ ///
+ /// @param Symbol - The common symbol to emit.
+ /// @param Size - The size of the common symbol.
+ virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size);
+
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0);
EmitEOL();
}
-void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
+void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
- OS << MAI.getCOMMDirective() << *Symbol << ',' << Size;
+ OS << "\t.comm\t" << *Symbol << ',' << Size;
if (ByteAlignment != 0 && MAI.getCOMMDirectiveTakesAlignment()) {
if (MAI.getAlignmentIsInBytes())
OS << ',' << ByteAlignment;
EmitEOL();
}
+/// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
+///
+/// @param Symbol - The common symbol to emit.
+/// @param Size - The size of the common symbol.
+void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {
+ assert(MAI.hasLCOMMDirective() && "Doesn't have .lcomm, can't emit it!");
+ OS << "\t.lcomm\t" << *Symbol << ',' << Size;
+ EmitEOL();
+}
+
void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
unsigned Size, unsigned ByteAlignment) {
// Note: a .zerofill directive does not switch sections.
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
- virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
+ virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment);
+ virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {
+ assert(0 && "macho doesn't support this directive");
+ }
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0);
virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
getSymbolData(*Symbol).setFlags(DescValue & SF_DescFlagsMask);
}
-void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
+void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
// FIXME: Darwin 'as' does appear to allow redef of a .comm by itself.
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
- virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
+ virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {}
+ virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {}
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0) {}
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
SetDirective = "\t.set\t";
- LCOMMDirective = "\t.lcomm\t";
+ HasLCOMMDirective = true;
DwarfRequiresFrameSection = false;
SetDirective = "\t.set";
Data64bitsDirective = "\t.quad\t";
AlignmentIsInBytes = false;
- LCOMMDirective = "\t.lcomm\t";
+ HasLCOMMDirective = true;
PCSymbol = ".";
CommentString = "#";
SetDirective = "\t.set";
Data64bitsDirective = is64Bit ? "\t.quad\t" : 0;
AlignmentIsInBytes = false;
- LCOMMDirective = "\t.lcomm\t";
+ HasLCOMMDirective = true;
AssemblerDialect = 0; // Old-Style mnemonics.
}