LLVM 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::SSPLayoutAnalysis Class Reference

#include "llvm/CodeGen/StackProtector.h"

Inheritance diagram for llvm::SSPLayoutAnalysis:
Inheritance graph
[legend]

Public Types

using Result = SSPLayoutInfo
 

Public Member Functions

Result run (Function &F, FunctionAnalysisManager &FAM)
 
- Public Member Functions inherited from llvm::PassInfoMixin< DerivedT >
void printPipeline (raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
 

Static Public Member Functions

static bool requiresStackProtector (Function *F, SSPLayoutMap *Layout=nullptr)
 Check whether or not F needs a stack protector based upon the stack protector level.
 
- Static Public Member Functions inherited from llvm::AnalysisInfoMixin< SSPLayoutAnalysis >
static AnalysisKeyID ()
 Returns an opaque, unique ID for this analysis type.
 
- Static Public Member Functions inherited from llvm::PassInfoMixin< DerivedT >
static StringRef name ()
 Gets the name of the pass we are mixed into.
 

Detailed Description

Definition at line 68 of file StackProtector.h.

Member Typedef Documentation

◆ Result

Definition at line 75 of file StackProtector.h.

Member Function Documentation

◆ requiresStackProtector()

bool SSPLayoutAnalysis::requiresStackProtector ( Function F,
SSPLayoutMap Layout = nullptr 
)
static

Check whether or not F needs a stack protector based upon the stack protector level.

Check whether or not this function needs a stack protector based upon the stack protector level.

We use two heuristics: a standard (ssp) and strong (sspstrong). The standard heuristic which will add a guard variable to functions that call alloca with a either a variable size or a size >= SSPBufferSize, functions with character buffers larger than SSPBufferSize, and functions with aggregates containing character buffers larger than SSPBufferSize. The strong heuristic will add a guard variables to functions that call alloca regardless of size, functions with any buffer regardless of type and size, functions with aggregates that contain any buffer regardless of type and size, and functions that contain stack-based variables that have had their address taken.

Definition at line 371 of file StackProtector.cpp.

References llvm::SmallPtrSetImplBase::clear(), ContainsProtectableArray(), DEBUG_TYPE, llvm::OptimizationRemarkEmitter::emit(), F, HasAddressTaken(), I, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::MachineFrameInfo::SSPLK_AddrOf, llvm::MachineFrameInfo::SSPLK_LargeArray, and llvm::MachineFrameInfo::SSPLK_SmallArray.

Referenced by llvm::StackProtector::requiresStackProtector(), and run().

◆ run()

SSPLayoutInfo SSPLayoutAnalysis::run ( Function F,
FunctionAnalysisManager FAM 
)

Definition at line 105 of file StackProtector.cpp.

References F, Info, and requiresStackProtector().


The documentation for this class was generated from the following files: