aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer/region.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/analyzer/region.h')
-rw-r--r--gcc/analyzer/region.h60
1 files changed, 59 insertions, 1 deletions
diff --git a/gcc/analyzer/region.h b/gcc/analyzer/region.h
index 6315fac..ecae887 100644
--- a/gcc/analyzer/region.h
+++ b/gcc/analyzer/region.h
@@ -34,7 +34,8 @@ enum memory_space
MEMSPACE_GLOBALS,
MEMSPACE_STACK,
MEMSPACE_HEAP,
- MEMSPACE_READONLY_DATA
+ MEMSPACE_READONLY_DATA,
+ MEMSPACE_THREAD_LOCAL
};
/* An enum for discriminating between the different concrete subclasses
@@ -49,6 +50,7 @@ enum region_kind
RK_LABEL,
RK_STACK,
RK_HEAP,
+ RK_THREAD_LOCAL,
RK_ROOT,
RK_SYMBOLIC,
RK_DECL,
@@ -62,6 +64,7 @@ enum region_kind
RK_STRING,
RK_BIT_RANGE,
RK_VAR_ARG,
+ RK_ERRNO,
RK_UNKNOWN,
};
@@ -77,6 +80,8 @@ enum region_kind
code_region (RK_CODE): represents the code segment, containing functions
stack_region (RK_STACK): a stack, containing all stack frames
heap_region (RK_HEAP): the heap, containing heap_allocated_regions
+ thread_local_region (RK_THREAD_LOCAL): thread-local data for the thread
+ being analyzed
root_region (RK_ROOT): the top-level region
function_region (RK_FUNCTION): the code for a particular function
label_region (RK_LABEL): a particular label within a function
@@ -102,6 +107,7 @@ enum region_kind
within another region
var_arg_region (RK_VAR_ARG): a region for the N-th vararg within a
frame_region for a variadic call
+ errno_region (RK_ERRNO): a region for holding "errno"
unknown_region (RK_UNKNOWN): for handling unimplemented tree codes. */
/* Abstract base class for representing ways of accessing chunks of memory.
@@ -555,6 +561,32 @@ is_a_helper <const heap_region *>::test (const region *reg)
namespace ana {
+/* Concrete space_region subclass: thread-local data for the thread
+ being analyzed. */
+
+class thread_local_region : public space_region
+{
+public:
+ thread_local_region (unsigned id, region *parent)
+ : space_region (id, parent)
+ {}
+
+ enum region_kind get_kind () const final override { return RK_THREAD_LOCAL; }
+ void dump_to_pp (pretty_printer *pp, bool simple) const final override;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const thread_local_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_THREAD_LOCAL;
+}
+
+namespace ana {
+
/* Concrete region subclass. The root region, containing all regions
(either directly, or as descendents).
Unique within a region_model_manager. */
@@ -1362,6 +1394,32 @@ template <> struct default_hash_traits<var_arg_region::key_t>
namespace ana {
+/* A region for errno for the current thread. */
+
+class errno_region : public region
+{
+public:
+ errno_region (unsigned id, const thread_local_region *parent)
+ : region (complexity (parent), id, parent, integer_type_node)
+ {}
+
+ enum region_kind get_kind () const final override { return RK_ERRNO; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const final override;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const errno_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_ERRNO;
+}
+
+namespace ana {
+
/* An unknown region, for handling unimplemented tree codes. */
class unknown_region : public region