7 #ifndef RETDEC_BIN2LLVMIR_PROVIDERS_ABI_ABI_H
8 #define RETDEC_BIN2LLVMIR_PROVIDERS_ABI_ABI_H
15 #include <llvm/IR/Module.h>
44 bool isRegister(
const llvm::Value* val, uint32_t r)
const;
50 llvm::GlobalVariable*
getRegister(uint32_t r,
bool use =
true)
const;
52 const std::vector<llvm::GlobalVariable*>&
getRegisters()
const;
58 void addRegister(uint32_t
id, llvm::GlobalVariable* reg);
130 std::vector<llvm::GlobalVariable*>
_regs;
154 std::map<CallingConvention::ID, CallingConvention::Ptr>
_id2cc;
166 static bool getAbi(llvm::Module* m,
Abi*& abi);
Mapping of LLVM instructions to underlying ASM instructions.
Calling convention information.
Config DB provider for bin2llvmirl.
static std::map< llvm::Module *, std::unique_ptr< Abi > > _module2abi
Definition: abi.h:170
static void clear()
Definition: abi.cpp:371
static Abi * getAbi(llvm::Module *m)
Definition: abi.cpp:359
static Abi * addAbi(llvm::Module *m, Config *c)
Definition: abi.cpp:302
virtual std::size_t getTypeByteSize(llvm::Type *t) const
Definition: abi.cpp:152
CallingConvention::ID _defcc
Definition: abi.h:155
bool isArm64() const
Definition: abi.cpp:232
std::vector< llvm::GlobalVariable * > _regs
Definition: abi.h:130
llvm::Module * _module
Definition: abi.h:122
virtual std::size_t getTypeBitSize(llvm::Type *t) const
Definition: abi.cpp:157
std::size_t getRegisterByteSize(uint32_t r) const
Definition: abi.cpp:103
bool isMips() const
Definition: abi.cpp:217
CallingConvention * getDefaultCallingConvention()
Definition: abi.cpp:272
bool isX64() const
Definition: abi.cpp:242
void addRegister(uint32_t id, llvm::GlobalVariable *reg)
Definition: abi.cpp:116
virtual bool isNopInstruction(cs_insn *insn)=0
Config * _config
Definition: abi.h:123
uint32_t _regStackPointerId
ID of stack pointer register.
Definition: abi.h:138
llvm::GlobalVariable * getStackPointerRegister() const
Definition: abi.cpp:93
std::size_t getWordSize() const
Definition: abi.cpp:172
bool isArm() const
Definition: abi.cpp:227
bool isZeroRegister(const llvm::Value *val)
Definition: abi.cpp:59
const std::vector< llvm::GlobalVariable * > & getRegisters() const
Definition: abi.cpp:88
bool isFlagRegister(const llvm::Value *val)
Definition: abi.cpp:48
uint32_t _regSyscallId
Register used to pass system call ID.
Definition: abi.h:147
bool isPic32() const
Definition: abi.cpp:257
bool supportsCallingConvention(const CallingConvention::ID &cc)
Definition: abi.cpp:262
std::map< CallingConvention::ID, CallingConvention::Ptr > _id2cc
Definition: abi.h:154
CallingConvention * getCallingConvention(const CallingConvention::ID &cc)
Definition: abi.cpp:277
std::map< const llvm::Value *, uint32_t > _regs2id
Definition: abi.h:135
bool isPowerPC() const
Definition: abi.cpp:247
static llvm::Type * getDefaultFPType(llvm::Module *m)
Definition: abi.cpp:200
uint32_t getRegisterId(const llvm::Value *r) const
Definition: abi.cpp:82
llvm::GlobalVariable * getZeroRegister() const
Definition: abi.cpp:98
llvm::GlobalVariable * getSyscallReturnRegister()
Definition: abi.cpp:132
llvm::GlobalVariable * getRegister(uint32_t r, bool use=true) const
Definition: abi.cpp:72
llvm::IntegerType * getDefaultType() const
Definition: abi.cpp:162
Abi(llvm::Module *m, Config *c)
Definition: abi.cpp:31
bool isPowerPC64() const
Definition: abi.cpp:252
static const unsigned DEFAULT_ADDR_SPACE
Definition: abi.h:32
llvm::GlobalVariable * getSyscallArgumentRegister(unsigned n)
Definition: abi.cpp:137
uint32_t _regFunctionReturnId
ID of register where function return values are stored.
Definition: abi.h:140
Config * getConfig() const
Definition: abi.cpp:289
std::vector< llvm::GlobalVariable * > _id2regs
Fast "capstone id -> LLVM value" search.
Definition: abi.h:132
bool isNopInstruction(AsmInstruction ai)
Definition: abi.cpp:147
std::vector< uint32_t > _syscallRegs
Ordered list of registers used in system calls.
Definition: abi.h:143
bool isRegister(const llvm::Value *val) const
Definition: abi.cpp:38
uint32_t _regZeroReg
Register that is always equal to zero - not every arch have this.
Definition: abi.h:149
uint32_t _regSyscallReturn
Register used for returning values from system calls.
Definition: abi.h:145
llvm::PointerType * getDefaultPointerType() const
Definition: abi.cpp:167
llvm::GlobalVariable * getSyscallIdRegister()
Definition: abi.cpp:127
bool isStackPointerRegister(const llvm::Value *val) const
Definition: abi.cpp:54
CallingConvention::ID getDefaultCallingConventionID() const
Definition: abi.cpp:267
bool isX86() const
Definition: abi.cpp:237
bool isMips64() const
Definition: abi.cpp:222
virtual bool isGeneralPurposeRegister(const llvm::Value *val) const =0
static const uint32_t REG_INVALID
Definition: abi.h:31
bool isStackVariable(const llvm::Value *val) const
Definition: abi.cpp:142
Definition: asm_instruction.h:34
Definition: calling_convention.h:22
eCC
Definition: calling_convention.h:24
The frontend-end part of the decompiler.
Definition: archive_wrapper.h:19