|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.dms.kjc.common.CommonUtils
public class CommonUtils
Some public static utility functions pulled out of other routines.
| Constructor Summary | |
|---|---|
CommonUtils()
|
|
| Method Summary | |
|---|---|
static String |
CTypeToString(CType s,
boolean hasBoolType)
Turn a CType into a string for inclusion in C or C++ code generation. |
static String |
CTypeToStringA(CType s,
boolean hasBoolType)
Turn a CType into a string for inclusion in C or C++ code generation. |
static String |
declToString(CType s,
String ident,
boolean hasBoolType)
Returns a declaration for the given type with the given identifier. |
static CType |
getBaseType(CType type)
Return the underlying CType for a Ctype. |
static CType |
getJoinerType(FlatNode joiner)
Get the output type of a joiner in a Flatnode representation. |
static CType |
getOutputType(FlatNode node)
Get the output type of any FlatNode element (filter, splitter, joiner). |
static JExpression |
lhsBaseExpr(JExpression expr)
Take an expression that could occur on the lhs of an assignment and drill down to find the name of the field or local involved. |
static int[] |
makeArrayInts(JExpression[] dims)
Make an array of int's from an array of JExpression's for array dimensions. |
static JVariableDefinition |
makeArrayVariableDefn(int numElements,
CType elementType,
String arrayName)
Make a JVariableDefinition for a static array. |
static int |
nextPow2(int i)
Compute the smallest power of 2 that is >= i and >= 0. |
static void |
println_debugging(String s)
Print a string only if compiling with --debug |
static String |
structToTypedef(SIRStructure strct,
boolean hasBoolType)
Factor out printing (or misprinting) of SIRStruct typedefs from various backends |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CommonUtils()
| Method Detail |
|---|
public static int[] makeArrayInts(JExpression[] dims)
dims - An array of JExpressions that shuold all be JIntLiteral's
public static CType getBaseType(CType type)
type - a CType
public static String CTypeToString(CType s,
boolean hasBoolType)
s - a CType.hasBoolType - if true then Java 'boolean' becomse 'bool' for C++
if false then Java 'boolean' becomse 'int' for C
public static String CTypeToStringA(CType s,
boolean hasBoolType)
declToString as
declToString(type, "", tf)
s - a CType.hasBoolType - if true then Java 'boolean' becomse 'bool' for C++
if false then Java 'boolean' becomse 'int' for C
public static String declToString(CType s,
String ident,
boolean hasBoolType)
s - the type to declareident - the identifier to declarehasBoolType - if true then Java 'boolean' becomse 'bool' for C++
if false then Java 'boolean' becomse 'int' for C
public static String structToTypedef(SIRStructure strct,
boolean hasBoolType)
strct - a SIRStructure to printhasBoolType - if true then Java 'boolean' becomes 'bool' for C++
if false then Java 'boolean' becomes 'int' for C
public static JExpression lhsBaseExpr(JExpression expr)
expr - An expression that could occur on the left-hand side
of an assignment
public static CType getJoinerType(FlatNode joiner)
joiner - a joiner in a FlatNode representation
public static CType getOutputType(FlatNode node)
node - a FlatNode (and not null)
public static void println_debugging(String s)
s - the debugging string to print.
public static JVariableDefinition makeArrayVariableDefn(int numElements,
CType elementType,
String arrayName)
numElements - Number of elementselementType - Type of elementsarrayName - Name of array
public static int nextPow2(int i)
i -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||