Skip to content

Commit 68d6918

Browse files
committed
[MC] Add createFPImm/isFPImm/setFPImm to smooth migration from FPImm to DFPImm after D96091
1 parent e5269da commit 68d6918

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

llvm/include/llvm/MC/MCInst.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,19 @@ class MCOperand {
100100
assert(isDFPImm() && "This is not an FP immediate");
101101
return FPImmVal;
102102
}
103+
double getFPImm() const {
104+
assert(isDFPImm() && "This is not an FP immediate");
105+
return bit_cast<double>(FPImmVal);
106+
}
103107

104108
void setDFPImm(uint64_t Val) {
105109
assert(isDFPImm() && "This is not an FP immediate");
106110
FPImmVal = Val;
107111
}
112+
void setFPImm(double Val) {
113+
assert(isDFPImm() && "This is not an FP immediate");
114+
FPImmVal = bit_cast<uint64_t>(Val);
115+
}
108116

109117
const MCExpr *getExpr() const {
110118
assert(isExpr() && "This is not an expression");
@@ -153,6 +161,12 @@ class MCOperand {
153161
Op.FPImmVal = Val;
154162
return Op;
155163
}
164+
static MCOperand createFPImm(double Val) {
165+
MCOperand Op;
166+
Op.Kind = kDFPImmediate;
167+
Op.FPImmVal = bit_cast<uint64_t>(Val);
168+
return Op;
169+
}
156170

157171
static MCOperand createExpr(const MCExpr *Val) {
158172
MCOperand Op;

0 commit comments

Comments
 (0)