summaryrefslogtreecommitdiff
path: root/include/llvm/ExecutionEngine/JITSymbol.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ExecutionEngine/JITSymbol.h')
-rw-r--r--include/llvm/ExecutionEngine/JITSymbol.h43
1 files changed, 40 insertions, 3 deletions
diff --git a/include/llvm/ExecutionEngine/JITSymbol.h b/include/llvm/ExecutionEngine/JITSymbol.h
index 4172f240ba392..933b3ea8e13df 100644
--- a/include/llvm/ExecutionEngine/JITSymbol.h
+++ b/include/llvm/ExecutionEngine/JITSymbol.h
@@ -40,6 +40,7 @@ using JITTargetAddress = uint64_t;
class JITSymbolFlags {
public:
using UnderlyingType = uint8_t;
+ using TargetFlagsType = uint64_t;
enum FlagNames : UnderlyingType {
None = 0,
@@ -56,32 +57,48 @@ public:
/// @brief Construct a JITSymbolFlags instance from the given flags.
JITSymbolFlags(FlagNames Flags) : Flags(Flags) {}
+ /// @brief Construct a JITSymbolFlags instance from the given flags and target
+ /// flags.
+ JITSymbolFlags(FlagNames Flags, TargetFlagsType TargetFlags)
+ : Flags(Flags), TargetFlags(TargetFlags) {}
+
/// @brief Return true if there was an error retrieving this symbol.
bool hasError() const {
return (Flags & HasError) == HasError;
}
- /// @brief Returns true is the Weak flag is set.
+ /// @brief Returns true if the Weak flag is set.
bool isWeak() const {
return (Flags & Weak) == Weak;
}
- /// @brief Returns true is the Weak flag is set.
+ /// @brief Returns true if the Common flag is set.
bool isCommon() const {
return (Flags & Common) == Common;
}
+ /// @brief Returns true if the symbol isn't weak or common.
bool isStrongDefinition() const {
return !isWeak() && !isCommon();
}
- /// @brief Returns true is the Weak flag is set.
+ /// @brief Returns true if the Exported flag is set.
bool isExported() const {
return (Flags & Exported) == Exported;
}
+ /// @brief Implicitly convert to the underlying flags type.
operator UnderlyingType&() { return Flags; }
+ /// @brief Implicitly convert to the underlying flags type.
+ operator const UnderlyingType&() const { return Flags; }
+
+ /// @brief Return a reference to the target-specific flags.
+ TargetFlagsType& getTargetFlags() { return TargetFlags; }
+
+ /// @brief Return a reference to the target-specific flags.
+ const TargetFlagsType& getTargetFlags() const { return TargetFlags; }
+
/// Construct a JITSymbolFlags value based on the flags of the given global
/// value.
static JITSymbolFlags fromGlobalValue(const GlobalValue &GV);
@@ -92,6 +109,26 @@ public:
private:
UnderlyingType Flags = None;
+ TargetFlagsType TargetFlags = 0;
+};
+
+/// @brief ARM-specific JIT symbol flags.
+/// FIXME: This should be moved into a target-specific header.
+class ARMJITSymbolFlags {
+public:
+ ARMJITSymbolFlags() = default;
+
+ enum FlagNames {
+ None = 0,
+ Thumb = 1 << 0
+ };
+
+ operator JITSymbolFlags::TargetFlagsType&() { return Flags; }
+
+ static ARMJITSymbolFlags fromObjectSymbol(
+ const object::BasicSymbolRef &Symbol);
+private:
+ JITSymbolFlags::TargetFlagsType Flags = 0;
};
/// @brief Represents a symbol that has been evaluated to an address already.