Delete dead code for cloning various types.

R=kbr@chromium.org Review URL: https://codereview.appspot.com/9242043 git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@2234 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 21c6436b
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#include <stdio.h> #include <stdio.h>
#include <algorithm> #include <algorithm>
#include "common/angleutils.h"
TType::TType(const TPublicType &p) : TType::TType(const TPublicType &p) :
type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize), type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize),
maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0) maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0)
...@@ -203,77 +201,3 @@ void TSymbolTableLevel::relateToExtension(const char* name, const TString& ext) ...@@ -203,77 +201,3 @@ void TSymbolTableLevel::relateToExtension(const char* name, const TString& ext)
} }
} }
} }
TSymbol::TSymbol(const TSymbol& copyOf)
{
name = NewPoolTString(copyOf.name->c_str());
uniqueId = copyOf.uniqueId;
}
TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
{
type.copyType(copyOf.type, remapper);
userType = copyOf.userType;
// for builtIn symbol table level, unionArray and arrayInformation pointers should be NULL
assert(copyOf.arrayInformationType == 0);
arrayInformationType = 0;
if (copyOf.unionArray) {
assert(!copyOf.type.getStruct());
assert(copyOf.type.getObjectSize() == 1);
unionArray = new ConstantUnion[1];
unionArray[0] = copyOf.unionArray[0];
} else
unionArray = 0;
}
TVariable* TVariable::clone(TStructureMap& remapper)
{
TVariable *variable = new TVariable(*this, remapper);
return variable;
}
TFunction::TFunction(const TFunction& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
{
for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {
TParameter param;
parameters.push_back(param);
parameters.back().copyParam(copyOf.parameters[i], remapper);
}
returnType.copyType(copyOf.returnType, remapper);
mangledName = copyOf.mangledName;
op = copyOf.op;
defined = copyOf.defined;
}
TFunction* TFunction::clone(TStructureMap& remapper)
{
TFunction *function = new TFunction(*this, remapper);
return function;
}
TSymbolTableLevel* TSymbolTableLevel::clone(TStructureMap& remapper)
{
TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();
tLevel::iterator iter;
for (iter = level.begin(); iter != level.end(); ++iter) {
symTableLevel->insert(*iter->second->clone(remapper));
}
return symTableLevel;
}
void TSymbolTable::copyTable(const TSymbolTable& copyOf)
{
TStructureMap remapper;
uniqueId = copyOf.uniqueId;
for (unsigned int i = 0; i < copyOf.table.size(); ++i) {
table.push_back(copyOf.table[i]->clone(remapper));
}
for( unsigned int i = 0; i < copyOf.precisionStack.size(); i++) {
precisionStack.push_back( copyOf.precisionStack[i] );
}
}
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <assert.h> #include <assert.h>
#include "common/angleutils.h"
#include "compiler/InfoSink.h" #include "compiler/InfoSink.h"
#include "compiler/intermediate.h" #include "compiler/intermediate.h"
...@@ -50,10 +51,10 @@ public: ...@@ -50,10 +51,10 @@ public:
void setUniqueId(int id) { uniqueId = id; } void setUniqueId(int id) { uniqueId = id; }
int getUniqueId() const { return uniqueId; } int getUniqueId() const { return uniqueId; }
virtual void dump(TInfoSink &infoSink) const = 0; virtual void dump(TInfoSink &infoSink) const = 0;
TSymbol(const TSymbol&);
virtual TSymbol* clone(TStructureMap& remapper) = 0;
protected: private:
DISALLOW_COPY_AND_ASSIGN(TSymbol);
const TString *name; const TString *name;
unsigned int uniqueId; // For real comparing during code generation unsigned int uniqueId; // For real comparing during code generation
}; };
...@@ -100,10 +101,10 @@ public: ...@@ -100,10 +101,10 @@ public:
delete[] unionArray; delete[] unionArray;
unionArray = constArray; unionArray = constArray;
} }
TVariable(const TVariable&, TStructureMap& remapper); // copy constructor
virtual TVariable* clone(TStructureMap& remapper);
protected: private:
DISALLOW_COPY_AND_ASSIGN(TVariable);
TType type; TType type;
bool userType; bool userType;
// we are assuming that Pool Allocator will free the memory allocated to unionArray // we are assuming that Pool Allocator will free the memory allocated to unionArray
...@@ -119,11 +120,6 @@ protected: ...@@ -119,11 +120,6 @@ protected:
struct TParameter { struct TParameter {
TString *name; TString *name;
TType* type; TType* type;
void copyParam(const TParameter& param, TStructureMap& remapper)
{
name = NewPoolTString(param.name->c_str());
type = param.type->clone(remapper);
}
}; };
// //
...@@ -173,10 +169,10 @@ public: ...@@ -173,10 +169,10 @@ public:
const TParameter& getParam(size_t i) const { return parameters[i]; } const TParameter& getParam(size_t i) const { return parameters[i]; }
virtual void dump(TInfoSink &infoSink) const; virtual void dump(TInfoSink &infoSink) const;
TFunction(const TFunction&, TStructureMap& remapper);
virtual TFunction* clone(TStructureMap& remapper);
protected: private:
DISALLOW_COPY_AND_ASSIGN(TFunction);
typedef TVector<TParameter> TParamList; typedef TVector<TParameter> TParamList;
TParamList parameters; TParamList parameters;
TType returnType; TType returnType;
...@@ -231,7 +227,6 @@ public: ...@@ -231,7 +227,6 @@ public:
void relateToOperator(const char* name, TOperator op); void relateToOperator(const char* name, TOperator op);
void relateToExtension(const char* name, const TString& ext); void relateToExtension(const char* name, const TString& ext);
void dump(TInfoSink &infoSink) const; void dump(TInfoSink &infoSink) const;
TSymbolTableLevel* clone(TStructureMap& remapper);
protected: protected:
tLevel level; tLevel level;
...@@ -321,7 +316,6 @@ public: ...@@ -321,7 +316,6 @@ public:
} }
int getMaxSymbolId() { return uniqueId; } int getMaxSymbolId() { return uniqueId; }
void dump(TInfoSink &infoSink) const; void dump(TInfoSink &infoSink) const;
void copyTable(const TSymbolTable& copyOf);
bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){ bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){
if (IsSampler(type.type)) if (IsSampler(type.type))
......
...@@ -29,9 +29,6 @@ inline TTypeList* NewPoolTTypeList() ...@@ -29,9 +29,6 @@ inline TTypeList* NewPoolTTypeList()
return new(memory) TTypeList; return new(memory) TTypeList;
} }
typedef TMap<TTypeList*, TTypeList*> TStructureMap;
typedef TMap<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
// //
// Base class for things that have a type. // Base class for things that have a type.
// //
...@@ -53,59 +50,6 @@ public: ...@@ -53,59 +50,6 @@ public:
typeName = NewPoolTString(n.c_str()); typeName = NewPoolTString(n.c_str());
} }
void copyType(const TType& copyOf, TStructureMap& remapper)
{
type = copyOf.type;
precision = copyOf.precision;
qualifier = copyOf.qualifier;
size = copyOf.size;
matrix = copyOf.matrix;
array = copyOf.array;
arraySize = copyOf.arraySize;
TStructureMapIterator iter;
if (copyOf.structure) {
if ((iter = remapper.find(structure)) == remapper.end()) {
// create the new structure here
structure = NewPoolTTypeList();
for (unsigned int i = 0; i < copyOf.structure->size(); ++i) {
TTypeLine typeLine;
typeLine.line = (*copyOf.structure)[i].line;
typeLine.type = (*copyOf.structure)[i].type->clone(remapper);
structure->push_back(typeLine);
}
} else {
structure = iter->second;
}
} else
structure = 0;
fieldName = 0;
if (copyOf.fieldName)
fieldName = NewPoolTString(copyOf.fieldName->c_str());
typeName = 0;
if (copyOf.typeName)
typeName = NewPoolTString(copyOf.typeName->c_str());
mangled = 0;
if (copyOf.mangled)
mangled = NewPoolTString(copyOf.mangled->c_str());
structureSize = copyOf.structureSize;
maxArraySize = copyOf.maxArraySize;
deepestStructNesting = copyOf.deepestStructNesting;
assert(copyOf.arrayInformationType == 0);
arrayInformationType = 0; // arrayInformationType should not be set for builtIn symbol table level
}
TType* clone(TStructureMap& remapper)
{
TType *newType = new TType();
newType->copyType(*this, remapper);
return newType;
}
TBasicType getBasicType() const { return type; } TBasicType getBasicType() const { return type; }
void setBasicType(TBasicType t) { type = t; } void setBasicType(TBasicType t) { type = t; }
...@@ -271,7 +215,7 @@ public: ...@@ -271,7 +215,7 @@ public:
bool isStructureContainingArrays() const; bool isStructureContainingArrays() const;
protected: private:
void buildMangledName(TString&); void buildMangledName(TString&);
int getStructSize() const; int getStructSize() const;
void computeDeepestStructNesting(); void computeDeepestStructNesting();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment