Eliminate the explicit opcode field in ConstantExpr, using the SubclassData

field to hold it instead.  This shrinks memory usage for 176.gcc from
57628728 to 57598144 bytes, a small reduction of about 30K.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20047 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-02-05 02:00:12 +00:00
parent 88fe29a1da
commit eecfea4da6

View File

@ -510,26 +510,22 @@ public:
/// ConstantExpr - a constant value that is initialized with an expression using
/// other constant values. This is only used to represent values that cannot be
/// evaluated at compile-time (e.g., something derived from an address) because
/// it does not have a mechanism to store the actual value. Use the appropriate
/// Constant subclass above for known constants.
/// other constant values.
///
/// This class uses the standard Instruction opcodes to define the various
/// constant expressions. The Opcode field for the ConstantExpr class is
/// maintained in the Value::SubclassData field.
class ConstantExpr : public Constant {
unsigned iType; // Operation type (an Instruction opcode)
friend struct ConstantCreator<ConstantExpr,Type,
std::pair<unsigned, std::vector<Constant*> > >;
friend struct ConvertConstantType<ConstantExpr, Type>;
protected:
ConstantExpr(const Type *Ty, unsigned Opcode, Use *Ops, unsigned NumOps)
: Constant(Ty, ConstantExprVal, Ops, NumOps), iType(Opcode) {}
// Select instruction creation ctor
ConstantExpr(Constant *C, Constant *V1, Constant *V2);
// GEP instruction creation ctor
ConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
const Type *DestTy);
: Constant(Ty, ConstantExprVal, Ops, NumOps) {
// Operation type (an Instruction opcode) is stored as the SubclassData.
SubclassData = Opcode;
}
// These private methods are used by the type resolution code to create
// ConstantExprs in intermediate forms.
@ -609,7 +605,7 @@ public:
virtual bool isNullValue() const { return false; }
/// getOpcode - Return the opcode at the root of this constant expression
unsigned getOpcode() const { return iType; }
unsigned getOpcode() const { return SubclassData; }
/// getOpcodeName - Return a string representation for an opcode.
const char *getOpcodeName() const;