summaryrefslogtreecommitdiffhomepage
path: root/flowgraph
diff options
context:
space:
mode:
Diffstat (limited to 'flowgraph')
-rw-r--r--flowgraph/data.h32
-rw-r--r--flowgraph/node.cpp8
-rw-r--r--flowgraph/node.h2
-rw-r--r--flowgraph/storage.h17
4 files changed, 28 insertions, 31 deletions
diff --git a/flowgraph/data.h b/flowgraph/data.h
index 2b92b2e..65bac8f 100644
--- a/flowgraph/data.h
+++ b/flowgraph/data.h
@@ -8,18 +8,32 @@
namespace FlowGraph {
- // Explicitely not including size
+ // Data models:
+ // 64 bit Linux: LLP64
+ // 64 bit Windows: LP64
+ //
+ // Explicitely NOT defined here:
+ // * Size (same as Pointer, LongLong on Linux and Windows)
+ // * Bool (Byte)
+ // * Long (different on Linux (64 bit) and Windows (32 bit))
enum class DataType: int
{
- Size,
- Int,
+ Char, // 8 bit
+ UChar, // 8 bit
+
+ Short, // 16 bit on 64 bit Linux and Windows
+ UShort,
+
+ Int, // 32 bit on 64 bit Linux and Windows
UInt,
- Pointer,
- Bool,
- Char,
- UChar,
- Short,
- UShort
+
+ LongLong, // 64 bit on 64 bit Linux and Windows
+ ULongLong,
+
+ Pointer, // 64 bit on 64 bit Linux and Windows, size is same size
+
+ Float, // 32 bit, IEEE 754
+ Double // 64 bit, IEEE 754
};
class Storage; ///< forward declaration
diff --git a/flowgraph/node.cpp b/flowgraph/node.cpp
index d7ed939..cb7677a 100644
--- a/flowgraph/node.cpp
+++ b/flowgraph/node.cpp
@@ -22,16 +22,16 @@ Data FlowGraph::MakeConstantInt(int i)
return Data{DataType::Int, std::make_shared<Constant>(endian::to_little(uint32_t(i)))};
}
-Data FlowGraph::MakeLocalPointer(std::shared_ptr<FlowGraph::LocalScope> scope, const std::string& name)
+Data FlowGraph::MakeLocalInt(std::shared_ptr<FlowGraph::LocalScope> scope, const std::string& name)
{
- Data data{DataType::Pointer, std::make_shared<LocalStorage>(name)};
+ Data data{DataType::Int, std::make_shared<LocalStorage>(name)};
scope->push_back(std::make_shared<Data>(data));
return data;
}
-Data FlowGraph::MakeLocalSize(std::shared_ptr<FlowGraph::LocalScope> scope, const std::string& name)
+Data FlowGraph::MakeLocalPointer(std::shared_ptr<FlowGraph::LocalScope> scope, const std::string& name)
{
- Data data{DataType::Size, std::make_shared<LocalStorage>(name)};
+ Data data{DataType::Pointer, std::make_shared<LocalStorage>(name)};
scope->push_back(std::make_shared<Data>(data));
return data;
}
diff --git a/flowgraph/node.h b/flowgraph/node.h
index def3c04..34e937b 100644
--- a/flowgraph/node.h
+++ b/flowgraph/node.h
@@ -48,8 +48,8 @@ namespace FlowGraph {
};
Data MakeConstantInt(int i);
+ Data MakeLocalInt(std::shared_ptr<FlowGraph::LocalScope> scope, const std::string& name);
Data MakeLocalPointer(std::shared_ptr<FlowGraph::LocalScope> scope, const std::string& name);
- Data MakeLocalSize(std::shared_ptr<FlowGraph::LocalScope> scope, const std::string& name);
Data MakeTemporaryInt(std::shared_ptr<LocalScope> scope);
class MemCopy: public Node
diff --git a/flowgraph/storage.h b/flowgraph/storage.h
index 7b5c53b..9e95905 100644
--- a/flowgraph/storage.h
+++ b/flowgraph/storage.h
@@ -57,21 +57,4 @@ namespace FlowGraph {
TemporaryStorage();
};
- // dereferenced pointer
- class PointeeStorage : public Storage
- {
- public:
- PointeeStorage(const Data& pointer, const Data& offset): m_pointer(pointer), m_offset(offset) {
- if (pointer.type() != DataType::Pointer)
- throw std::runtime_error("Pointer argument must be a DataType::Pointer");
- if (offset.type() != DataType::Size)
- throw std::runtime_error("Offset argument must be a DataType::Size");
- }
- Data pointer() { return m_pointer; }
- Data offset() { return m_offset; }
- private:
- Data m_pointer;
- Data m_offset;
- };
-
}