[llvm-commits] CVS: llvm/include/llvm/Constants.h
Chris Lattner
lattner at cs.uiuc.edu
Fri Feb 4 18:00:27 PST 2005
Changes in directory llvm/include/llvm:
Constants.h updated: 1.67 -> 1.68
---
Log message:
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.
---
Diffs of the changes: (+9 -13)
Constants.h | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.67 llvm/include/llvm/Constants.h:1.68
--- llvm/include/llvm/Constants.h:1.67 Fri Jan 28 18:32:29 2005
+++ llvm/include/llvm/Constants.h Fri Feb 4 20:00:12 2005
@@ -510,26 +510,22 @@
/// 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 @@
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;
More information about the llvm-commits
mailing list