|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.backend.Intrinsics
public abstract class Intrinsics
This class represents a target independent implementation for compiler intrinsics.
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
Intrinsics are invoked dynamically using Java reflection and are expected to be found inside the callers Generator instance (i.e. AlphaGenerator). The method invoked to implement the intrinsic is set at the time an intrinsic is installed. By default the method called is set to the same name as the external function name being turned into an intrinsic. See installIntrinsic() below for more details.
The current implementation assumes that before a function call is replaced with an intrinsic, the arguments to the function call have been setup exactly as they would have been if the call took place. This allows the method which implements an intrinsic to make assumptions about where arguments reside.
Constructor Summary | |
---|---|
protected |
Intrinsics(Generator gen,
java.lang.Class<Generator> c)
Constructor used to instantiate a new intrinsic handler. |
Method Summary | |
---|---|
static int |
created()
Return the number of instances of this class created. |
protected void |
installIntrinsic(java.lang.String name,
Type[] args,
Type rt)
Called by a backend wishing to install a compiler intrinsic. |
protected void |
installIntrinsic(java.lang.String name,
Type[] args,
Type rt,
java.lang.String methodName)
Called by a backend wishing to install a compiler intrinsic. |
boolean |
invokeIntrinsic(java.lang.String name,
Expr[] args,
Type rt)
Called by a backend to convert a function call into an intrinsic. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Intrinsics(Generator gen, java.lang.Class<Generator> c)
gen
- the instance of Generator that instantiated this class.c
- the class type of Generator, ex. AlphaGenerator.class.Method Detail |
---|
public static int created()
protected void installIntrinsic(java.lang.String name, Type[] args, Type rt)
name
- the function name, i.e. "abs"args
- the parameters to the functionrt
- the return typeprotected void installIntrinsic(java.lang.String name, Type[] args, Type rt, java.lang.String methodName)
name
- the function name, i.e. "abs"args
- the parameters to the functionrt
- the return typemethodName
- the name of the method that implements this
intrinsic in the compilerpublic boolean invokeIntrinsic(java.lang.String name, Expr[] args, Type rt)
name
- the function name, i.e. "abs"args
- the parameters to the functionrt
- the return type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |