Commit 6ba6eadc by Jamie Madill

Rename ConstantUnion to TConstantUnion.

This clarified that we're using the Pool allocator/deallocator for this type. BUG=angleproject:993 Change-Id: If8c95f6054d07291e7014be0d4e35766ba2e943b Reviewed-on: https://chromium-review.googlesource.com/269131Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org>
parent c07c43e4
......@@ -9,16 +9,18 @@
#include <assert.h>
class ConstantUnion {
#include "compiler/translator/BaseTypes.h"
class TConstantUnion {
public:
POOL_ALLOCATOR_NEW_DELETE();
ConstantUnion()
TConstantUnion()
{
iConst = 0;
type = EbtVoid;
}
bool cast(TBasicType newType, const ConstantUnion &constant)
bool cast(TBasicType newType, const TConstantUnion &constant)
{
switch (newType)
{
......@@ -109,7 +111,7 @@ public:
return b == bConst;
}
bool operator==(const ConstantUnion& constant) const
bool operator==(const TConstantUnion& constant) const
{
if (constant.type != type)
return false;
......@@ -148,12 +150,12 @@ public:
return !operator==(b);
}
bool operator!=(const ConstantUnion& constant) const
bool operator!=(const TConstantUnion& constant) const
{
return !operator==(constant);
}
bool operator>(const ConstantUnion& constant) const
bool operator>(const TConstantUnion& constant) const
{
assert(type == constant.type);
switch (type) {
......@@ -168,7 +170,7 @@ public:
}
}
bool operator<(const ConstantUnion& constant) const
bool operator<(const TConstantUnion& constant) const
{
assert(type == constant.type);
switch (type) {
......@@ -183,9 +185,9 @@ public:
}
}
ConstantUnion operator+(const ConstantUnion& constant) const
TConstantUnion operator+(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
......@@ -197,9 +199,9 @@ public:
return returnValue;
}
ConstantUnion operator-(const ConstantUnion& constant) const
TConstantUnion operator-(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
......@@ -211,9 +213,9 @@ public:
return returnValue;
}
ConstantUnion operator*(const ConstantUnion& constant) const
TConstantUnion operator*(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
......@@ -225,9 +227,9 @@ public:
return returnValue;
}
ConstantUnion operator%(const ConstantUnion& constant) const
TConstantUnion operator%(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
......@@ -238,9 +240,9 @@ public:
return returnValue;
}
ConstantUnion operator>>(const ConstantUnion& constant) const
TConstantUnion operator>>(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
......@@ -251,9 +253,9 @@ public:
return returnValue;
}
ConstantUnion operator<<(const ConstantUnion& constant) const
TConstantUnion operator<<(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
// The signedness of the second parameter might be different, but we
// don't care, since the result is undefined if the second parameter is
// negative, and aliasing should not be a problem with unions.
......@@ -267,9 +269,9 @@ public:
return returnValue;
}
ConstantUnion operator&(const ConstantUnion& constant) const
TConstantUnion operator&(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(constant.type == EbtInt || constant.type == EbtUInt);
switch (type) {
case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
......@@ -280,9 +282,9 @@ public:
return returnValue;
}
ConstantUnion operator|(const ConstantUnion& constant) const
TConstantUnion operator|(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
......@@ -293,9 +295,9 @@ public:
return returnValue;
}
ConstantUnion operator^(const ConstantUnion& constant) const
TConstantUnion operator^(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
......@@ -306,9 +308,9 @@ public:
return returnValue;
}
ConstantUnion operator&&(const ConstantUnion& constant) const
TConstantUnion operator&&(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtBool: returnValue.setBConst(bConst && constant.bConst); break;
......@@ -318,9 +320,9 @@ public:
return returnValue;
}
ConstantUnion operator||(const ConstantUnion& constant) const
TConstantUnion operator||(const TConstantUnion& constant) const
{
ConstantUnion returnValue;
TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtBool: returnValue.setBConst(bConst || constant.bConst); break;
......
......@@ -17,7 +17,7 @@ TIntermConstantUnion *constructFloatConstUnionNode(const TType &type)
unsigned char size = static_cast<unsigned char>(myType.getNominalSize());
if (myType.isMatrix())
size *= size;
ConstantUnion *u = new ConstantUnion[size];
TConstantUnion *u = new TConstantUnion[size];
for (int ii = 0; ii < size; ++ii)
u[ii].setFConst(0.0f);
......@@ -29,7 +29,7 @@ TIntermConstantUnion *constructFloatConstUnionNode(const TType &type)
TIntermConstantUnion *constructIndexNode(int index)
{
ConstantUnion *u = new ConstantUnion[1];
TConstantUnion *u = new TConstantUnion[1];
u[0].setIConst(index);
TType type(EbtInt, EbpUndefined, EvqConst, 1);
......
......@@ -23,9 +23,9 @@
#include "common/angleutils.h"
#include "compiler/translator/Common.h"
#include "compiler/translator/Types.h"
#include "compiler/translator/ConstantUnion.h"
#include "compiler/translator/Operator.h"
#include "compiler/translator/Types.h"
class TIntermTraverser;
class TIntermAggregate;
......@@ -264,13 +264,13 @@ class TIntermRaw : public TIntermTyped
class TIntermConstantUnion : public TIntermTyped
{
public:
TIntermConstantUnion(ConstantUnion *unionPointer, const TType &type)
TIntermConstantUnion(TConstantUnion *unionPointer, const TType &type)
: TIntermTyped(type),
mUnionArrayPointer(unionPointer) { }
virtual bool hasSideEffects() const { return false; }
ConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
TConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
int getIConst(size_t index) const
{
......@@ -296,11 +296,11 @@ class TIntermConstantUnion : public TIntermTyped
TIntermTyped *fold(TOperator op, TIntermConstantUnion *rightNode, TInfoSink &infoSink);
protected:
ConstantUnion *mUnionArrayPointer;
TConstantUnion *mUnionArrayPointer;
private:
typedef float(*FloatTypeUnaryFunc) (float);
bool foldFloatTypeUnary(const ConstantUnion &parameter, FloatTypeUnaryFunc builtinFunc, TInfoSink &infoSink, ConstantUnion *result) const;
bool foldFloatTypeUnary(const TConstantUnion &parameter, FloatTypeUnaryFunc builtinFunc, TInfoSink &infoSink, TConstantUnion *result) const;
};
//
......
......@@ -361,7 +361,7 @@ TIntermCase *TIntermediate::addCase(
//
TIntermConstantUnion *TIntermediate::addConstantUnion(
ConstantUnion *unionArrayPointer, const TType &t, const TSourceLoc &line)
TConstantUnion *unionArrayPointer, const TType &t, const TSourceLoc &line)
{
TIntermConstantUnion *node = new TIntermConstantUnion(unionArrayPointer, t);
node->setLine(line);
......@@ -378,11 +378,11 @@ TIntermTyped *TIntermediate::addSwizzle(
node->setLine(line);
TIntermConstantUnion *constIntNode;
TIntermSequence *sequenceVector = node->getSequence();
ConstantUnion *unionArray;
TConstantUnion *unionArray;
for (int i = 0; i < fields.num; i++)
{
unionArray = new ConstantUnion[1];
unionArray = new TConstantUnion[1];
unionArray->setIConst(fields.offsets[i]);
constIntNode = addConstantUnion(
unionArray, TType(EbtInt, EbpUndefined, EvqConst), line);
......
......@@ -49,9 +49,9 @@ class TIntermediate
TIntermTyped *condition, const TSourceLoc &line);
TIntermTyped *addComma(
TIntermTyped *left, TIntermTyped *right, const TSourceLoc &);
TIntermConstantUnion *addConstantUnion(ConstantUnion *, const TType &, const TSourceLoc &);
TIntermConstantUnion *addConstantUnion(TConstantUnion *, const TType &, const TSourceLoc &);
// TODO(zmo): Get rid of default value.
bool parseConstTree(const TSourceLoc &, TIntermNode *, ConstantUnion *,
bool parseConstTree(const TSourceLoc &, TIntermNode *, TConstantUnion *,
TOperator, TType, bool singleConstantParam = false);
TIntermNode *addLoop(TLoopType, TIntermNode *, TIntermTyped *, TIntermTyped *,
TIntermNode *, const TSourceLoc &);
......
......@@ -168,8 +168,8 @@ void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence &args)
}
}
const ConstantUnion *TOutputGLSLBase::writeConstantUnion(
const TType &type, const ConstantUnion *pConstUnion)
const TConstantUnion *TOutputGLSLBase::writeConstantUnion(
const TType &type, const TConstantUnion *pConstUnion)
{
TInfoSinkBase &out = objSink();
......@@ -386,7 +386,7 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary *node)
TIntermConstantUnion *element = (*sit)->getAsConstantUnion();
ASSERT(element->getBasicType() == EbtInt);
ASSERT(element->getNominalSize() == 1);
const ConstantUnion& data = element->getUnionArrayPointer()[0];
const TConstantUnion& data = element->getUnionArrayPointer()[0];
ASSERT(data.getType() == EbtInt);
switch (data.getIConst())
{
......
......@@ -35,7 +35,7 @@ class TOutputGLSLBase : public TIntermTraverser
void writeVariableType(const TType &type);
virtual bool writeVariablePrecision(TPrecision precision) = 0;
void writeFunctionParameters(const TIntermSequence &args);
const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *pConstUnion);
const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *pConstUnion);
void writeConstructorTriplet(Visit visit, const TType &type, const char *constructorBaseType);
TString getTypeName(const TType &type);
......
......@@ -2895,7 +2895,7 @@ void OutputHLSL::outputConstructor(Visit visit, const TType &type, const char *n
}
}
const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const ConstantUnion *constUnion)
const TConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const TConstantUnion *constUnion)
{
TInfoSinkBase &out = getInfoSink();
......
......@@ -76,7 +76,7 @@ class OutputHLSL : public TIntermTraverser
// Emit constructor. Called with literal names so using const char* instead of TString.
void outputConstructor(Visit visit, const TType &type, const char *name, const TIntermSequence *parameters);
const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *constUnion);
const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *constUnion);
void outputEqual(Visit visit, const TType &type, TOperator op, TInfoSinkBase &out);
......
......@@ -1133,7 +1133,7 @@ bool TParseContext::executeInitializer(const TSourceLoc &line, const TString &id
const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), 0);
const TVariable* tVar = static_cast<const TVariable*>(symbol);
ConstantUnion* constArray = tVar->getConstPointer();
TConstantUnion* constArray = tVar->getConstPointer();
variable->shareConstPointer(constArray);
} else {
std::stringstream extraInfoStream;
......@@ -1786,7 +1786,7 @@ TIntermTyped* TParseContext::foldConstConstructor(TIntermAggregate* aggrNode, co
aggrNode->setType(type);
if (canBeFolded) {
bool returnVal = false;
ConstantUnion* unionArray = new ConstantUnion[type.getObjectSize()];
TConstantUnion* unionArray = new TConstantUnion[type.getObjectSize()];
if (aggrNode->getSequence()->size() == 1) {
returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), type, true);
}
......@@ -1814,7 +1814,7 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
ConstantUnion *unionArray;
TConstantUnion *unionArray;
if (tempConstantNode) {
unionArray = tempConstantNode->getUnionArrayPointer();
......@@ -1828,7 +1828,7 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
return 0;
}
ConstantUnion* constArray = new ConstantUnion[fields.num];
TConstantUnion* constArray = new TConstantUnion[fields.num];
for (int i = 0; i < fields.num; i++) {
if (fields.offsets[i] >= node->getType().getNominalSize()) {
......@@ -1868,7 +1868,7 @@ TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, c
}
if (tempConstantNode) {
ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
TConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
int size = tempConstantNode->getType().getCols();
typedNode = intermediate.addConstantUnion(&unionArray[size*index], tempConstantNode->getType(), line);
} else {
......@@ -1906,7 +1906,7 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, co
if (tempConstantNode) {
size_t arrayElementSize = arrayElementType.getObjectSize();
ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
TConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
} else {
error(line, "Cannot offset into the array", "Error");
......@@ -1940,7 +1940,7 @@ TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTy
TIntermTyped *typedNode;
TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
if (tempConstantNode) {
ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
TConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
typedNode = intermediate.addConstantUnion(constArray+instanceSize, tempConstantNode->getType(), line); // type will be changed in the calling function
} else {
......@@ -2252,7 +2252,7 @@ TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, co
if (indexedExpression == 0)
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setFConst(0.0f);
indexedExpression = intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), location);
}
......@@ -2356,7 +2356,7 @@ TIntermTyped* TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpre
{
error(dotLocation, " non-scalar fields not implemented yet", ".");
recover();
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst(0);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
......@@ -2365,7 +2365,7 @@ TIntermTyped* TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpre
}
else
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst(fields.col * baseExpression->getRows() + fields.row);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
......@@ -2413,7 +2413,7 @@ TIntermTyped* TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpre
}
else
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst(i);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirectStruct, baseExpression, index, dotLocation);
......@@ -2451,7 +2451,7 @@ TIntermTyped* TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpre
}
if (fieldFound)
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst(i);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirectInterfaceBlock, baseExpression, index, dotLocation);
......@@ -3054,7 +3054,7 @@ TIntermTyped *TParseContext::addBinaryMathBooleanResult(TOperator op, TIntermTyp
{
binaryOpError(loc, GetOperatorString(op), left->getCompleteString(), right->getCompleteString());
recover();
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setBConst(false);
return intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), loc);
}
......@@ -3142,7 +3142,7 @@ TIntermTyped *TParseContext::addFunctionCallOrMethod(TFunction *fnCall, TIntermN
if (thisNode != nullptr)
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
int arraySize = 0;
TIntermTyped *typedThis = thisNode->getAsTyped();
if (fnCall->getName() != "length")
......@@ -3282,7 +3282,7 @@ TIntermTyped *TParseContext::addFunctionCallOrMethod(TFunction *fnCall, TIntermN
{
// error message was put out by findFunction()
// Put on a dummy node for error recovery
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setFConst(0.0f);
callNode = intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), loc);
recover();
......
......@@ -39,7 +39,7 @@ bool ContainsVectorNode(const TIntermSequence &sequence)
TIntermConstantUnion *ConstructIndexNode(int index)
{
ConstantUnion *u = new ConstantUnion[1];
TConstantUnion *u = new TConstantUnion[1];
u[0].setIConst(index);
TType type(EbtInt, EbpUndefined, EvqConst, 1);
......
......@@ -133,20 +133,20 @@ class TVariable : public TSymbol
type.setQualifier(qualifier);
}
ConstantUnion *getConstPointer()
TConstantUnion *getConstPointer()
{
if (!unionArray)
unionArray = new ConstantUnion[type.getObjectSize()];
unionArray = new TConstantUnion[type.getObjectSize()];
return unionArray;
}
ConstantUnion *getConstPointer() const
TConstantUnion *getConstPointer() const
{
return unionArray;
}
void shareConstPointer(ConstantUnion *constArray)
void shareConstPointer(TConstantUnion *constArray)
{
if (unionArray == constArray)
return;
......@@ -160,7 +160,7 @@ class TVariable : public TSymbol
bool userType;
// we are assuming that Pool Allocator will free the memory
// allocated to unionArray when this object is destroyed.
ConstantUnion *unionArray;
TConstantUnion *unionArray;
};
// The function sub-class of symbols and the parser will need to
......
......@@ -13,7 +13,7 @@ namespace
TIntermSelection *UnfoldOR(TIntermTyped *x, TIntermTyped *y)
{
const TType boolType(EbtBool, EbpUndefined);
ConstantUnion *u = new ConstantUnion;
TConstantUnion *u = new TConstantUnion;
u->setBConst(true);
TIntermConstantUnion *trueNode = new TIntermConstantUnion(
u, TType(EbtBool, EbpUndefined, EvqConst, 1));
......@@ -24,7 +24,7 @@ TIntermSelection *UnfoldOR(TIntermTyped *x, TIntermTyped *y)
TIntermSelection *UnfoldAND(TIntermTyped *x, TIntermTyped *y)
{
const TType boolType(EbtBool, EbpUndefined);
ConstantUnion *u = new ConstantUnion;
TConstantUnion *u = new TConstantUnion;
u->setBConst(false);
TIntermConstantUnion *falseNode = new TIntermConstantUnion(
u, TType(EbtBool, EbpUndefined, EvqConst, 1));
......
......@@ -218,7 +218,7 @@ variable_identifier
if (variable->getType().getQualifier() == EvqConst)
{
ConstantUnion* constArray = variable->getConstPointer();
TConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
$$ = context->intermediate.addConstantUnion(constArray, t, @1);
}
......@@ -240,22 +240,22 @@ primary_expression
$$ = $1;
}
| INTCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst($1.i);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @1);
}
| UINTCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setUConst($1.u);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), @1);
}
| FLOATCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setFConst($1.f);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), @1);
}
| BOOLCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setBConst($1.b);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @1);
}
......
......@@ -2361,7 +2361,7 @@ yyreduce:
if (variable->getType().getQualifier() == EvqConst)
{
ConstantUnion* constArray = variable->getConstPointer();
TConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yylsp[0]));
}
......@@ -2390,7 +2390,7 @@ yyreduce:
case 6:
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst((yyvsp[0].lex).i);
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[0]));
}
......@@ -2400,7 +2400,7 @@ yyreduce:
case 7:
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setUConst((yyvsp[0].lex).u);
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yylsp[0]));
}
......@@ -2410,7 +2410,7 @@ yyreduce:
case 8:
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setFConst((yyvsp[0].lex).f);
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[0]));
}
......@@ -2420,7 +2420,7 @@ yyreduce:
case 9:
{
ConstantUnion *unionArray = new ConstantUnion[1];
TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setBConst((yyvsp[0].lex).b);
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[0]));
}
......
......@@ -265,7 +265,7 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node)
OutputTreeText(out, intermConstantUnion, mDepth + 1);
// The following code finds the field name from the constant union
const ConstantUnion *constantUnion = intermConstantUnion->getUnionArrayPointer();
const TConstantUnion *constantUnion = intermConstantUnion->getUnionArrayPointer();
const TStructure *structure = node->getLeft()->getType().getStruct();
const TInterfaceBlock *interfaceBlock = node->getLeft()->getType().getInterfaceBlock();
ASSERT(structure || interfaceBlock);
......
......@@ -13,7 +13,7 @@
class TConstTraverser : public TIntermTraverser
{
public:
TConstTraverser(ConstantUnion *cUnion, bool singleConstParam,
TConstTraverser(TConstantUnion *cUnion, bool singleConstParam,
TOperator constructType, TInfoSink &sink, TType &t)
: error(false),
mIndex(0),
......@@ -42,7 +42,7 @@ class TConstTraverser : public TIntermTraverser
bool visitBranch(Visit visit, TIntermBranch *);
size_t mIndex;
ConstantUnion *mUnionArray;
TConstantUnion *mUnionArray;
TType mType;
TOperator mConstructorType;
bool mSingleConstantParam;
......@@ -167,7 +167,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion *node)
return;
}
ConstantUnion *leftUnionArray = mUnionArray;
TConstantUnion *leftUnionArray = mUnionArray;
size_t instanceSize = mType.getObjectSize();
TBasicType basicType = mType.getBasicType();
......@@ -177,7 +177,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion *node)
if (!mSingleConstantParam)
{
size_t objectSize = node->getType().getObjectSize();
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
TConstantUnion *rightUnionArray = node->getUnionArrayPointer();
for (size_t i=0; i < objectSize; i++)
{
if (mIndex >= instanceSize)
......@@ -189,7 +189,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion *node)
else
{
size_t totalSize = mIndex + mSize;
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
TConstantUnion *rightUnionArray = node->getUnionArrayPointer();
if (!mIsDiagonalMatrixInit)
{
int count = 0;
......@@ -247,7 +247,7 @@ bool TConstTraverser::visitBranch(Visit visit, TIntermBranch *node)
// type of node. It's children will still be processed.
//
bool TIntermediate::parseConstTree(
const TSourceLoc &line, TIntermNode *root, ConstantUnion *unionArray,
const TSourceLoc &line, TIntermNode *root, TConstantUnion *unionArray,
TOperator constructorType, TType t, bool singleConstantParam)
{
if (root == 0)
......
......@@ -16,7 +16,7 @@
class ConstantFinder : public TIntermTraverser
{
public:
ConstantFinder(ConstantUnion constToFind)
ConstantFinder(TConstantUnion constToFind)
: mConstToFind(constToFind),
mFound(false)
{}
......@@ -32,7 +32,7 @@ class ConstantFinder : public TIntermTraverser
bool found() const { return mFound; }
private:
ConstantUnion mConstToFind;
TConstantUnion mConstToFind;
bool mFound;
};
......@@ -72,7 +72,7 @@ class ConstantFoldingTest : public testing::Test
}
}
bool constantFoundInAST(ConstantUnion c)
bool constantFoundInAST(TConstantUnion c)
{
ConstantFinder finder(c);
mASTRoot->traverse(&finder);
......@@ -81,7 +81,7 @@ class ConstantFoldingTest : public testing::Test
bool constantFoundInAST(int i)
{
ConstantUnion c;
TConstantUnion c;
c.setIConst(i);
return constantFoundInAST(c);
}
......
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