You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

46 lines
841 B

#pragma once
#include <llvm/IR/Value.h>
namespace evmcc
{
class BasicBlock;
/**
Stack adapter for Basic Block
Transforms stack to SSA: tracks values and their positions on the imaginary stack used inside a basic block.
*/
class BBStack
{
public:
BBStack() = default;
BBStack(const BBStack&) = delete;
void operator=(const BBStack&) = delete;
/**
Changes current basic block (if any) with a new one with empty state.
*/
void setBasicBlock(BasicBlock& _newBlock);
void push(llvm::Value* _value);
llvm::Value* pop();
/**
Duplicates _index'th value on stack.
*/
void dup(size_t _index);
/**
Swaps _index'th value on stack with a value on stack top.
@param _index Index of value to be swaped. Cannot be 0.
*/
void swap(size_t _index);
private:
BasicBlock* m_block = nullptr; ///< Current basic block
};
}