aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm
diff options
context:
space:
mode:
authorDimitry <winsvega@mail.ru>2016-04-02 20:56:43 +0800
committerDimitry <winsvega@mail.ru>2016-04-02 20:56:43 +0800
commit858c41260d4cec26ba38ea3bd2ef71dcede63f7c (patch)
tree8dd03312a5f926f8dd95a4a7f0798c2b6624c1e3 /libsolidity/inlineasm
parentccbd3ff63feb696025c18211c3c93bab47f755b0 (diff)
downloaddexon-solidity-858c41260d4cec26ba38ea3bd2ef71dcede63f7c.tar
dexon-solidity-858c41260d4cec26ba38ea3bd2ef71dcede63f7c.tar.gz
dexon-solidity-858c41260d4cec26ba38ea3bd2ef71dcede63f7c.tar.bz2
dexon-solidity-858c41260d4cec26ba38ea3bd2ef71dcede63f7c.tar.lz
dexon-solidity-858c41260d4cec26ba38ea3bd2ef71dcede63f7c.tar.xz
dexon-solidity-858c41260d4cec26ba38ea3bd2ef71dcede63f7c.tar.zst
dexon-solidity-858c41260d4cec26ba38ea3bd2ef71dcede63f7c.zip
rename namespace for instruction.h/cpp in libevmasm
Diffstat (limited to 'libsolidity/inlineasm')
-rw-r--r--libsolidity/inlineasm/AsmCodeGen.cpp11
-rw-r--r--libsolidity/inlineasm/AsmData.h2
-rw-r--r--libsolidity/inlineasm/AsmParser.cpp23
3 files changed, 18 insertions, 18 deletions
diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp
index 89e95bc1..5fa04087 100644
--- a/libsolidity/inlineasm/AsmCodeGen.cpp
+++ b/libsolidity/inlineasm/AsmCodeGen.cpp
@@ -25,6 +25,7 @@
#include <functional>
#include <libevmasm/Assembly.h>
#include <libevmasm/SourceLocation.h>
+#include <libevmasm/Instruction.h>
#include <libsolidity/inlineasm/AsmParser.h>
#include <libsolidity/inlineasm/AsmData.h>
@@ -116,7 +117,7 @@ public:
m_identifierAccess = [](assembly::Identifier const&, eth::Assembly&, CodeGenerator::IdentifierContext) { return false; };
}
- void operator()(Instruction const& _instruction)
+ void operator()(dev::solidity::assembly::Instruction const& _instruction)
{
m_state.assembly.append(_instruction.instruction);
}
@@ -145,7 +146,7 @@ public:
"Variable inaccessible, too deep inside stack (" + boost::lexical_cast<string>(heightDiff) + ")"
);
else
- m_state.assembly.append(eth::dupInstruction(heightDiff));
+ m_state.assembly.append(solidity::dupInstruction(heightDiff));
return;
}
else if (eth::AssemblyItem const* label = m_state.findLabel(_identifier.name))
@@ -196,7 +197,7 @@ public:
//@TODO check height before and after
while (m_state.variables.size() > numVariables)
{
- m_state.assembly.append(eth::Instruction::POP);
+ m_state.assembly.append(solidity::Instruction::POP);
m_state.variables.pop_back();
}
}
@@ -215,8 +216,8 @@ private:
);
else
{
- m_state.assembly.append(eth::swapInstruction(heightDiff));
- m_state.assembly.append(eth::Instruction::POP);
+ m_state.assembly.append(solidity::swapInstruction(heightDiff));
+ m_state.assembly.append(solidity::Instruction::POP);
}
return;
}
diff --git a/libsolidity/inlineasm/AsmData.h b/libsolidity/inlineasm/AsmData.h
index 95cfc6ee..42f0ae31 100644
--- a/libsolidity/inlineasm/AsmData.h
+++ b/libsolidity/inlineasm/AsmData.h
@@ -35,7 +35,7 @@ namespace assembly
/// What follows are the AST nodes for assembly.
/// Direct EVM instruction (except PUSHi and JUMPDEST)
-struct Instruction { eth::Instruction instruction; };
+struct Instruction { solidity::Instruction instruction; };
/// Literal number or string (up to 32 bytes)
struct Literal { bool isNumber; std::string value; };
/// External / internal identifier or label reference
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp
index b1fd464e..ae63598d 100644
--- a/libsolidity/inlineasm/AsmParser.cpp
+++ b/libsolidity/inlineasm/AsmParser.cpp
@@ -23,7 +23,6 @@
#include <libsolidity/inlineasm/AsmParser.h>
#include <ctype.h>
#include <algorithm>
-#include <libevmasm/Instruction.h>
#include <libsolidity/parsing/Scanner.h>
using namespace std;
@@ -121,17 +120,17 @@ assembly::Statement Parser::parseExpression()
assembly::Statement Parser::parseElementaryOperation(bool _onlySinglePusher)
{
// Allowed instructions, lowercase names.
- static map<string, eth::Instruction> s_instructions;
+ static map<string, dev::solidity::Instruction> s_instructions;
if (s_instructions.empty())
- for (auto const& instruction: eth::c_instructions)
+ for (auto const& instruction: solidity::c_instructions)
{
if (
- instruction.second == eth::Instruction::JUMPDEST ||
- (eth::Instruction::PUSH1 <= instruction.second && instruction.second <= eth::Instruction::PUSH32)
+ instruction.second == solidity::Instruction::JUMPDEST ||
+ (solidity::Instruction::PUSH1 <= instruction.second && instruction.second <= solidity::Instruction::PUSH32)
)
continue;
string name = instruction.first;
- if (instruction.second == eth::Instruction::SUICIDE)
+ if (instruction.second == solidity::Instruction::SUICIDE)
name = "selfdestruct";
transform(name.begin(), name.end(), name.begin(), [](unsigned char _c) { return tolower(_c); });
s_instructions[name] = instruction.second;
@@ -152,10 +151,10 @@ assembly::Statement Parser::parseElementaryOperation(bool _onlySinglePusher)
// first search the set of instructions.
if (s_instructions.count(literal))
{
- eth::Instruction const& instr = s_instructions[literal];
+ dev::solidity::Instruction const& instr = s_instructions[literal];
if (_onlySinglePusher)
{
- eth::InstructionInfo info = eth::instructionInfo(instr);
+ InstructionInfo info = dev::solidity::getInstructionInfo(instr);
if (info.ret != 1)
fatalParserError("Instruction " + info.name + " not allowed in this context.");
}
@@ -200,11 +199,11 @@ FunctionalInstruction Parser::parseFunctionalInstruction(assembly::Statement con
{
if (_instruction.type() != typeid(Instruction))
fatalParserError("Assembly instruction required in front of \"(\")");
- eth::Instruction instr = boost::get<Instruction>(_instruction).instruction;
- eth::InstructionInfo instrInfo = eth::instructionInfo(instr);
- if (eth::Instruction::DUP1 <= instr && instr <= eth::Instruction::DUP16)
+ solidity::Instruction instr = boost::get<solidity::assembly::Instruction>(_instruction).instruction;
+ InstructionInfo instrInfo = getInstructionInfo(instr);
+ if (solidity::Instruction::DUP1 <= instr && instr <= solidity::Instruction::DUP16)
fatalParserError("DUPi instructions not allowed for functional notation");
- if (eth::Instruction::SWAP1 <= instr && instr <= eth::Instruction::SWAP16)
+ if (solidity::Instruction::SWAP1 <= instr && instr <= solidity::Instruction::SWAP16)
fatalParserError("SWAPi instructions not allowed for functional notation");
expectToken(Token::LParen);