coins
クラス SourceLanguage

java.lang.Object
  |
  +--coins.SourceLanguage
直系の既知のサブクラス:
SourceLanguageC, SourceLanguageFortran

public class SourceLanguage
extends java.lang.Object

SourceLanguage class Defines IR and Sym methods that depend on source language. Methods in this interface can be accessed in such way as symRoot.sourceLanguage.xxx(....). This is the super class for SourceLanguageC, SourceLanguageFortran, etc.


フィールドの概要
static int[][] CONVERTIBLE
           
 java.util.Set functionsWithoutSideEffect
          Set of the names of functions that have no side effect (do not write to memory).
static int[][] REDEFINABLE
           
static boolean subscriptWithIndex
          subscriptWithIndex: Temporal parameter to be removed.
 SymRoot symRoot
           
 
コンストラクタの概要
SourceLanguage(SymRoot pSymRoot)
           
 
メソッドの概要
 Type baseTypeOrigin(Type pBaseType)
          baseTypeOrigin: get origin of given base type pBaseType.
 Const evaluateAdd(Const c1, Const c2)
          Evaluate add operation.
 Const evaluateAnd(Const c1, Const c2)
          Evaluate and operation.
 Const evaluateCast(Type t, Const c)
          Evaluate cast operation.
 int evaluateCondition(Const c)
          Evaluate conditional expression.
 Const evaluateDiv(Const c1, Const c2)
          Evaluate divide operation.
 Const evaluateMod(Const c1, Const c2)
          Evaluate remainder operation.
 Const evaluateMult(Const c1, Const c2)
          Evaluate multiply operation.
 Const evaluateNeg(Const c1)
          Evaluate negate operation.
 Const evaluateNot(Const c1)
          Evaluate not operation.
 Const evaluateOr(Const c1, Const c2)
          Evaluate or operation.
 int evaluateRelation(Const c1, Const c2)
          Evaluate relational expression.
 Const evaluateShiftLl(Const c1, Const c2)
          Evaluate logical left shift operation.
 Const evaluateShiftRa(Const c1, Const c2)
          Evaluate arithmetic right shift operation.
 Const evaluateShiftRl(Const c1, Const c2)
          Evaluate logical right shift operation.
 Const evaluateSub(Const c1, Const c2)
          Evaluate subtract operation.
 Const evaluateXor(Const c1, Const c2)
          Evaluate xor operation.
 java.util.Set getFunctionsWithoutSideEffect()
          Get the set of functions wituout side effect.
static java.lang.String getPureFloatString(java.lang.String pInternedName)
          getPureFloatString: //##21 Get the string representation of floating constant without language specific suffix.
static java.lang.String getPureIntString(java.lang.String pInternedName)
          getPureIntString: //##20 Get the string representation of integer constant composed of only digits.
 java.lang.String getSourceStringConst(java.lang.String pStringBody)
          getSourceStringConst: Change the pure string pStringBody to a string constant in source language.
 int getStringLength(java.lang.String pStringBody)
          getSourceStringConstStatic: Same as getSourceStringConst except that this is a static method. public static String getSourceStringConstStatic( String pStringBody ) { return makeCstringWithTrailing0static(pStringBody); } /** getStringLength: Get the length of string constant.
 void initiateFunctionsWithoutSideEffect()
          Set the names of functions without side effect.
static boolean isC()
          isC:
static boolean isFortran()
          isFortran:
 boolean isMainProgram(Subp pSubp)
          isMainProgram:
 java.lang.String makeCstring(java.lang.String pStringBody)
          makeCstring: Change the pure string pStringBody to C string representation adding heading, trailing quotations and escape characters if required.
static java.lang.String makeCstringStatic(java.lang.String pStringBody)
          makeCstringStatic: Same as makeCstring except that this is a static method.
 java.lang.String makeCstringWithTrailing0(java.lang.String pStringBody)
          makeCstringWithTrailing0: Change the pure string pStringBody to C string representation adding heading, trailing quotations and escape characters if required.
static java.lang.String makeCstringWithTrailing0static(java.lang.String pStringBody)
          makeCstringWithTrailing0static: Same as makeCstringWithTrailing0 except that this is a static method.
static java.lang.String makeFloatConstString(java.lang.String pInternedConstString, Type pType)
          makeFloatConstString: //##21 Make the string representation of floating constant in the form of source language constant.
static java.lang.String makeIntConstString(java.lang.String pInternedConstString, Type pType)
          makeIntConstString: //##20 Make the string representation of integer constant in the form of source language constant.
 java.lang.String makeStringBody(java.lang.String pSourceString)
          makeStringBody: Make internal representation of string (pure string) from its source program representation which may differ by source language.
 java.lang.String makeStringBodyForC(java.lang.String pCstring)
          makeStringBodyForC: Make internal representation of a string (pure string) from its C language string representation.
static java.lang.String makeStringBodyForCstatic(java.lang.String pCstring)
          makeStringBodyForCstatic: Same as makeStringBodyForC except that this is a static method.
static java.lang.String makeStringBodyStatic(java.lang.String pSourceString)
          makeStringBodyStatic: Same as makeStringBody except that this is a static method.
 int numberOfAddressingUnitsForCharString(MachineParam machineParam, int elemCount)
          Get the number of addressing units for the character string whose element count is given by elemCount.
 int numberOfAddressingUnitsForShortArray(MachineParam machineParam, int elemCount)
          Get the number of addressing units for the short int array whose element count is given by elemCount.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

symRoot

public final SymRoot symRoot

functionsWithoutSideEffect

public java.util.Set functionsWithoutSideEffect
Set of the names of functions that have no side effect (do not write to memory). This may be changed by directives such as pragma and can be restored to the initial state by calling initiateFunctionsWithoutSideEffect().


REDEFINABLE

public static final int[][] REDEFINABLE

CONVERTIBLE

public static final int[][] CONVERTIBLE

subscriptWithIndex

public static final boolean subscriptWithIndex
subscriptWithIndex: Temporal parameter to be removed. true: generate subs exp of HIR with index operand. false: generate subs exp of HIR without index operand.

関連項目:
定数フィールド値
コンストラクタの詳細

SourceLanguage

public SourceLanguage(SymRoot pSymRoot)
メソッドの詳細

isC

public static boolean isC()
isC:

戻り値:
true if the source language is C, false otherwise.

isFortran

public static boolean isFortran()
isFortran:

戻り値:
true if the source language is FORTRAN, false otherwise.

numberOfAddressingUnitsForCharString

public int numberOfAddressingUnitsForCharString(MachineParam machineParam,
                                                int elemCount)
Get the number of addressing units for the character string whose element count is given by elemCount. If the character string contains terminator (such as \0 in C string) then it is counted in giving elemCount. Thus, in C language, the elemCount for "", "a", "abc" is 1, 2, 4, each respecrtively. For the language that represents a character in one addressing unit (may be a byte), the returned value will be elemCount*machineParam.evaluateSize(Type.KIND_CHAR). For the language (and word addressing machine) that packs several characters in one addressing unit (may be a word), the returned value will be different. Such computation should be given in a subclass corresponding to the language. Example: Consider that character code is represented in 8 bit and character strings declared as packed array[1..n] of char are to be implemented on a 32-bit word addressing machine where the top position of the character strings should start at 32-bit word boundary. Then this function may return the value (elemCount * 8 + 31)/32 as the number of 32-bit words required to represent character strings.

パラメータ:
machineParam - MachineParam instance.
elemCount - number of characters in the string.
戻り値:
the number of addressing units.

numberOfAddressingUnitsForShortArray

public int numberOfAddressingUnitsForShortArray(MachineParam machineParam,
                                                int elemCount)
Get the number of addressing units for the short int array whose element count is given by elemCount. For the language that represents a short int value by using one or more addressing units (may be bytes), the returned value will be elemCount*evaluateSize(Type.KIND_SHORT). For the language (and word addressing machine) that packs several short int values in one addressing unit (may be a word), the returned value will be different. Such computation should be given in a subclass corresponding to the language. Example: Consider that short int is represented in 16 bit and short int arrays declared as packed array[1..n] of short int are to be implemented on a 32-bit word addressing machine where the top position of the short int arrays should start at 32-bit word boundary. Then this function may return the value (elemCount * 16 + 31)/32 as the number of 32-bit words required to represent packed short int arrays.

パラメータ:
machineParam - MachineParam instance.
elemCount - number of short int elements in the array.
戻り値:
the number of addressing units.

makeStringBody

public java.lang.String makeStringBody(java.lang.String pSourceString)
makeStringBody: Make internal representation of string (pure string) from its source program representation which may differ by source language. Pure string means string body which does not contain enclosing quotation marks that may be requested by source language, and in which, a pair of escape character and special character is changed to the special character itself. In C language, trailing \0 is not included in the string body. //##47

戻り値:
internal representation of string literal excluding heading/trailing quotes and escape characters used to represent special character.

makeStringBodyStatic

public static java.lang.String makeStringBodyStatic(java.lang.String pSourceString)
makeStringBodyStatic: Same as makeStringBody except that this is a static method.


makeStringBodyForC

public java.lang.String makeStringBodyForC(java.lang.String pCstring)
makeStringBodyForC: Make internal representation of a string (pure string) from its C language string representation. Escape characters are processed to represent proper character code.

戻り値:
internal representation of string literal excluding quotes and escape characters.

makeStringBodyForCstatic

public static java.lang.String makeStringBodyForCstatic(java.lang.String pCstring)
makeStringBodyForCstatic: Same as makeStringBodyForC except that this is a static method.


makeCstring

public java.lang.String makeCstring(java.lang.String pStringBody)
makeCstring: Change the pure string pStringBody to C string representation adding heading, trailing quotations and escape characters if required. (See makeStringBody.) Trailing \0 is not added as printable character. See makeCstringWithTrailing0

戻り値:
the string changed in C form.

makeCstringStatic

public static java.lang.String makeCstringStatic(java.lang.String pStringBody)
makeCstringStatic: Same as makeCstring except that this is a static method.


makeCstringWithTrailing0

public java.lang.String makeCstringWithTrailing0(java.lang.String pStringBody)
makeCstringWithTrailing0: Change the pure string pStringBody to C string representation adding heading, trailing quotations and escape characters if required. (See makeStringBody.) Trailing \0 is added as printable character with escape char. See makeCstringWithTrailing0

戻り値:
the string changed in C form with trailing \0 as printable character.

makeCstringWithTrailing0static

public static java.lang.String makeCstringWithTrailing0static(java.lang.String pStringBody)
makeCstringWithTrailing0static: Same as makeCstringWithTrailing0 except that this is a static method.


getSourceStringConst

public java.lang.String getSourceStringConst(java.lang.String pStringBody)
getSourceStringConst: Change the pure string pStringBody to a string constant in source language. (See makeStringBody.) If the source language is C then return the string constant in C form. See makeCstringWithTrailing0

戻り値:
the string changed to the form of source language string constant.

getStringLength

public int getStringLength(java.lang.String pStringBody)
getSourceStringConstStatic: Same as getSourceStringConst except that this is a static method. public static String getSourceStringConstStatic( String pStringBody ) { return makeCstringWithTrailing0static(pStringBody); } /** getStringLength: Get the length of string constant.

戻り値:
the length of pStringBody. In C language, trailing \0 is counted as 1.

makeIntConstString

public static java.lang.String makeIntConstString(java.lang.String pInternedConstString,
                                                  Type pType)
makeIntConstString: //##20 Make the string representation of integer constant in the form of source language constant. For C language, supply L for long int, UL for unsigned long int, U for unsigned int, U for unsigned short, LL for long long int, ULL for unsigned long long int //##21 if the last character of given constant is a digit.

戻り値:
the resultant constant in interned string form.

getPureIntString

public static java.lang.String getPureIntString(java.lang.String pInternedName)
getPureIntString: //##20 Get the string representation of integer constant composed of only digits. For C language, peal off trailing U, u, L, l, UL, ul, ULL, ull. //##21

戻り値:
the resultant constant in interned string form.

makeFloatConstString

public static java.lang.String makeFloatConstString(java.lang.String pInternedConstString,
                                                    Type pType)
makeFloatConstString: //##21 Make the string representation of floating constant in the form of source language constant. For C language, supply D for double, F for float, if the last character of given constant is a digit or period.

戻り値:
the resultant constant in interned string form.

getPureFloatString

public static java.lang.String getPureFloatString(java.lang.String pInternedName)
getPureFloatString: //##21 Get the string representation of floating constant without language specific suffix. For C language, peal off trailing F and D.

戻り値:
the resultant constant in interned string form.

baseTypeOrigin

public Type baseTypeOrigin(Type pBaseType)
baseTypeOrigin: get origin of given base type pBaseType.

戻り値:
the origin type of pBaseType.

isMainProgram

public boolean isMainProgram(Subp pSubp)
isMainProgram:

戻り値:
true if pSubp is a main program, false otherwise.

evaluateNeg

public Const evaluateNeg(Const c1)
Evaluate negate operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateAdd

public Const evaluateAdd(Const c1,
                         Const c2)
Evaluate add operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateSub

public Const evaluateSub(Const c1,
                         Const c2)
Evaluate subtract operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateMult

public Const evaluateMult(Const c1,
                          Const c2)
Evaluate multiply operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateDiv

public Const evaluateDiv(Const c1,
                         Const c2)
Evaluate divide operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateMod

public Const evaluateMod(Const c1,
                         Const c2)
Evaluate remainder operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateNot

public Const evaluateNot(Const c1)
Evaluate not operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateShiftLl

public Const evaluateShiftLl(Const c1,
                             Const c2)
Evaluate logical left shift operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateShiftRl

public Const evaluateShiftRl(Const c1,
                             Const c2)
Evaluate logical right shift operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateShiftRa

public Const evaluateShiftRa(Const c1,
                             Const c2)
Evaluate arithmetic right shift operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateAnd

public Const evaluateAnd(Const c1,
                         Const c2)
Evaluate and operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateOr

public Const evaluateOr(Const c1,
                        Const c2)
Evaluate or operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateXor

public Const evaluateXor(Const c1,
                         Const c2)
Evaluate xor operation. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateCast

public Const evaluateCast(Type t,
                          Const c)
Evaluate cast operation. The evaluation conforms to C language.

パラメータ:
t - type to cast
c - constant operand
戻り値:
constant resultant or null(when failing in the evaluation)

evaluateCondition

public int evaluateCondition(Const c)
Evaluate conditional expression. The evaluation conforms to C language. This method defines what value the supported language considers to be true in 'if', 'for', '?:', etc.

パラメータ:
c - constant operand
戻り値:
1, 0 or MIN_VALUE as value of c is true, false, or unevaluable

evaluateRelation

public int evaluateRelation(Const c1,
                            Const c2)
Evaluate relational expression. The evaluation conforms to C language.

パラメータ:
c1 - constant operand
c2 - constant operand
戻り値:
-1, 0, 1 or MIN_VALUE as c1 is numerically less than,equal to, greater than, or incomparable to c2

initiateFunctionsWithoutSideEffect

public void initiateFunctionsWithoutSideEffect()
Set the names of functions without side effect. This may be overridden by defining a function having the same name in SourceLanguage corresponding to the language to be processed.


getFunctionsWithoutSideEffect

public java.util.Set getFunctionsWithoutSideEffect()
Get the set of functions wituout side effect.

戻り値:
the set of functions wituout side effect.