Files
revng-revng/include/revng-c/PromoteStackPointer/SegregateStackAccessesPass.h
T
Alessandro Di Federico 330d2b6cc7 Model: rework how we name things
This commit:

* Introduces `_` as a prefix for all non-user entities we emit in
  decompiled code.
  Also, some names have been changed to be more concise.
  Specifically, the following entities have changed:
  `_ENUM_UNDERLYING`, `_ABI`, `_REG`, `_padding_at_`,
  `_artificial_struct_`, `_artificial_wrapper_`, `_stack`,
  `_break_from_loop_`, `_var_`, `_stack_arguments`,
  `_artificial_struct_returned_`, `_enum_max_value_`.
* Introduce _PACKED for `__attribute__((packed))`.
* `EnumEntry` name: drop the `EnumType` name prefix.
2023-08-23 16:37:39 +02:00

33 lines
965 B
C++

#pragma once
//
// Copyright (c) rev.ng Labs Srl. See LICENSE.md for details.
//
#include "llvm/Pass.h"
/// Rewrite all stack memory accesses
///
/// This pass changes the base address of stack memory access to either:
///
/// * The stack frame of the function (allocated by the `revng_stack_frame`
/// function).
/// * The stack arguments of a call site (allocated by the
/// `revng_call_stack_arguments` function), which is then passed in as the
/// last argument of the function.
/// * The (newly introduced) last argument of the function representing the
/// stack arguments.
///
/// After this pass, all stack accesses have positive offsets and
/// `_init_local_sp` is dropped entirely.
struct SegregateStackAccessesPass : public llvm::ModulePass {
public:
static char ID;
SegregateStackAccessesPass() : llvm::ModulePass(ID) {}
void getAnalysisUsage(llvm::AnalysisUsage &AU) const override;
bool runOnModule(llvm::Module &M) override;
};