LLVM: include/llvm/MC/MCSymbolMachO.h Source File (original) (raw)

1

2

3

4

5

6

7

8#ifndef LLVM_MC_MCSYMBOLMACHO_H

9#define LLVM_MC_MCSYMBOLMACHO_H

10

14

15namespace llvm {

17

18

19 enum MachOSymbolFlags : uint16_t {

20 SF_DescFlagsMask = 0xFFFF,

21

22

23 SF_ReferenceTypeMask = 0x0007,

24 SF_ReferenceTypeUndefinedNonLazy = 0x0000,

25 SF_ReferenceTypeUndefinedLazy = 0x0001,

26 SF_ReferenceTypeDefined = 0x0002,

27 SF_ReferenceTypePrivateDefined = 0x0003,

28 SF_ReferenceTypePrivateUndefinedNonLazy = 0x0004,

29 SF_ReferenceTypePrivateUndefinedLazy = 0x0005,

30

31

32 SF_ThumbFunc = 0x0008,

33 SF_NoDeadStrip = 0x0020,

34 SF_WeakReference = 0x0040,

35 SF_WeakDefinition = 0x0080,

36 SF_SymbolResolver = 0x0100,

37 SF_AltEntry = 0x0200,

38 SF_Cold = 0x0400,

39

40

41 SF_CommonAlignmentMask = 0xF0FF,

42 SF_CommonAlignmentShift = 8

43 };

44

45public:

48

53

54

55

59

62 SF_ReferenceTypeUndefinedLazy);

63 }

64

65

66

70

72 return getFlags() & SF_NoDeadStrip;

73 }

77

79 return getFlags() & SF_WeakReference;

80 }

82 modifyFlags(SF_WeakReference, SF_WeakReference);

83 }

84

86 return getFlags() & SF_WeakDefinition;

87 }

89 modifyFlags(SF_WeakDefinition, SF_WeakDefinition);

90 }

91

93 return getFlags() & SF_SymbolResolver;

94 }

96 modifyFlags(SF_SymbolResolver, SF_SymbolResolver);

97 }

98

102

104 return getFlags() & SF_AltEntry;

105 }

106

108

110

113 "Invalid .desc value!");

115 }

116

117

118

119

120

122

124 return true;

125

127 }

128

129

130

133

134

137 Align Alignment = *MaybeAlignment;

138 unsigned Log2Size = Log2(Alignment);

139 if (Log2Size > 15)

141 Twine(Alignment.value()) + "' for '" +

143 false);

144 Flags = (Flags & SF_CommonAlignmentMask) |

145 (Log2Size << SF_CommonAlignmentShift);

146 }

147 }

148

149 if (EncodeAsAltEntry)

150 Flags |= SF_AltEntry;

151

153 }

154};

155}

156

157#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

bool isPrivateExtern() const

Definition MCSymbolMachO.h:51

void setWeakReference() const

Definition MCSymbolMachO.h:81

bool isNoDeadStrip() const

Definition MCSymbolMachO.h:71

uint16_t getEncodedFlags(bool EncodeAsAltEntry) const

Get the encoded value of the flags as they will be emitted in to the MachO binary.

Definition MCSymbolMachO.h:131

void setWeakDefinition() const

Definition MCSymbolMachO.h:88

void setSymbolResolver() const

Definition MCSymbolMachO.h:95

bool isExternal() const

Definition MCSymbolMachO.h:49

void clearReferenceType() const

Definition MCSymbolMachO.h:56

bool isCold() const

Definition MCSymbolMachO.h:109

MCSymbolMachO(const MCSymbolTableEntry *Name, bool isTemporary)

Definition MCSymbolMachO.h:46

bool isWeakReference() const

Definition MCSymbolMachO.h:78

void setReferenceTypeUndefinedLazy(bool Value) const

Definition MCSymbolMachO.h:60

void setAltEntry() const

Definition MCSymbolMachO.h:99

void setCold() const

Definition MCSymbolMachO.h:107

void setPrivateExtern(bool Value)

Definition MCSymbolMachO.h:52

bool isSymbolLinkerVisible() const

Definition MCSymbolMachO.h:121

void setExternal(bool Value) const

Definition MCSymbolMachO.h:50

void setDesc(unsigned Value) const

Definition MCSymbolMachO.h:111

bool isAltEntry() const

Definition MCSymbolMachO.h:103

bool isSymbolResolver() const

Definition MCSymbolMachO.h:92

void setNoDeadStrip() const

Definition MCSymbolMachO.h:74

bool isWeakDefinition() const

Definition MCSymbolMachO.h:85

void setThumbFunc() const

Definition MCSymbolMachO.h:67

MCSymbol(const MCSymbolTableEntry *Name, bool isTemporary)

bool isCommon() const

Is this a 'common' symbol.

void modifyFlags(uint32_t Value, uint32_t Mask) const

Modify the flags via a mask.

unsigned IsPrivateExtern

Mach-O specific: This symbol is private extern.

StringRef getName() const

getName - Get the symbol name.

void setFlags(uint32_t Value) const

Set the (implementation defined) symbol flags.

uint32_t getFlags() const

Get the (implementation defined) symbol flags.

unsigned IsExternal

True if this symbol is visible outside this translation unit.

MaybeAlign getCommonAlignment() const

Return the alignment of a 'common' symbol.

bool isTemporary() const

isTemporary - Check if this is an assembler temporary symbol.

const MCExpr * Value

If non-null, the value for a variable symbol.

bool isUsedInReloc() const

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

StringMapEntry< MCSymbolTableValue > MCSymbolTableEntry

MCContext stores MCSymbolTableValue in a string map (see MCSymbol::operator new).

unsigned Log2(Align A)

Returns the log2 of the alignment.

This struct is a compact representation of a valid (non-zero power of two) alignment.

constexpr uint64_t value() const

This is a hole in the type system and should not be abused.

This struct is a compact representation of a valid (power of two) or undefined (0) alignment.