Browse Source

Endianness handler

cl-refactor
Paweł Bylica 10 years ago
parent
commit
86c42ce1fa
  1. 24
      libevmjit/Endianness.cpp
  2. 22
      libevmjit/Endianness.h
  3. 2
      windows/LibEvmJit.vcxproj
  4. 6
      windows/LibEvmJit.vcxproj.filters

24
libevmjit/Endianness.cpp

@ -0,0 +1,24 @@
#include "Endianness.h"
#include <llvm/IR/IntrinsicInst.h>
#include "Type.h"
namespace dev
{
namespace eth
{
namespace jit
{
llvm::Value* Endianness::toBE(llvm::IRBuilder<>& _builder, llvm::Value* _word)
{
// TODO: Native is Little Endian
auto bswap = llvm::Intrinsic::getDeclaration(_builder.GetInsertBlock()->getParent()->getParent(), llvm::Intrinsic::bswap, Type::i256);
return _builder.CreateCall(bswap, _word);
}
}
}
}

22
libevmjit/Endianness.h

@ -0,0 +1,22 @@
#pragma once
#include <llvm/IR/IRBuilder.h>
namespace dev
{
namespace eth
{
namespace jit
{
class Endianness
{
public:
static llvm::Value* toBE(llvm::IRBuilder<>& _builder, llvm::Value* _word);
};
}
}
}

2
windows/LibEvmJit.vcxproj

@ -126,6 +126,7 @@
<ClCompile Include="..\libevmjit\BasicBlock.cpp" />
<ClCompile Include="..\libevmjit\Compiler.cpp" />
<ClCompile Include="..\libevmjit\CompilerHelper.cpp" />
<ClCompile Include="..\libevmjit\Endianness.cpp" />
<ClCompile Include="..\libevmjit\ExecutionEngine.cpp" />
<ClCompile Include="..\libevmjit\Ext.cpp" />
<ClCompile Include="..\libevmjit\GasMeter.cpp" />
@ -139,6 +140,7 @@
<ClInclude Include="..\libevmjit\BasicBlock.h" />
<ClInclude Include="..\libevmjit\Compiler.h" />
<ClInclude Include="..\libevmjit\CompilerHelper.h" />
<ClInclude Include="..\libevmjit\Endianness.h" />
<ClInclude Include="..\libevmjit\ExecutionEngine.h" />
<ClInclude Include="..\libevmjit\Ext.h" />
<ClInclude Include="..\libevmjit\GasMeter.h" />

6
windows/LibEvmJit.vcxproj.filters

@ -39,6 +39,9 @@
<ClCompile Include="..\libevmjit\VM.cpp">
<Filter>libevmjit</Filter>
</ClCompile>
<ClCompile Include="..\libevmjit\Endianness.cpp">
<Filter>libevmjit</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\libevmjit\BasicBlock.h">
@ -74,5 +77,8 @@
<ClInclude Include="..\libevmjit\VM.h">
<Filter>libevmjit</Filter>
</ClInclude>
<ClInclude Include="..\libevmjit\Endianness.h">
<Filter>libevmjit</Filter>
</ClInclude>
</ItemGroup>
</Project>
Loading…
Cancel
Save