-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwnt_VectorLiteral.h
53 lines (41 loc) · 1.76 KB
/
wnt_VectorLiteral.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*=====================================================================
wnt_VectorLiteral.h
-------------------
Copyright Glare Technologies Limited 2015 -
=====================================================================*/
#pragma once
#include "wnt_ASTNode.h"
namespace llvm { class Value; };
namespace Winter
{
/*=====================================================================
VectorLiteral
-------------------
e.g. [1, 2, 3]v
=====================================================================*/
class VectorLiteral : public ASTNode
{
public:
VectorLiteral(const std::vector<ASTNodeRef>& elems, const SrcLocation& loc, bool has_int_suffix, int int_suffix);
virtual ValueRef exec(VMState& vmstate);
virtual TypeRef type() const;
virtual void print(int depth, std::ostream& s) const;
virtual std::string sourceString(int depth) const;
virtual std::string emitOpenCLC(EmitOpenCLCodeParams& params) const;
virtual void traverse(TraversalPayload& payload, std::vector<ASTNode*>& stack);
virtual void updateChild(const ASTNode* old_val, ASTNodeRef& new_val);
virtual llvm::Value* emitLLVMCode(EmitLLVMCodeParams& params, llvm::Value* ret_space_ptr) const;
virtual Reference<ASTNode> clone(CloneMapType& clone_map);
virtual bool isConstant() const;
virtual size_t getTimeBound(GetTimeBoundParams& params) const;
virtual GetSpaceBoundResults getSpaceBound(GetSpaceBoundParams& params) const;
virtual size_t getSubtreeCodeComplexity() const;
const std::vector<ASTNodeRef>& getElements() const { return elements; }
private:
bool areAllElementsConstant() const;
std::vector<ASTNodeRef> elements;
bool has_int_suffix;
int int_suffix;
};
typedef Reference<VectorLiteral> VectorLiteralRef;
} // end namespace Winter