diff options
author | Eric Anholt <eric@anholt.net> | 2010-04-07 11:46:26 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-04-08 11:24:06 -0700 |
commit | cad9766118d269725ef33b4e9588d674d5225010 (patch) | |
tree | 41226eeade127594a93b3f4780d9da9dd026b2eb /ir.h | |
parent | b427c917ce47675b102fac3ddace883629ff6be8 (diff) |
Inline functions consisting of a return of an expression.
Diffstat (limited to 'ir.h')
-rw-r--r-- | ir.h | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -55,6 +55,9 @@ public: virtual class ir_dereference * as_dereference() { return NULL; } virtual class ir_rvalue * as_rvalue() { return NULL; } virtual class ir_loop * as_loop() { return NULL; } + virtual class ir_assignment * as_assignment() { return NULL; } + virtual class ir_call * as_call() { return NULL; } + virtual class ir_return * as_return() { return NULL; } /*@}*/ protected: @@ -361,6 +364,11 @@ public: v->visit(this); } + virtual ir_assignment * as_assignment() + { + return this; + } + /** * Left-hand side of the assignment. */ @@ -461,6 +469,8 @@ public: v->visit(this); } + ir_expression *clone(); + ir_expression_operation operation; ir_rvalue *operands[2]; }; @@ -479,6 +489,11 @@ public: actual_parameters->move_nodes_to(& this->actual_parameters); } + virtual ir_call *as_call() + { + return this; + } + virtual void accept(ir_visitor *v) { v->visit(this); @@ -505,6 +520,17 @@ public: return callee->function_name(); } + const ir_function_signature *get_callee() + { + return callee; + } + + /** + * Generates an inline version of the function before @ir, + * returning the return value of the function. + */ + ir_rvalue *generate_inline(ir_instruction *ir); + private: ir_call() : callee(NULL) @@ -547,6 +573,11 @@ public: /* empty */ } + virtual ir_return *as_return() + { + return this; + } + ir_rvalue *get_value() const { return value; @@ -632,6 +663,17 @@ class ir_swizzle : public ir_rvalue { public: ir_swizzle(ir_rvalue *, unsigned x, unsigned y, unsigned z, unsigned w, unsigned count); + ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask) + : val(val), mask(mask) + { + /* empty */ + } + + ir_swizzle *clone() + { + return new ir_swizzle(this->val, this->mask); + } + /** * Construct an ir_swizzle from the textual representation. Can fail. */ @@ -703,6 +745,11 @@ public: v->visit(this); } + ir_constant *clone() + { + return new ir_constant(this->type, &this->value); + } + /** * Value of the constant. * |