aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
authorMichael Liao <michael.hliao@gmail.com>2019-10-23 12:46:37 -0400
committerMichael Liao <michael.hliao@gmail.com>2020-09-03 18:37:39 -0400
commitbf41c4d29e44bfe3ae96c968e2e44761d5acb3ed (patch)
treef259ec92fea48fcee934720c0ba2496a0caa3bd1 /llvm/lib/CodeGen/MachineOperand.cpp
parent052dbe226cb3540c77cf0b3dc4a51a4ab7726b55 (diff)
downloadllvm-bf41c4d29e44bfe3ae96c968e2e44761d5acb3ed.zip
llvm-bf41c4d29e44bfe3ae96c968e2e44761d5acb3ed.tar.gz
llvm-bf41c4d29e44bfe3ae96c968e2e44761d5acb3ed.tar.bz2
[codegen] Ensure target flags are cleared/set properly. NFC.
- When an operand is changed into an immediate value or like, ensure their target flags being cleared or set properly. Differential Revision: https://reviews.llvm.org/D87109
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOperand.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp
index ce33cdb..76b69df 100644
--- a/llvm/lib/CodeGen/MachineOperand.cpp
+++ b/llvm/lib/CodeGen/MachineOperand.cpp
@@ -153,22 +153,25 @@ void MachineOperand::removeRegFromUses() {
/// ChangeToImmediate - Replace this operand with a new immediate operand of
/// the specified value. If an operand is known to be an immediate already,
/// the setImm method should be used.
-void MachineOperand::ChangeToImmediate(int64_t ImmVal) {
+void MachineOperand::ChangeToImmediate(int64_t ImmVal, unsigned TargetFlags) {
assert((!isReg() || !isTied()) && "Cannot change a tied operand into an imm");
removeRegFromUses();
OpKind = MO_Immediate;
Contents.ImmVal = ImmVal;
+ setTargetFlags(TargetFlags);
}
-void MachineOperand::ChangeToFPImmediate(const ConstantFP *FPImm) {
+void MachineOperand::ChangeToFPImmediate(const ConstantFP *FPImm,
+ unsigned TargetFlags) {
assert((!isReg() || !isTied()) && "Cannot change a tied operand into an imm");
removeRegFromUses();
OpKind = MO_FPImmediate;
Contents.CFP = FPImm;
+ setTargetFlags(TargetFlags);
}
void MachineOperand::ChangeToES(const char *SymName,
@@ -197,7 +200,7 @@ void MachineOperand::ChangeToGA(const GlobalValue *GV, int64_t Offset,
setTargetFlags(TargetFlags);
}
-void MachineOperand::ChangeToMCSymbol(MCSymbol *Sym) {
+void MachineOperand::ChangeToMCSymbol(MCSymbol *Sym, unsigned TargetFlags) {
assert((!isReg() || !isTied()) &&
"Cannot change a tied operand into an MCSymbol");
@@ -205,9 +208,10 @@ void MachineOperand::ChangeToMCSymbol(MCSymbol *Sym) {
OpKind = MO_MCSymbol;
Contents.Sym = Sym;
+ setTargetFlags(TargetFlags);
}
-void MachineOperand::ChangeToFrameIndex(int Idx) {
+void MachineOperand::ChangeToFrameIndex(int Idx, unsigned TargetFlags) {
assert((!isReg() || !isTied()) &&
"Cannot change a tied operand into a FrameIndex");
@@ -215,6 +219,7 @@ void MachineOperand::ChangeToFrameIndex(int Idx) {
OpKind = MO_FrameIndex;
setIndex(Idx);
+ setTargetFlags(TargetFlags);
}
void MachineOperand::ChangeToTargetIndex(unsigned Idx, int64_t Offset,