|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.PragmaStk
public final class PragmaStk
This class is used to hold and process #pragma information.
$Id: PragmaStk.java,v 1.5 2007-08-16 17:27:39 burrill Exp $
Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
This implementation allows multiple pragma stacks which, in turn, allows multiple threads to compile separate source files.
The parser allocates a new PragmaStk
and uses the
newPragma()
method to obtain the pragma that
contains the appropriate information. The AST nodes can then link
to this Pragma
instance.
Pragmas have the following syntax:
pragma := "#pragma" text text := ["push" | "pop"] [cmd] cmd := switch | unroll switch := sw {"on" | "off" | "default"} sw := "STDC FP_CONTRACT" | "STDC FENV_ACCESS" | "STDC CX_LIMITED_RANGE" | "LOOP_PERMUTE" | "LOOP_TEST_AT_END" unroll := "UNROLL" integerThe
push
prefix causes the current pragma values to
be pushed on a stack and a copy made that is then changed. The
pop
prefix causes the pragma values on the top of
the stack to be poped off and used as the current values before
being changed.
Nested Class Summary | |
---|---|
static class |
PragmaStk.Pragma
|
Field Summary | |
---|---|
static int |
CX_LIMITED_RANGE
|
static PragmaStk.Pragma |
defaultPragma
The default prama contains the defaults switch settings and values. |
static int |
FENV_ACCESS
|
static int |
FP_CONTRACT
|
static int |
JUST_TO_HAVE_2
Not used. |
static int |
LOOP_PERMUTE
|
static int |
LOOP_TEST_AT_END
|
static int |
UNROLL
The user specified loop unrolling factor. |
Constructor Summary | |
---|---|
PragmaStk(java.lang.String filename)
Create a pragma stack to be used in processing pragma information. |
Method Summary | |
---|---|
PragmaStk.Pragma |
getTop()
Return the current (top) pragma entry. |
boolean |
newPragma(java.lang.String pragmaText,
int lineno)
Obtain the pragma information to be used. |
static void |
setDefaultFlag(int flag,
boolean on)
Specify the default for the specified flag. |
static void |
setDefaultValue(int index,
int value)
Specify the default for the specified value. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FP_CONTRACT
public static final int FENV_ACCESS
public static final int CX_LIMITED_RANGE
public static final int LOOP_PERMUTE
public static final int LOOP_TEST_AT_END
public static final int UNROLL
public static final int JUST_TO_HAVE_2
public static final PragmaStk.Pragma defaultPragma
Constructor Detail |
---|
public PragmaStk(java.lang.String filename)
filename
- is the filename of the source code that will be
parsedMethod Detail |
---|
public PragmaStk.Pragma getTop()
public static void setDefaultFlag(int flag, boolean on)
public static void setDefaultValue(int index, int value)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean newPragma(java.lang.String pragmaText, int lineno)
text := ["push" | "pop"] [cmd] cmd := switch | unroll switch := sw {"on" | "off" | "default"} sw := "STDC FP_CONTRACT" | "STDC FENV_ACCESS" | "STDC CX_LIMITED_RANGE" | "LOOP_PERMUTE" | "LOOP_TEST_AT_END" unroll := "UNROLL" integerThe
push
prefix causes the current pragma values to
be pushed on a stack and a copy made that is then changed. The
pop
prefix causes the pragma values on the top of
the stack to be poped off and used as the current values before
being changed.
pragmaText
- is the pragma text to be processedlineno
- is the current line in the source code
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |