Type Class Reference

#include <include/type.h>

Inheritance diagram for Type:

ArrayType BooleanType CharType CompoundType FloatType FuncType IntegerType LowerType NamedType PointerType SizeType UnionType UpperType VoidType List of all members.

Detailed Description

Definition at line 73 of file type.h.

Public Member Functions

ArrayTypeasArray ()
BooleanTypeasBoolean ()
CharTypeasChar ()
CompoundTypeasCompound ()
FloatTypeasFloat ()
FuncTypeasFunc ()
IntegerTypeasInteger ()
LowerTypeasLower ()
NamedTypeasNamed ()
PointerTypeasPointer ()
SizeTypeasSize ()
UnionTypeasUnion ()
UpperTypeasUpper ()
VoidTypeasVoid ()
virtual Typeclone () const =0
ComplexTypeCompListcompForAddress (ADDRESS addr, DataIntervalMap &dim)
TypecreateUnion (Type *other, bool &ch, bool bHighestPtr=false)
Typedereference ()
void dump ()
unsigned getBytes () const
virtual const char * getCtype (bool final=false) const =0
eType getId () const
virtual unsigned getSize () const =0
virtual std::string getTempName () const
virtual bool isArray () const
virtual bool isBoolean () const
virtual bool isChar () const
virtual bool isCompatible (Type *other, bool all)=0
virtual bool isCompatibleWith (Type *other, bool all=false)
virtual bool isComplete ()
virtual bool isCompound () const
bool isCString ()
virtual bool isFloat () const
virtual bool isFunc () const
virtual bool isInteger () const
virtual bool isLower () const
virtual bool isNamed () const
virtual bool isPointer () const
bool isPointerToAlpha ()
virtual bool isSize () const
bool isSubTypeOrEqual (Type *other)
virtual bool isUnion () const
virtual bool isUpper () const
virtual bool isVoid () const
virtual Expmatch (Type *pattern)
virtual TypemeetWith (Type *other, bool &ch, bool bHighestPtr=false)=0
virtual TypemergeWith (Type *other)
bool operator *= (const Type &other) const
virtual bool operator!= (const Type &other) const
virtual bool operator< (const Type &other) const =0
virtual bool operator== (const Type &other) const =0
const char * prints ()
bool resolvesToArray ()
bool resolvesToBoolean ()
bool resolvesToChar ()
bool resolvesToCompound ()
bool resolvesToFloat ()
bool resolvesToFunc ()
bool resolvesToInteger ()
bool resolvesToLower ()
bool resolvesToPointer ()
bool resolvesToSize ()
bool resolvesToUnion ()
bool resolvesToUpper ()
bool resolvesToVoid ()
virtual void setSize (int sz)
void starPrint (std::ostream &os)
 Type (eType id)
virtual ~Type ()

Static Public Member Functions

static void addNamedType (const char *name, Type *type)
static void clearNamedTypes ()
static void dumpNames ()
static TypegetNamedType (const char *name)
static TypegetTempType (const std::string &name)
static TypenewIntegerLikeType (int size, int signedness)
static TypeparseType (const char *str)

Protected Attributes

eType id

Static Private Attributes

static std::map< std::string,
Type * > 
namedTypes

Friends

class XMLProgParser


Constructor & Destructor Documentation

Type::Type eType  id  ) 
 

Definition at line 63 of file type.cpp.

Type::~Type  )  [virtual]
 

Definition at line 8 of file typeStubs.cpp.


Member Function Documentation

void Type::addNamedType const char *  name,
Type type
[static]
 

Definition at line 12 of file typeStubs.cpp.

ArrayType* Type::asArray  ) 
 

Referenced by CHLLCode::appendType(), CHLLCode::appendTypeIdent(), compForAddress(), ArrayType::fixBaseType(), ArrayType::isCompatible(), isCString(), UserProc::mapExpressionsToLocals(), and ArrayType::meetWith().

BooleanType* Type::asBoolean  ) 
 

CharType* Type::asChar  ) 
 

CompoundType* Type::asCompound  ) 
 

Referenced by compForAddress(), createUnion(), Unary::descendType(), DataIntervalMap::enterComponent(), PentiumFrontEnd::extraProcessCall(), Decompiler::getCompoundMembers(), CompoundType::isCompatible(), CompoundType::isSubStructOf(), CompoundType::isSuperStructOf(), DataIntervalMap::replaceComponents(), and TypeTest::testCompound().

FloatType* Type::asFloat  ) 
 

Referenced by FloatType::meetWith().

FuncType* Type::asFunc  ) 
 

Referenced by FrontEnd::getEntryPoints(), and FuncType::isCompatible().

IntegerType* Type::asInteger  ) 
 

Referenced by checkSignedness(), IntegerType::meetWith(), operator<<(), and ExpCastInserter::postVisit().

LowerType* Type::asLower  ) 
 

Referenced by LowerType::isCompatible(), and LowerType::meetWith().

NamedType * Type::asNamed  ) 
 

Definition at line 1073 of file type.cpp.

Referenced by match().

PointerType* Type::asPointer  ) 
 

Referenced by CHLLCode::appendType(), CHLLCode::appendTypeIdent(), Unary::ascendType(), dereference(), Unary::descendType(), Binary::descendType(), Assignment::dfaTypeAnalysis(), PentiumFrontEnd::extraProcessCall(), PointerType::getFinalPointsTo(), PointerType::isCompatible(), isCString(), UserProc::mapExpressionsToLocals(), PointerType::match(), PointerType::meetWith(), PointerType::pointerDepth(), Prog::readNativeAs(), and TypeTest::testCompound().

SizeType* Type::asSize  ) 
 

UnionType* Type::asUnion  ) 
 

Referenced by dereference().

UpperType* Type::asUpper  ) 
 

Referenced by UpperType::isCompatible(), and UpperType::meetWith().

VoidType* Type::asVoid  ) 
 

static void Type::clearNamedTypes  )  [inline, static]
 

Definition at line 177 of file type.h.

References namedTypes.

Referenced by StatementTest::testBypass(), FrontSparcTest::testDelaySlot(), CfgTest::testDominators(), CfgTest::testPlacePhi(), CfgTest::testPlacePhi2(), CfgTest::testRenameVars(), and CfgTest::testSemiDominators().

virtual Type* Type::clone  )  const [pure virtual]
 

Implemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, UnionType, SizeType, UpperType, and LowerType.

Referenced by CHLLCode::AddLocal(), Assign::Assign(), LowerType::clone(), UpperType::clone(), ArrayType::clone(), ImpRefStatement::clone(), Assign::clone(), CustomSignature::clone(), Signature::clone(), CallingConvention::StdC::SparcLibSignature::clone(), CallingConvention::StdC::SparcSignature::clone(), CallingConvention::StdC::PPCSignature::clone(), CallingConvention::StdC::PentiumSignature::clone(), CallingConvention::Win32TcSignature::clone(), CallingConvention::Win32Signature::clone(), Parameter::clone(), TypeVal::clone(), createUnion(), deltaDifference(), CallStatement::generateCode(), UserProc::insertParameter(), LowerType::meetWith(), UpperType::meetWith(), ArrayType::meetWith(), CharType::meetWith(), VoidType::meetWith(), Statement::meetWithFor(), SizeType::mergeWith(), IntegerType::mergeWith(), CallStatement::setNumArguments(), CallStatement::setSigArguments(), TypedExp::TypedExp(), and CallStatement::updateArguments().

ComplexTypeCompList & Type::compForAddress ADDRESS  addr,
DataIntervalMap dim
 

Definition at line 1465 of file type.cpp.

References asArray(), asCompound(), DataIntervalMap::find(), ArrayType::getBaseType(), CompoundType::getOffsetRemainder(), getSize(), ComplexTypeComp::index, ComplexTypeComp::isArray, isArray(), isCompound(), NULL, and ComplexTypeComp::u.

Referenced by TypeTest::testDataInterval().

Type * Type::createUnion Type other,
bool &  ch,
bool  bHighestPtr = false
 

Definition at line 686 of file dfa.cpp.

References asCompound(), clone(), CompoundType::getType(), isCompatibleWith(), meetWith(), resolvesToCompound(), and resolvesToUnion().

Referenced by deltaMinuend(), deltaSubtrahend(), CompoundType::meetWith(), NamedType::meetWith(), BooleanType::meetWith(), FuncType::meetWith(), and sigmaSum().

Type * Type::dereference  ) 
 

Definition at line 1481 of file dfa.cpp.

References asPointer(), asUnion(), UnionType::dereferenceUnion(), PointerType::getPointsTo(), resolvesToPointer(), and resolvesToUnion().

Referenced by UnionType::dereferenceUnion().

void Type::dump  ) 
 

Definition at line 882 of file type.cpp.

References getCtype().

void Type::dumpNames  )  [static]
 

Definition at line 922 of file type.cpp.

References namedTypes.

unsigned Type::getBytes  )  const [inline]
 

Definition at line 160 of file type.h.

References getSize().

virtual const char* Type::getCtype bool  final = false  )  const [pure virtual]
 

Implemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, UnionType, SizeType, UpperType, and LowerType.

Referenced by DataIntervalMap::addItem(), Signature::addParameter(), CallStatement::addSigParam(), CompoundType::addType(), TypedExp::appendDotFile(), Unary::descendType(), dump(), ArrayType::getCtype(), PointerType::getCtype(), FuncType::getCtype(), FuncType::getReturnAndParam(), PointerType::match(), match(), UserProc::newLocal(), TypeVal::print(), Proc::printDetailsXML(), prints(), TypedExp::printx(), UserProc::setLocalType(), Assignment::setTypeFor(), TypeTest::testCompound(), DfaTest::testMeetPointer(), DfaTest::testMeetUnion(), and StmtSsaXformer::visit().

eType Type::getId  )  const [inline]
 

Definition at line 83 of file type.h.

Referenced by LowerType::operator<(), UpperType::operator<(), SizeType::operator<(), UnionType::operator<(), CompoundType::operator<(), ArrayType::operator<(), and operator<<().

Type * Type::getNamedType const char *  name  )  [static]
 

Definition at line 9 of file typeStubs.cpp.

Referenced by CompoundType::addType(), FrontEnd::decode(), Decompiler::getCompoundMembers(), FrontEnd::getEntryPoints(), and NamedType::resolvesTo().

virtual unsigned Type::getSize  )  const [pure virtual]
 

Implemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, UnionType, SizeType, UpperType, and LowerType.

Referenced by DataIntervalMap::addItem(), compForAddress(), Unary::descendType(), getBytes(), Decompiler::getCompoundMembers(), LowerType::getSize(), UpperType::getSize(), ArrayType::getSize(), SizeType::isCompatible(), Prog::makeArrayType(), CompoundType::operator<(), Exp::printt(), DataIntervalMap::replaceComponents(), ArrayType::setBaseType(), and CompoundType::setTypeAtOffset().

std::string Type::getTempName  )  const [virtual]
 

Reimplemented in IntegerType, and FloatType.

Definition at line 11 of file typeStubs.cpp.

Type * Type::getTempType const std::string &  name  )  [static]
 

Definition at line 935 of file type.cpp.

Referenced by TempToLocalMapper::visit().

virtual bool Type::isArray  )  const [inline, virtual]
 

Reimplemented in ArrayType.

Definition at line 102 of file type.h.

Referenced by CHLLCode::AddGlobal(), CHLLCode::appendTypeIdent(), Statement::canPropagateToExp(), compForAddress(), ArrayType::fixBaseType(), ArrayType::match(), and ArrayType::operator==().

virtual bool Type::isBoolean  )  const [inline, virtual]
 

Reimplemented in BooleanType.

Definition at line 97 of file type.h.

virtual bool Type::isChar  )  const [inline, virtual]
 

Reimplemented in CharType.

Definition at line 98 of file type.h.

virtual bool Type::isCompatible Type other,
bool  all
[pure virtual]
 

Implemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, UnionType, SizeType, UpperType, and LowerType.

Referenced by isCompatibleWith().

bool Type::isCompatibleWith Type other,
bool  all = false
[virtual]
 

Reimplemented in ArrayType, CompoundType, and UnionType.

Definition at line 1320 of file dfa.cpp.

References isCompatible(), resolvesToArray(), resolvesToCompound(), and resolvesToUnion().

Referenced by ExpCastInserter::checkMemofType(), createUnion(), DataIntervalMap::enterComponent(), UserProc::getSymbolFor(), LowerType::isCompatible(), UpperType::isCompatible(), CompoundType::isCompatible(), ArrayType::isCompatible(), NamedType::isCompatible(), PointerType::isCompatible(), FuncType::isCompatible(), BooleanType::isCompatible(), CharType::isCompatible(), FloatType::isCompatible(), IntegerType::isCompatible(), SizeType::isCompatible(), and UserProc::lookupSym().

virtual bool Type::isComplete  )  [inline, virtual]
 

Reimplemented in IntegerType, SizeType, UpperType, and LowerType.

Definition at line 111 of file type.h.

Referenced by LowerType::isComplete(), and UpperType::isComplete().

virtual bool Type::isCompound  )  const [inline, virtual]
 

Reimplemented in CompoundType.

Definition at line 104 of file type.h.

Referenced by compForAddress(), CompoundType::isSubStructOf(), CompoundType::isSuperStructOf(), and CompoundType::operator==().

bool Type::isCString  ) 
 

Definition at line 44 of file type.cpp.

References asArray(), asPointer(), ArrayType::getBaseType(), PointerType::getPointsTo(), resolvesToArray(), resolvesToChar(), and resolvesToPointer().

virtual bool Type::isFloat  )  const [inline, virtual]
 

Reimplemented in FloatType.

Definition at line 100 of file type.h.

Referenced by CallingConvention::StdC::PentiumSignature::addReturn(), CallingConvention::Win32Signature::addReturn(), Binary::genConstraints(), CallingConvention::StdC::PentiumSignature::setLibraryDefines(), and CallingConvention::Win32Signature::setLibraryDefines().

virtual bool Type::isFunc  )  const [inline, virtual]
 

Reimplemented in FuncType.

Definition at line 96 of file type.h.

Referenced by FrontEnd::getEntryPoints().

virtual bool Type::isInteger  )  const [inline, virtual]
 

Reimplemented in IntegerType.

Definition at line 99 of file type.h.

Referenced by Binary::genConstraints(), UserProc::mapExpressionsToLocals(), IntegerType::mergeWith(), and ExpCastInserter::postVisit().

virtual bool Type::isLower  )  const [inline, virtual]
 

Reimplemented in LowerType.

Definition at line 108 of file type.h.

Referenced by LowerType::operator==().

virtual bool Type::isNamed  )  const [inline, virtual]
 

Reimplemented in NamedType.

Definition at line 103 of file type.h.

Referenced by NamedType::isCompatible(), match(), PointerType::pointsToAlpha(), processConstant(), and NamedType::resolvesTo().

virtual bool Type::isPointer  )  const [inline, virtual]
 

Reimplemented in PointerType.

Definition at line 101 of file type.h.

Referenced by CHLLCode::appendTypeIdent(), Binary::genConstraints(), PointerType::getCtype(), PointerType::getFinalPointsTo(), PointerType::match(), PointerType::pointerDepth(), Constraints::solve(), and Constraints::unify().

bool Type::isPointerToAlpha  ) 
 

Definition at line 1106 of file type.cpp.

Referenced by Constraints::alphaSubst(), Binary::simplifyConstraint(), and ConstraintMap::substAlpha().

virtual bool Type::isSize  )  const [inline, virtual]
 

Reimplemented in SizeType.

Definition at line 106 of file type.h.

Referenced by SizeType::operator==().

bool Type::isSubTypeOrEqual Type other  ) 
 

Definition at line 1472 of file dfa.cpp.

References resolvesToCompound(), and resolvesToVoid().

virtual bool Type::isUnion  )  const [inline, virtual]
 

Reimplemented in UnionType.

Definition at line 105 of file type.h.

Referenced by UnionType::addType(), and UnionType::operator==().

virtual bool Type::isUpper  )  const [inline, virtual]
 

Reimplemented in UpperType.

Definition at line 107 of file type.h.

Referenced by UpperType::operator==().

virtual bool Type::isVoid  )  const [inline, virtual]
 

Reimplemented in VoidType.

Definition at line 95 of file type.h.

Referenced by CallingConvention::StdC::SparcSignature::addReturn(), CallingConvention::StdC::ST20Signature::addReturn(), CallingConvention::StdC::PPCSignature::addReturn(), CallingConvention::StdC::PentiumSignature::addReturn(), CallingConvention::Win32Signature::addReturn(), Prog::newProc(), and PointerType::pointsToAlpha().

Exp * Type::match Type pattern  )  [virtual]
 

Reimplemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, and UnionType.

Definition at line 646 of file type.cpp.

References asNamed(), getCtype(), NamedType::getName(), isNamed(), LOG, opEquals, opList, opNil, and opVar.

Referenced by UnionType::match(), CompoundType::match(), NamedType::match(), ArrayType::match(), PointerType::match(), FuncType::match(), VoidType::match(), CharType::match(), BooleanType::match(), FloatType::match(), and IntegerType::match().

virtual Type* Type::meetWith Type other,
bool &  ch,
bool  bHighestPtr = false
[pure virtual]
 

Implemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, UnionType, SizeType, UpperType, and LowerType.

Referenced by createUnion(), Const::descendType(), Assignment::dfaTypeAnalysis(), Assign::dfaTypeAnalysis(), DataIntervalMap::enterComponent(), Global::meetType(), ImpRefStatement::meetWith(), LowerType::meetWith(), UpperType::meetWith(), NamedType::meetWith(), ArrayType::meetWith(), Statement::meetWithFor(), DataIntervalMap::replaceComponents(), and CompoundType::updateGenericMember().

virtual Type* Type::mergeWith Type other  )  [inline, virtual]
 

Reimplemented in IntegerType, SizeType, UpperType, and LowerType.

Definition at line 156 of file type.h.

Type * Type::newIntegerLikeType int  size,
int  signedness
[static]
 

Definition at line 1214 of file type.cpp.

Referenced by Ternary::ascendType(), and Ternary::descendType().

bool Type::operator *= const Type other  )  const [inline]
 

Definition at line 152 of file type.h.

References id.

bool Type::operator!= const Type other  )  const [virtual]
 

Definition at line 10 of file typeStubs.cpp.

virtual bool Type::operator< const Type other  )  const [pure virtual]
 

Implemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, UnionType, SizeType, UpperType, and LowerType.

virtual bool Type::operator== const Type other  )  const [pure virtual]
 

Implemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, UnionType, SizeType, UpperType, and LowerType.

Type * Type::parseType const char *  str  )  [static]
 

Definition at line 412 of file type.cpp.

References NULL.

const char * Type::prints  ) 
 

Definition at line 878 of file type.cpp.

References getCtype().

bool Type::resolvesToArray  ) 
 

Referenced by CHLLCode::appendType(), ArrayType::isCompatible(), FloatType::isCompatible(), SizeType::isCompatible(), isCompatibleWith(), isCString(), UserProc::mapExpressionsToLocals(), and ArrayType::meetWith().

bool Type::resolvesToBoolean  ) 
 

Referenced by BooleanType::isCompatible(), and BooleanType::meetWith().

bool Type::resolvesToChar  ) 
 

Referenced by CharType::isCompatible(), IntegerType::isCompatible(), isCString(), CharType::meetWith(), and Prog::readNativeAs().

bool Type::resolvesToCompound  ) 
 

Referenced by createUnion(), Unary::descendType(), PentiumFrontEnd::extraProcessCall(), Decompiler::getCompoundMembers(), CompoundType::isCompatible(), isCompatibleWith(), isSubTypeOrEqual(), CompoundType::meetWith(), and DataIntervalMap::replaceComponents().

bool Type::resolvesToFloat  ) 
 

Referenced by Const::descendType(), FloatType::isCompatible(), and FloatType::meetWith().

