Add support for function pointers.
Both uniform and varying function pointers are supported; when a function is called through a varying function pointer, each unique function pointer value across the running program instances is called once for the set of active program instances that want to call it.
This commit is contained in:
18
expr.h
18
expr.h
@@ -490,6 +490,7 @@ public:
|
||||
Expr *TypeCheck();
|
||||
Expr *Optimize();
|
||||
int EstimateCost() const;
|
||||
llvm::Constant *GetConstant(const Type *type) const;
|
||||
|
||||
const Type *type;
|
||||
Expr *expr;
|
||||
@@ -568,6 +569,7 @@ public:
|
||||
Expr *Optimize();
|
||||
void Print() const;
|
||||
int EstimateCost() const;
|
||||
llvm::Constant *GetConstant(const Type *type) const;
|
||||
|
||||
bool ResolveOverloads(const std::vector<const Type *> &argTypes);
|
||||
Symbol *GetMatchingFunction();
|
||||
@@ -586,6 +588,8 @@ private:
|
||||
|
||||
/** The actual matching function found after overload resolution. */
|
||||
Symbol *matchingFunc;
|
||||
|
||||
bool triedToResolve;
|
||||
};
|
||||
|
||||
|
||||
@@ -604,6 +608,20 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/** @brief An expression that represents a NULL pointer. */
|
||||
class NullPointerExpr : public Expr {
|
||||
public:
|
||||
NullPointerExpr(SourcePos p) : Expr(p) { }
|
||||
|
||||
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
|
||||
const Type *GetType() const;
|
||||
Expr *TypeCheck();
|
||||
Expr *Optimize();
|
||||
void Print() const;
|
||||
int EstimateCost() const;
|
||||
};
|
||||
|
||||
|
||||
/** This function indicates whether it's legal to convert from fromType to
|
||||
toType.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user