summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-10-18 00:02:06 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-10-18 00:02:06 +0000
commit505130cb303660022fa7a6ec6e179e4902afce09 (patch)
tree0404bf3a689166eee607fba3a2bd473bdd4a1de6
parent4cc2b3b155216a985ca95c2f50fd85ddff8cf226 (diff)
downloadbcm5719-llvm-505130cb303660022fa7a6ec6e179e4902afce09.tar.gz
bcm5719-llvm-505130cb303660022fa7a6ec6e179e4902afce09.zip
Added virtual function to generate an instruction sequence to
load a constant into a register. llvm-svn: 862
-rw-r--r--llvm/include/llvm/Target/MachineInstrInfo.h20
-rw-r--r--llvm/include/llvm/Target/TargetInstrInfo.h20
-rw-r--r--llvm/lib/Target/Sparc/SparcInternals.h17
3 files changed, 53 insertions, 4 deletions
diff --git a/llvm/include/llvm/Target/MachineInstrInfo.h b/llvm/include/llvm/Target/MachineInstrInfo.h
index 5106a260d99..d0294caf468 100644
--- a/llvm/include/llvm/Target/MachineInstrInfo.h
+++ b/llvm/include/llvm/Target/MachineInstrInfo.h
@@ -9,8 +9,13 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/DataTypes.h"
+#include <vector>
class MachineInstrDescriptor;
+class TmpInstruction;
+class MachineInstr;
+class Value;
+class Instruction;
typedef int InstrSchedClass;
@@ -211,6 +216,21 @@ public:
isSignExtended = getDescriptor(opCode).immedIsSignExtended;
return getDescriptor(opCode).maxImmedConst;
}
+
+ //-------------------------------------------------------------------------
+ // Code generation support for creating individual machine instructions
+ //-------------------------------------------------------------------------
+
+ // Create an instruction sequence to put the constant `val' into
+ // the virtual register `dest'. `val' may be a ConstPoolVal or a
+ // GlobalValue, viz., the constant address of a global variable or function.
+ // The generated instructions are returned in `minstrVec'.
+ // Any temp. registers (TmpInstruction) created are returned in `tempVec'.
+ //
+ virtual void CreateCodeToLoadConst(Value* val,
+ Instruction* dest,
+ vector<MachineInstr*>& minstrVec,
+ vector<TmpInstruction*>& temps) const =0;
};
#endif
diff --git a/llvm/include/llvm/Target/TargetInstrInfo.h b/llvm/include/llvm/Target/TargetInstrInfo.h
index 5106a260d99..d0294caf468 100644
--- a/llvm/include/llvm/Target/TargetInstrInfo.h
+++ b/llvm/include/llvm/Target/TargetInstrInfo.h
@@ -9,8 +9,13 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/DataTypes.h"
+#include <vector>
class MachineInstrDescriptor;
+class TmpInstruction;
+class MachineInstr;
+class Value;
+class Instruction;
typedef int InstrSchedClass;
@@ -211,6 +216,21 @@ public:
isSignExtended = getDescriptor(opCode).immedIsSignExtended;
return getDescriptor(opCode).maxImmedConst;
}
+
+ //-------------------------------------------------------------------------
+ // Code generation support for creating individual machine instructions
+ //-------------------------------------------------------------------------
+
+ // Create an instruction sequence to put the constant `val' into
+ // the virtual register `dest'. `val' may be a ConstPoolVal or a
+ // GlobalValue, viz., the constant address of a global variable or function.
+ // The generated instructions are returned in `minstrVec'.
+ // Any temp. registers (TmpInstruction) created are returned in `tempVec'.
+ //
+ virtual void CreateCodeToLoadConst(Value* val,
+ Instruction* dest,
+ vector<MachineInstr*>& minstrVec,
+ vector<TmpInstruction*>& temps) const =0;
};
#endif
diff --git a/llvm/lib/Target/Sparc/SparcInternals.h b/llvm/lib/Target/Sparc/SparcInternals.h
index 0d8d6729812..6828a68e667 100644
--- a/llvm/lib/Target/Sparc/SparcInternals.h
+++ b/llvm/lib/Target/Sparc/SparcInternals.h
@@ -85,7 +85,7 @@ class UltraSparcInstrInfo : public MachineInstrInfo {
public:
/*ctor*/ UltraSparcInstrInfo();
- virtual bool hasResultInterlock (MachineOpCode opCode)
+ virtual bool hasResultInterlock (MachineOpCode opCode) const
{
// All UltraSPARC instructions have interlocks (note that delay slots
// are not considered here).
@@ -96,10 +96,19 @@ public:
return (opCode == FCMPS || opCode == FCMPD || opCode == FCMPQ);
}
-
-
-
+ //-------------------------------------------------------------------------
+ // Code generation support for creating individual machine instructions
+ //-------------------------------------------------------------------------
+ // Create an instruction sequence to put the constant `val' into
+ // the virtual register `dest'. The generated instructions are
+ // returned in `minstrVec'. Any temporary registers (TmpInstruction)
+ // created are returned in `tempVec'.
+ //
+ virtual void CreateCodeToLoadConst(Value* val,
+ Instruction* dest,
+ vector<MachineInstr*>& minstrVec,
+ vector<TmpInstruction*>& tempVec) const;
};
OpenPOWER on IntegriCloud