diff options
author | Wang Pengcheng <wangpengcheng.pp@bytedance.com> | 2024-01-22 17:36:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-22 17:36:32 +0800 |
commit | 5cd8d53cac00feafd739dba6215e1f6eed502e46 (patch) | |
tree | 79fc889035411692c7c634e92166ebae1da0452d /llvm/lib/CodeGen/MachineOperand.cpp | |
parent | ac296b696ccf3081b2fc920f860da894fb1d8eb0 (diff) | |
download | llvm-5cd8d53cac00feafd739dba6215e1f6eed502e46.zip llvm-5cd8d53cac00feafd739dba6215e1f6eed502e46.tar.gz llvm-5cd8d53cac00feafd739dba6215e1f6eed502e46.tar.bz2 |
[RISCV] Teach RISCVMergeBaseOffset to handle inline asm (#78945)
For inline asm with memory operands, we can merge the offset into
the second operand of memory constraint operands.
Differential Revision: https://reviews.llvm.org/D158062
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineOperand.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index 12d6b79..c7c0a1c 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -206,6 +206,19 @@ void MachineOperand::ChangeToGA(const GlobalValue *GV, int64_t Offset, setTargetFlags(TargetFlags); } +void MachineOperand::ChangeToBA(const BlockAddress *BA, int64_t Offset, + unsigned TargetFlags) { + assert((!isReg() || !isTied()) && + "Cannot change a tied operand into a block address"); + + removeRegFromUses(); + + OpKind = MO_BlockAddress; + Contents.OffsetedInfo.Val.BA = BA; + setOffset(Offset); + setTargetFlags(TargetFlags); +} + void MachineOperand::ChangeToMCSymbol(MCSymbol *Sym, unsigned TargetFlags) { assert((!isReg() || !isTied()) && "Cannot change a tied operand into an MCSymbol"); |