LLVM 22.0.0git
ARMUnwindOpAsm.h
Go to the documentation of this file.
1//===-- ARMUnwindOpAsm.h - ARM Unwind Opcodes Assembler ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the unwind opcode assembler for ARM exception handling
10// table.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMUNWINDOPASM_H
15#define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMUNWINDOPASM_H
16
17#include "llvm/ADT/STLExtras.h"
19#include <cstddef>
20#include <cstdint>
21
22namespace llvm {
23
24class MCSymbol;
25
27private:
30 bool HasPersonality = false;
31
32public:
34 OpBegins.push_back(0);
35 }
36
37 /// Reset the unwind opcode assembler.
38 void Reset() {
39 Ops.clear();
40 OpBegins.clear();
41 OpBegins.push_back(0);
42 HasPersonality = false;
43 }
44
45 /// Set the personality
46 void setPersonality(const MCSymbol *Per) {
47 HasPersonality = true;
48 }
49
50 /// Emit unwind opcodes for .save directives
51 void EmitRegSave(uint32_t RegSave);
52
53 /// Emit unwind opcodes for .vsave directives
54 void EmitVFPRegSave(uint32_t VFPRegSave);
55
56 /// Emit unwind opcodes to copy address from source register to $sp.
58
59 /// Emit unwind opcodes to add $sp with an offset.
60 void EmitSPOffset(int64_t Offset);
61
62 /// Emit unwind raw opcodes
63 void EmitRaw(const SmallVectorImpl<uint8_t> &Opcodes) {
64 llvm::append_range(Ops, Opcodes);
65 OpBegins.push_back(OpBegins.back() + Opcodes.size());
66 }
67
68 /// Finalize the unwind opcode sequence for emitBytes()
69 void Finalize(unsigned &PersonalityIndex,
71
72private:
73 void EmitInt8(unsigned Opcode) {
74 Ops.push_back(Opcode & 0xff);
75 OpBegins.push_back(OpBegins.back() + 1);
76 }
77
78 void EmitInt16(unsigned Opcode) {
79 Ops.push_back((Opcode >> 8) & 0xff);
80 Ops.push_back(Opcode & 0xff);
81 OpBegins.push_back(OpBegins.back() + 2);
82 }
83
84 void emitBytes(const uint8_t *Opcode, size_t Size) {
85 Ops.insert(Ops.end(), Opcode, Opcode + Size);
86 OpBegins.push_back(OpBegins.back() + Size);
87 }
88};
89
90} // end namespace llvm
91
92#endif // LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMUNWINDOPASM_H
uint64_t Size
Register Reg
This file contains some templates that are useful if you are working with the STL at all.
This file defines the SmallVector class.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
size_t size() const
Definition: SmallVector.h:79
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:574
iterator insert(iterator I, T &&Elt)
Definition: SmallVector.h:806
void push_back(const T &Elt)
Definition: SmallVector.h:414
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
void EmitSetSP(uint16_t Reg)
Emit unwind opcodes to copy address from source register to $sp.
void EmitVFPRegSave(uint32_t VFPRegSave)
Emit unwind opcodes for .vsave directives.
void EmitRegSave(uint32_t RegSave)
Emit unwind opcodes for .save directives.
void setPersonality(const MCSymbol *Per)
Set the personality.
void EmitSPOffset(int64_t Offset)
Emit unwind opcodes to add $sp with an offset.
void Reset()
Reset the unwind opcode assembler.
void EmitRaw(const SmallVectorImpl< uint8_t > &Opcodes)
Emit unwind raw opcodes.
void Finalize(unsigned &PersonalityIndex, SmallVectorImpl< uint8_t > &Result)
Finalize the unwind opcode sequence for emitBytes()
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:477
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition: STLExtras.h:2155