summaryrefslogtreecommitdiff
path: root/include/lldb/Utility/ArchSpec.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Utility/ArchSpec.h')
-rw-r--r--include/lldb/Utility/ArchSpec.h150
1 files changed, 34 insertions, 116 deletions
diff --git a/include/lldb/Utility/ArchSpec.h b/include/lldb/Utility/ArchSpec.h
index e84cbbbe5efa..7a32556310c4 100644
--- a/include/lldb/Utility/ArchSpec.h
+++ b/include/lldb/Utility/ArchSpec.h
@@ -1,9 +1,8 @@
//===-- ArchSpec.h ----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -23,15 +22,13 @@
namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class ArchSpec ArchSpec.h "lldb/Utility/ArchSpec.h" An architecture
+/// \class ArchSpec ArchSpec.h "lldb/Utility/ArchSpec.h" An architecture
/// specification class.
///
/// A class designed to be created from a cpu type and subtype, a
/// string representation, or an llvm::Triple. Keeping all of the conversions
/// of strings to architecture enumeration values confined to this class
/// allows new architecture support to be added easily.
-//----------------------------------------------------------------------
class ArchSpec {
public:
enum MIPSSubType {
@@ -186,10 +183,6 @@ public:
eCore_uknownMach32,
eCore_uknownMach64,
- eCore_kalimba3,
- eCore_kalimba4,
- eCore_kalimba5,
-
kNumCores,
kCore_invalid,
@@ -223,9 +216,6 @@ public:
kCore_hexagon_first = eCore_hexagon_generic,
kCore_hexagon_last = eCore_hexagon_hexagonv5,
- kCore_kalimba_first = eCore_kalimba3,
- kCore_kalimba_last = eCore_kalimba5,
-
kCore_mips32_first = eCore_mips32,
kCore_mips32_last = eCore_mips32r6,
@@ -243,131 +233,99 @@ public:
};
- //------------------------------------------------------------------
/// Default constructor.
///
/// Default constructor that initializes the object with invalid cpu type
/// and subtype values.
- //------------------------------------------------------------------
ArchSpec();
- //------------------------------------------------------------------
/// Constructor over triple.
///
/// Constructs an ArchSpec with properties consistent with the given Triple.
- //------------------------------------------------------------------
explicit ArchSpec(const llvm::Triple &triple);
explicit ArchSpec(const char *triple_cstr);
explicit ArchSpec(llvm::StringRef triple_str);
- //------------------------------------------------------------------
/// Constructor over architecture name.
///
/// Constructs an ArchSpec with properties consistent with the given object
/// type and architecture name.
- //------------------------------------------------------------------
explicit ArchSpec(ArchitectureType arch_type, uint32_t cpu_type,
uint32_t cpu_subtype);
- //------------------------------------------------------------------
/// Destructor.
- //------------------------------------------------------------------
~ArchSpec();
- //------------------------------------------------------------------
/// Assignment operator.
///
- /// @param[in] rhs another ArchSpec object to copy.
+ /// \param[in] rhs another ArchSpec object to copy.
///
- /// @return A const reference to this object.
- //------------------------------------------------------------------
+ /// \return A const reference to this object.
const ArchSpec &operator=(const ArchSpec &rhs);
- //---------------------------------------------------------------------------
/// Returns true if the OS, vendor and environment fields of the triple are
/// unset. The triple is expected to be normalized
/// (llvm::Triple::normalize).
- //---------------------------------------------------------------------------
static bool ContainsOnlyArch(const llvm::Triple &normalized_triple);
static void ListSupportedArchNames(StringList &list);
static size_t AutoComplete(CompletionRequest &request);
- //------------------------------------------------------------------
/// Returns a static string representing the current architecture.
///
- /// @return A static string corresponding to the current
+ /// \return A static string corresponding to the current
/// architecture.
- //------------------------------------------------------------------
const char *GetArchitectureName() const;
- //-----------------------------------------------------------------
/// if MIPS architecture return true.
///
- /// @return a boolean value.
- //-----------------------------------------------------------------
+ /// \return a boolean value.
bool IsMIPS() const;
- //------------------------------------------------------------------
/// Returns a string representing current architecture as a target CPU for
/// tools like compiler, disassembler etc.
///
- /// @return A string representing target CPU for the current
+ /// \return A string representing target CPU for the current
/// architecture.
- //------------------------------------------------------------------
std::string GetClangTargetCPU() const;
- //------------------------------------------------------------------
/// Return a string representing target application ABI.
///
- /// @return A string representing target application ABI.
- //------------------------------------------------------------------
+ /// \return A string representing target application ABI.
std::string GetTargetABI() const;
- //------------------------------------------------------------------
/// Clears the object state.
///
/// Clears the object state back to a default invalid state.
- //------------------------------------------------------------------
void Clear();
- //------------------------------------------------------------------
/// Returns the size in bytes of an address of the current architecture.
///
- /// @return The byte size of an address of the current architecture.
- //------------------------------------------------------------------
+ /// \return The byte size of an address of the current architecture.
uint32_t GetAddressByteSize() const;
- //------------------------------------------------------------------
/// Returns a machine family for the current architecture.
///
- /// @return An LLVM arch type.
- //------------------------------------------------------------------
+ /// \return An LLVM arch type.
llvm::Triple::ArchType GetMachine() const;
- //------------------------------------------------------------------
/// Returns the distribution id of the architecture.
///
/// This will be something like "ubuntu", "fedora", etc. on Linux.
///
- /// @return A ConstString ref containing the distribution id,
+ /// \return A ConstString ref containing the distribution id,
/// potentially empty.
- //------------------------------------------------------------------
- const ConstString &GetDistributionId() const;
+ ConstString GetDistributionId() const;
- //------------------------------------------------------------------
/// Set the distribution id of the architecture.
///
/// This will be something like "ubuntu", "fedora", etc. on Linux. This
/// should be the same value returned by HostInfo::GetDistributionId ().
- ///------------------------------------------------------------------
void SetDistributionId(const char *distribution_id);
- //------------------------------------------------------------------
/// Tests if this ArchSpec is valid.
///
- /// @return True if the current architecture is valid, false
+ /// \return True if the current architecture is valid, false
/// otherwise.
- //------------------------------------------------------------------
bool IsValid() const {
return m_core >= eCore_arm_generic && m_core < kNumCores;
}
@@ -377,23 +335,12 @@ public:
return !m_triple.getVendorName().empty();
}
- bool TripleVendorIsUnspecifiedUnknown() const {
- return m_triple.getVendor() == llvm::Triple::UnknownVendor &&
- m_triple.getVendorName().empty();
- }
-
bool TripleOSWasSpecified() const { return !m_triple.getOSName().empty(); }
bool TripleEnvironmentWasSpecified() const {
- return !m_triple.getEnvironmentName().empty();
- }
-
- bool TripleOSIsUnspecifiedUnknown() const {
- return m_triple.getOS() == llvm::Triple::UnknownOS &&
- m_triple.getOSName().empty();
+ return m_triple.hasEnvironment();
}
- //------------------------------------------------------------------
/// Merges fields from another ArchSpec into this ArchSpec.
///
/// This will use the supplied ArchSpec to fill in any fields of the triple
@@ -403,23 +350,21 @@ public:
/// have a triple which is x64-pc-windows-msvc, then merging that triple
/// into this one will result in the triple i386-pc-windows-msvc.
///
- //------------------------------------------------------------------
void MergeFrom(const ArchSpec &other);
- //------------------------------------------------------------------
/// Change the architecture object type, CPU type and OS type.
///
- /// @param[in] arch_type The object type of this ArchSpec.
+ /// \param[in] arch_type The object type of this ArchSpec.
///
- /// @param[in] cpu The required CPU type.
+ /// \param[in] cpu The required CPU type.
///
- /// @param[in] os The optional OS type
+ /// \param[in] os The optional OS type
/// The default value of 0 was chosen to from the ELF spec value
/// ELFOSABI_NONE. ELF is the only one using this parameter. If another
/// format uses this parameter and 0 does not work, use a value over
/// 255 because in the ELF header this is value is only a byte.
///
- /// @return True if the object, and CPU were successfully set.
+ /// \return True if the object, and CPU were successfully set.
///
/// As a side effect, the vendor value is usually set to unknown. The
/// exceptions are
@@ -441,26 +386,21 @@ public:
/// *-*-netbsd
/// *-*-openbsd
/// *-*-solaris
- //------------------------------------------------------------------
bool SetArchitecture(ArchitectureType arch_type, uint32_t cpu, uint32_t sub,
uint32_t os = 0);
- //------------------------------------------------------------------
/// Returns the byte order for the architecture specification.
///
- /// @return The endian enumeration for the current endianness of
+ /// \return The endian enumeration for the current endianness of
/// the architecture specification
- //------------------------------------------------------------------
lldb::ByteOrder GetByteOrder() const;
- //------------------------------------------------------------------
/// Sets this ArchSpec's byte order.
///
/// In the common case there is no need to call this method as the byte
/// order can almost always be determined by the architecture. However, many
/// CPU's are bi-endian (ARM, Alpha, PowerPC, etc) and the default/assumed
/// byte order may be incorrect.
- //------------------------------------------------------------------
void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; }
uint32_t GetMinimumOpcodeByteSize() const;
@@ -473,39 +413,30 @@ public:
uint32_t GetMachOCPUSubType() const;
- //------------------------------------------------------------------
/// Architecture data byte width accessor
///
- /// @return the size in 8-bit (host) bytes of a minimum addressable unit
+ /// \return the size in 8-bit (host) bytes of a minimum addressable unit
/// from the Architecture's data bus
- //------------------------------------------------------------------
uint32_t GetDataByteSize() const;
- //------------------------------------------------------------------
/// Architecture code byte width accessor
///
- /// @return the size in 8-bit (host) bytes of a minimum addressable unit
+ /// \return the size in 8-bit (host) bytes of a minimum addressable unit
/// from the Architecture's code bus
- //------------------------------------------------------------------
uint32_t GetCodeByteSize() const;
- //------------------------------------------------------------------
/// Architecture triple accessor.
///
- /// @return A triple describing this ArchSpec.
- //------------------------------------------------------------------
+ /// \return A triple describing this ArchSpec.
llvm::Triple &GetTriple() { return m_triple; }
- //------------------------------------------------------------------
/// Architecture triple accessor.
///
- /// @return A triple describing this ArchSpec.
- //------------------------------------------------------------------
+ /// \return A triple describing this ArchSpec.
const llvm::Triple &GetTriple() const { return m_triple; }
void DumpTriple(Stream &s) const;
- //------------------------------------------------------------------
/// Architecture triple setter.
///
/// Configures this ArchSpec according to the given triple. If the triple
@@ -515,45 +446,36 @@ public:
/// to further resolve the CPU type and subtype, endian characteristics,
/// etc.
///
- /// @return A triple describing this ArchSpec.
- //------------------------------------------------------------------
+ /// \return A triple describing this ArchSpec.
bool SetTriple(const llvm::Triple &triple);
bool SetTriple(llvm::StringRef triple_str);
- //------------------------------------------------------------------
/// Returns the default endianness of the architecture.
///
- /// @return The endian enumeration for the default endianness of
+ /// \return The endian enumeration for the default endianness of
/// the architecture.
- //------------------------------------------------------------------
lldb::ByteOrder GetDefaultEndian() const;
- //------------------------------------------------------------------
/// Returns true if 'char' is a signed type by default in the architecture
/// false otherwise
///
- /// @return True if 'char' is a signed type by default on the
+ /// \return True if 'char' is a signed type by default on the
/// architecture and false otherwise.
- //------------------------------------------------------------------
bool CharIsSignedByDefault() const;
- //------------------------------------------------------------------
/// Compare an ArchSpec to another ArchSpec, requiring an exact cpu type
/// match between them. e.g. armv7s is not an exact match with armv7 - this
/// would return false
///
- /// @return true if the two ArchSpecs match.
- //------------------------------------------------------------------
+ /// \return true if the two ArchSpecs match.
bool IsExactMatch(const ArchSpec &rhs) const;
- //------------------------------------------------------------------
/// Compare an ArchSpec to another ArchSpec, requiring a compatible cpu type
/// match between them. e.g. armv7s is compatible with armv7 - this method
/// would return true
///
- /// @return true if the two ArchSpecs are compatible
- //------------------------------------------------------------------
+ /// \return true if the two ArchSpecs are compatible
bool IsCompatibleMatch(const ArchSpec &rhs) const;
bool IsFullySpecifiedTriple() const;
@@ -563,7 +485,6 @@ public:
bool &os_version_different,
bool &env_different) const;
- //------------------------------------------------------------------
/// Detect whether this architecture uses thumb code exclusively
///
/// Some embedded ARM chips (e.g. the ARM Cortex M0-7 line) can only execute
@@ -573,9 +494,8 @@ public:
/// (especially common with these embedded processors), we may not have
/// those things easily accessible.
///
- /// @return true if this is an arm ArchSpec which can only execute Thumb
+ /// \return true if this is an arm ArchSpec which can only execute Thumb
/// instructions
- //------------------------------------------------------------------
bool IsAlwaysThumbInstructions() const;
uint32_t GetFlags() const { return m_flags; }
@@ -603,17 +523,15 @@ protected:
void CoreUpdated(bool update_triple);
};
-//------------------------------------------------------------------
-/// @fn bool operator< (const ArchSpec& lhs, const ArchSpec& rhs) Less than
+/// \fn bool operator< (const ArchSpec& lhs, const ArchSpec& rhs) Less than
/// operator.
///
/// Tests two ArchSpec objects to see if \a lhs is less than \a rhs.
///
-/// @param[in] lhs The Left Hand Side ArchSpec object to compare. @param[in]
+/// \param[in] lhs The Left Hand Side ArchSpec object to compare. \param[in]
/// rhs The Left Hand Side ArchSpec object to compare.
///
-/// @return true if \a lhs is less than \a rhs
-//------------------------------------------------------------------
+/// \return true if \a lhs is less than \a rhs
bool operator<(const ArchSpec &lhs, const ArchSpec &rhs);
bool operator==(const ArchSpec &lhs, const ArchSpec &rhs);