[PATCH] D61651: [MachineOperand] Add a ChangeToGA method
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 10:45:33 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL360789: [MachineOperand] Add a ChangeToGA method (authored by nha, committed by ).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61651/new/
https://reviews.llvm.org/D61651
Files:
llvm/trunk/include/llvm/CodeGen/MachineOperand.h
llvm/trunk/lib/CodeGen/MachineOperand.cpp
Index: llvm/trunk/lib/CodeGen/MachineOperand.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MachineOperand.cpp
+++ llvm/trunk/lib/CodeGen/MachineOperand.cpp
@@ -181,6 +181,19 @@
setTargetFlags(TargetFlags);
}
+void MachineOperand::ChangeToGA(const GlobalValue *GV, int64_t Offset,
+ unsigned char TargetFlags) {
+ assert((!isReg() || !isTied()) &&
+ "Cannot change a tied operand into a global address");
+
+ removeRegFromUses();
+
+ OpKind = MO_GlobalAddress;
+ Contents.OffsetedInfo.Val.GV = GV;
+ setOffset(Offset);
+ setTargetFlags(TargetFlags);
+}
+
void MachineOperand::ChangeToMCSymbol(MCSymbol *Sym) {
assert((!isReg() || !isTied()) &&
"Cannot change a tied operand into an MCSymbol");
Index: llvm/trunk/include/llvm/CodeGen/MachineOperand.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineOperand.h
+++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h
@@ -713,6 +713,10 @@
/// ChangeToES - Replace this operand with a new external symbol operand.
void ChangeToES(const char *SymName, unsigned char TargetFlags = 0);
+ /// ChangeToGA - Replace this operand with a new global address operand.
+ void ChangeToGA(const GlobalValue *GV, int64_t Offset,
+ unsigned char TargetFlags = 0);
+
/// ChangeToMCSymbol - Replace this operand with a new MC symbol operand.
void ChangeToMCSymbol(MCSymbol *Sym);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61651.199638.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190515/e44035f7/attachment.bin>
More information about the llvm-commits
mailing list