bool Type::resolvesToFunc  ) 
 

Referenced by PentiumFrontEnd::extraProcessCall(), FuncType::isCompatible(), and SizeType::isCompatible().

bool Type::resolvesToInteger  ) 
 

Referenced by checkSignedness(), deltaDifference(), deltaSubtrahend(), CharType::isCompatible(), IntegerType::isCompatible(), CharType::meetWith(), and IntegerType::meetWith().

bool Type::resolvesToLower  ) 
 

Referenced by LowerType::isCompatible().

bool Type::resolvesToPointer  ) 
 

Referenced by CHLLCode::appendType(), Unary::ascendType(), deltaDifference(), deltaMinuend(), deltaSubtrahend(), dereference(), Unary::descendType(), Binary::descendType(), Assignment::dfaTypeAnalysis(), PentiumFrontEnd::extraProcessCall(), PointerType::isCompatible(), isCString(), UserProc::mapExpressionsToLocals(), Prog::readNativeAs(), sigmaAddend(), sigmaSum(), and UsedLocalFinder::visit().

bool Type::resolvesToSize  ) 
 

Referenced by PointerType::isCompatible(), FuncType::isCompatible(), BooleanType::isCompatible(), CharType::isCompatible(), IntegerType::isCompatible(), SizeType::meetWith(), and PointerType::meetWith().

bool Type::resolvesToUnion  ) 
 

Referenced by createUnion(), dereference(), LowerType::isCompatible(), UpperType::isCompatible(), CompoundType::isCompatible(), UnionType::isCompatible(), ArrayType::isCompatible(), PointerType::isCompatible(), FuncType::isCompatible(), BooleanType::isCompatible(), FloatType::isCompatible(), IntegerType::isCompatible(), SizeType::isCompatible(), isCompatibleWith(), and UnionType::meetWith().

bool Type::resolvesToUpper  ) 
 

Referenced by UpperType::isCompatible(), LowerType::meetWith(), and UpperType::meetWith().

bool Type::resolvesToVoid  ) 
 

Referenced by Const::ascendType(), Binary::descendType(), LowerType::isCompatible(), UpperType::isCompatible(), CompoundType::isCompatible(), UnionType::isCompatible(), ArrayType::isCompatible(), NamedType::isCompatible(), PointerType::isCompatible(), FuncType::isCompatible(), BooleanType::isCompatible(), CharType::isCompatible(), FloatType::isCompatible(), IntegerType::isCompatible(), SizeType::isCompatible(), isSubTypeOrEqual(), LowerType::meetWith(), UpperType::meetWith(), SizeType::meetWith(), UnionType::meetWith(), CompoundType::meetWith(), NamedType::meetWith(), ArrayType::meetWith(), PointerType::meetWith(), CharType::meetWith(), BooleanType::meetWith(), FloatType::meetWith(), IntegerType::meetWith(), FuncType::meetWith(), and VoidType::meetWith().

virtual void Type::setSize int  sz  )  [inline, virtual]
 

Reimplemented in IntegerType, FloatType, PointerType, UpperType, and LowerType.

Definition at line 161 of file type.h.

Referenced by BranchStatement::genConstraints(), and SizeType::mergeWith().

void Type::starPrint std::ostream &  os  ) 
 

Definition at line 1110 of file type.cpp.

Referenced by TypedExp::print().


Friends And Related Function Documentation

friend class XMLProgParser [friend]
 

Reimplemented in VoidType, FuncType, IntegerType, FloatType, BooleanType, CharType, PointerType, ArrayType, NamedType, CompoundType, UnionType, and SizeType.

Definition at line 206 of file type.h.


Member Data Documentation

eType Type::id [protected]
 

Definition at line 75 of file type.h.

Referenced by operator *=().

std::map< std::string, Type * > Type::namedTypes [static, private]
 

Definition at line 77 of file type.h.

Referenced by clearNamedTypes(), and dumpNames().


The documentation for this class was generated from the following files:
Generated on Tue Sep 19 21:18:47 2006 for Boomerang by  doxygen 1.4.6