- //===------------------------------------------------------------------===//
- // Properties to be set by the derived class ctor, used to configure the
- // asmwriter.
-
- /// CommentString - This indicates the comment character used by the
- /// assembler.
- const char *CommentString; // Defaults to "#"
-
- /// GlobalPrefix - If this is set to a non-empty string, it is prepended
- /// onto all global symbols. This is often used for "_" or ".".
- const char *GlobalPrefix; // Defaults to ""
-
- /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
- /// will enclose any GlobalVariable (that isn't a function)
- ///
- const char *GlobalVarAddrPrefix; // Defaults to ""
- const char *GlobalVarAddrSuffix; // Defaults to ""
-
- /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
- /// will enclose any GlobalVariable that points to a function.
- /// For example, this is used by the IA64 backend to materialize
- /// function descriptors, by decorating the ".data8" object with the
- /// @fptr( ) link-relocation operator.
- ///
- const char *FunctionAddrPrefix; // Defaults to ""
- const char *FunctionAddrSuffix; // Defaults to ""
-
- /// ZeroDirective - this should be set to the directive used to get some
- /// number of zero bytes emitted to the current section. Common cases are
- /// "\t.zero\t" and "\t.space\t". If this is set to null, the
- /// Data*bitsDirective's will be used to emit zero bytes.
- const char *ZeroDirective; // Defaults to "\t.zero\t"
-
- /// AsciiDirective - This directive allows emission of an ascii string with
- /// the standard C escape characters embedded into it.
- const char *AsciiDirective;
-
- /// DataDirectives - These directives are used to output some unit of
- /// integer data to the current section. If a data directive is set to
- /// null, smaller data directives will be used to emit the large sizes.
- const char *Data8bitsDirective; // Defaults to "\t.byte\t"
- const char *Data16bitsDirective; // Defaults to "\t.short\t"
- const char *Data32bitsDirective; // Defaults to "\t.long\t"
- const char *Data64bitsDirective; // Defaults to "\t.quad\t"
-
- /// AlignDirective - The directive used to emit round up to an alignment
- /// boundary.
- ///
- const char *AlignDirective; // Defaults to "\t.align\t"
-
- /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
- /// emits ".align N" directives, where N is the number of bytes to align to.
- /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
- /// boundary.
- bool AlignmentIsInBytes; // Defaults to true
-
- AsmPrinter(std::ostream &o, TargetMachine &tm)
- : O(o), TM(tm),
- CommentString("#"),
- GlobalPrefix(""),
- GlobalVarAddrPrefix(""),
- GlobalVarAddrSuffix(""),
- FunctionAddrPrefix(""),
- FunctionAddrSuffix(""),
- ZeroDirective("\t.zero\t"),
- AsciiDirective("\t.ascii\t"),
- Data8bitsDirective("\t.byte\t"),
- Data16bitsDirective("\t.short\t"),
- Data32bitsDirective("\t.long\t"),
- Data64bitsDirective("\t.quad\t"),
- AlignDirective("\t.align\t"),
- AlignmentIsInBytes(true) {
- }
+ /// SwitchToDataSection - Switch to the specified section of the executable
+ /// if we are not already in it! If GV is non-null and if the global has an
+ /// explicitly requested section, we switch to the section indicated for the
+ /// global instead of NewSection.
+ ///
+ /// If the new section is an empty string, this method forgets what the
+ /// current section is, but does not emit a .section directive.
+ ///
+ /// This method is used when about to emit data. For most assemblers, this
+ /// is the same as the SwitchToTextSection method, but not all assemblers
+ /// are the same.
+ ///
+ void SwitchToDataSection(const char *NewSection, const GlobalValue *GV = NULL);
+
+ /// getGlobalLinkName - Returns the asm/link name of of the specified
+ /// global variable. Should be overridden by each target asm printer to
+ /// generate the appropriate value.
+ virtual const std::string getGlobalLinkName(const GlobalVariable *GV) const;
+
+ /// EmitExternalGlobal - Emit the external reference to a global variable.
+ /// Should be overridden if an indirect reference should be used.
+ virtual void EmitExternalGlobal(const GlobalVariable *GV);
+
+ /// getCurrentFunctionEHName - Called to return (and cache) the
+ /// CurrentFnEHName.
+ ///
+ std::string getCurrentFunctionEHName(const MachineFunction *MF);