#ifndef LLVM_TARGET_ASM_INFO_H
#define LLVM_TARGET_ASM_INFO_H
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/DataTypes.h"
#include <string>
static inline unsigned setEntitySize(unsigned Flags, unsigned Size) {
return ((Flags & ~EntitySize) | ((Size & 0xFF) << 24));
}
+
+ struct KeyInfo {
+ static inline unsigned getEmptyKey() { return Invalid; }
+ static inline unsigned getTombstoneKey() { return Invalid - 1; }
+ static unsigned getHashValue(const unsigned &Key) { return Key; }
+ static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; }
+ static bool isPod() { return true; }
+ };
+
+ typedef DenseMap<unsigned, std::string, KeyInfo> FlagsStringsMapType;
}
class TargetMachine;
class CallInst;
class GlobalValue;
class Type;
+ class Mangler;
class Section {
friend class TargetAsmInfo;
class TargetAsmInfo {
private:
mutable StringMap<Section> Sections;
+ mutable SectionFlags::FlagsStringsMapType FlagsStrings;
protected:
//===------------------------------------------------------------------===//
// Properties to be set by the target writer, used to configure asm printer.
const char *GlobalPrefix; // Defaults to ""
/// PrivateGlobalPrefix - This prefix is used for globals like constant
- /// pool entries that are completely private to the .o file and should not
+ /// pool entries that are completely private to the .s file and should not
/// have names in the .o file. This is often "." or "L".
const char *PrivateGlobalPrefix; // Defaults to "."
+ /// LessPrivateGlobalPrefix - This prefix is used for symbols that should
+ /// be passed through the assembler but be removed by the linker. This
+ /// is "l" on Darwin, currently used for some ObjC metadata.
+ const char *LessPrivateGlobalPrefix; // Defaults to ""
+
/// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
/// emitted before jump tables with the specified prefix.
const char *JumpTableSpecialLabelPrefix; // Default to null.
virtual ~TargetAsmInfo();
const Section* getNamedSection(const char *Name,
- unsigned Flags = SectionFlags::None) const;
+ unsigned Flags = SectionFlags::None,
+ bool Override = false) const;
const Section* getUnnamedSection(const char *Directive,
- unsigned Flags = SectionFlags::None) const;
+ unsigned Flags = SectionFlags::None,
+ bool Override = false) const;
/// Measure the specified inline asm to determine an approximation of its
/// length.
return false;
}
+ /// emitUsedDirectiveFor - This hook allows targets to selectively decide
+ /// not to emit the UsedDirective for some symbols in llvm.used.
+ virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
+ Mangler *Mang) const {
+ return (GV!=0);
+ }
+
/// PreferredEHDataFormat - This hook allows the target to select data
/// format used for encoding pointers in exception handling data. Reason is
/// 0 for data, 1 for code labels, 2 for function pointers. Global is true
const char* name = NULL) const;
/// SectionForGlobal - This hooks returns proper section name for given
- /// global with all necessary flags and marks. If NoCoalesce is true,
- /// do not use coalesced section.
- virtual std::string SectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce = false) const;
+ /// global with all necessary flags and marks.
+ virtual std::string SectionForGlobal(const GlobalValue *GV) const;
// Helper methods for SectionForGlobal
virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
SectionKind::Kind kind) const;
- virtual std::string PrintSectionFlags(unsigned flags) const { return ""; }
+ const std::string& getSectionFlags(unsigned Flags) const;
+ virtual std::string printSectionFlags(unsigned flags) const { return ""; }
- virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
- bool NoCoalesce = false) const;
+ virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
virtual const Section* SelectSectionForMachineConst(const Type *Ty) const;
+ /// getSLEB128Size - Compute the number of bytes required for a signed
+ /// leb128 value.
+
+ static unsigned getSLEB128Size(int Value);
+
+ /// getULEB128Size - Compute the number of bytes required for an unsigned
+ /// leb128 value.
+
+ static unsigned getULEB128Size(unsigned Value);
+
// Accessors.
//
const char *getTextSection() const {
const char *getPrivateGlobalPrefix() const {
return PrivateGlobalPrefix;
}
+ const char *getLessPrivateGlobalPrefix() const {
+ return LessPrivateGlobalPrefix;
+ }
const char *getJumpTableSpecialLabelPrefix() const {
return JumpTableSpecialLabelPrefix;
}