mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-20 03:36:44 +00:00
Define constants and return codes
This commit is contained in:
parent
3a2596960b
commit
8fb6de09e4
2 changed files with 25 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ llvm::IntegerType* Type::lowPrecision;
|
|||
llvm::IntegerType* Type::Byte;
|
||||
llvm::PointerType* Type::BytePtr;
|
||||
llvm::Type* Type::Void;
|
||||
llvm::Type* Type::MainReturn;
|
||||
|
||||
void Type::init(llvm::LLVMContext& _context)
|
||||
{
|
||||
|
|
@ -21,6 +22,12 @@ void Type::init(llvm::LLVMContext& _context)
|
|||
Byte = llvm::Type::getInt8Ty(_context);
|
||||
BytePtr = Byte->getPointerTo();
|
||||
Void = llvm::Type::getVoidTy(_context);
|
||||
MainReturn = llvm::Type::getInt32Ty(_context);
|
||||
}
|
||||
|
||||
llvm::Constant* Constant::get(ReturnCode _returnCode)
|
||||
{
|
||||
return llvm::ConstantInt::get(Type::MainReturn, static_cast<uint64_t>(_returnCode));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
18
evmcc/Type.h
18
evmcc/Type.h
|
|
@ -2,6 +2,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <llvm/IR/Type.h>
|
||||
#include <llvm/IR/Constants.h>
|
||||
|
||||
namespace evmcc
|
||||
{
|
||||
|
|
@ -20,7 +21,24 @@ struct Type
|
|||
|
||||
static llvm::Type* Void;
|
||||
|
||||
/// Main function return type
|
||||
static llvm::Type* MainReturn;
|
||||
|
||||
static void init(llvm::LLVMContext& _context);
|
||||
};
|
||||
|
||||
enum class ReturnCode
|
||||
{
|
||||
Stop = 0,
|
||||
Return = 1,
|
||||
Suicide = 2,
|
||||
|
||||
BadJumpDestination = 101,
|
||||
};
|
||||
|
||||
struct Constant
|
||||
{
|
||||
static llvm::Constant* get(ReturnCode _returnCode);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue