[llvm-commits] CVS: llvm/include/llvm/Target/MachineInstrInfo.h
vadve at cs.uiuc.edu
vadve at cs.uiuc.edu
Mon Sep 16 10:57:11 PDT 2002
Changes in directory llvm/include/llvm/Target:
MachineInstrInfo.h updated: 1.19 -> 1.20
---
Log message:
Add methods to query about the representation of LLVM quantities (e.g.,
constants). Useful for target-dependent LLVM transformations like
Preselection.
---
Diffs of the changes:
Index: llvm/include/llvm/Target/MachineInstrInfo.h
diff -u llvm/include/llvm/Target/MachineInstrInfo.h:1.19 llvm/include/llvm/Target/MachineInstrInfo.h:1.20
--- llvm/include/llvm/Target/MachineInstrInfo.h:1.19 Thu Sep 5 13:36:41 2002
+++ llvm/include/llvm/Target/MachineInstrInfo.h Mon Sep 16 10:56:01 2002
@@ -9,6 +9,8 @@
#include "Support/NonCopyable.h"
#include "Support/DataTypes.h"
+#include "llvm/Constant.h"
+#include "llvm/DerivedTypes.h"
#include <string>
#include <vector>
@@ -237,6 +239,27 @@
bool &isSignExtended) const {
isSignExtended = getDescriptor(opCode).immedIsSignExtended;
return getDescriptor(opCode).maxImmedConst;
+ }
+
+ //-------------------------------------------------------------------------
+ // Queries about representation of LLVM quantities (e.g., constants)
+ //-------------------------------------------------------------------------
+
+ // Test if this type of constant must be loaded from memory into
+ // a register, i.e., cannot be set bitwise in register and cannot
+ // use immediate fields of instructions. Note that this only makes
+ // sense for primitive types.
+ virtual bool ConstantTypeMustBeLoaded(const Constant* CV) const {
+ assert(CV->getType()->isPrimitiveType() || isa<PointerType>(CV->getType()));
+ return !(CV->getType()->isIntegral() || isa<PointerType>(CV->getType()));
+ }
+
+ // Test if this constant may not fit in the immediate field of the
+ // machine instructions (probably) generated for this instruction.
+ //
+ virtual bool ConstantMayNotFitInImmedField(const Constant* CV,
+ const Instruction* I) const {
+ return true; // safe but very conservative
}
//-------------------------------------------------------------------------
More information about the llvm-commits
mailing list