summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Dardis <simon.dardis@imgtec.com>2017-10-11 11:11:35 +0000
committerSimon Dardis <simon.dardis@imgtec.com>2017-10-11 11:11:35 +0000
commit2b88f1857e8a07eda46801341c14cc5be01d096f (patch)
tree97b237e3d437a1b043983ecd7296894ccf80cc27
parent7c1fbc09c9d78a045feec88f475ceea4bb791e64 (diff)
downloadllvm-2b88f1857e8a07eda46801341c14cc5be01d096f.tar.gz
[mips] Add support for parsing target specific flags for MIR
Reviewers: atanasyan Differential Revision: https://reviews.llvm.org/D38620 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315451 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/Mips/MipsInstrInfo.cpp36
-rw-r--r--lib/Target/Mips/MipsInstrInfo.h6
2 files changed, 42 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsInstrInfo.cpp b/lib/Target/Mips/MipsInstrInfo.cpp
index 82dc442a53d9..a872fff65e46 100644
--- a/lib/Target/Mips/MipsInstrInfo.cpp
+++ b/lib/Target/Mips/MipsInstrInfo.cpp
@@ -618,3 +618,39 @@ bool MipsInstrInfo::verifyInstruction(const MachineInstr &MI,
return true;
}
+std::pair<unsigned, unsigned>
+MipsInstrInfo::decomposeMachineOperandsTargetFlags(unsigned TF) const {
+ return std::make_pair(TF, 0u);
+}
+
+ArrayRef<std::pair<unsigned, const char*>>
+MipsInstrInfo::getSerializableDirectMachineOperandTargetFlags() const {
+ using namespace MipsII;
+
+ static const std::pair<unsigned, const char*> Flags[] = {
+ {MO_GOT, "mips-got"},
+ {MO_GOT_CALL, "mips-got-call"},
+ {MO_GPREL, "mips-gprel"},
+ {MO_ABS_HI, "mips-abs-hi"},
+ {MO_ABS_LO, "mips-abs-lo"},
+ {MO_TLSGD, "mips-tlsgd"},
+ {MO_TLSLDM, "mips-tlsldm"},
+ {MO_DTPREL_HI, "mips-dtprel-hi"},
+ {MO_DTPREL_LO, "mips-dtprel-lo"},
+ {MO_GOTTPREL, "mips-gottprel"},
+ {MO_TPREL_HI, "mips-tprel-hi"},
+ {MO_TPREL_LO, "mips-tprel-lo"},
+ {MO_GPOFF_HI, "mips-gpoff-hi"},
+ {MO_GPOFF_LO, "mips-gpoff-lo"},
+ {MO_GOT_DISP, "mips-got-disp"},
+ {MO_GOT_PAGE, "mips-got-page"},
+ {MO_GOT_OFST, "mips-got-ofst"},
+ {MO_HIGHER, "mips-higher"},
+ {MO_HIGHEST, "mips-highest"},
+ {MO_GOT_HI16, "mips-got-hi16"},
+ {MO_GOT_LO16, "mips-got-lo16"},
+ {MO_CALL_HI16, "mips-call-hi16"},
+ {MO_CALL_LO16, "mips-call-lo16"}
+ };
+ return makeArrayRef(Flags);
+}
diff --git a/lib/Target/Mips/MipsInstrInfo.h b/lib/Target/Mips/MipsInstrInfo.h
index 0830b57cd052..a5ed1be3bee5 100644
--- a/lib/Target/Mips/MipsInstrInfo.h
+++ b/lib/Target/Mips/MipsInstrInfo.h
@@ -152,6 +152,12 @@ public:
bool verifyInstruction(const MachineInstr &MI,
StringRef &ErrInfo) const override;
+ std::pair<unsigned, unsigned>
+ decomposeMachineOperandsTargetFlags(unsigned TF) const override;
+
+ ArrayRef<std::pair<unsigned, const char *>>
+ getSerializableDirectMachineOperandTargetFlags() const override;
+
protected:
bool isZeroImm(const MachineOperand &op) const;