summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc/SparcInternals.h
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-11-14 18:48:36 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-11-14 18:48:36 +0000
commit7e833073e325894c94681086b779623d194a8ce9 (patch)
tree14110d3aca955d673081ce4259de174ed87112b0 /llvm/lib/Target/Sparc/SparcInternals.h
parent65d54eb06e9b2aa4dfd7733bdb3ec96e384818ea (diff)
downloadbcm5719-llvm-7e833073e325894c94681086b779623d194a8ce9.tar.gz
bcm5719-llvm-7e833073e325894c94681086b779623d194a8ce9.zip
Add function returning which operand holds immediate constant
for a given opcode. llvm-svn: 1307
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcInternals.h')
-rw-r--r--llvm/lib/Target/Sparc/SparcInternals.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Target/Sparc/SparcInternals.h b/llvm/lib/Target/Sparc/SparcInternals.h
index 53a4beb6cec..c24b9bd3841 100644
--- a/llvm/lib/Target/Sparc/SparcInternals.h
+++ b/llvm/lib/Target/Sparc/SparcInternals.h
@@ -89,6 +89,22 @@ extern const MachineInstrDescriptor SparcMachineInstrDesc[];
class UltraSparcInstrInfo : public MachineInstrInfo {
public:
/*ctor*/ UltraSparcInstrInfo(const TargetMachine& tgt);
+
+ //
+ // All immediate constants are in position 0 except the
+ // store instructions.
+ //
+ virtual int getImmmedConstantPos(MachineOpCode opCode) const {
+ bool ignore;
+ if (this->maxImmedConstant(opCode, ignore) != 0)
+ {
+ assert(! this->isStore((MachineOpCode) STB - 1)); // first store is STB
+ assert(! this->isStore((MachineOpCode) STD + 1)); // last store is STD
+ return (opCode >= STB || opCode <= STD)? 2 : 1;
+ }
+ else
+ return -1;
+ }
virtual bool hasResultInterlock (MachineOpCode opCode) const
{
OpenPOWER on IntegriCloud