[PATCH] D77439: Allow MachineFunction to obtain non-const Function (to enable MIR-level debugify)
Daniel Sanders via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 15:49:46 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG35b7b0851b19: Allow MachineFunction to obtain non-const Function (to enable MIR-level… (authored by dsanders).
Changed prior to commit:
https://reviews.llvm.org/D77439?vs=254946&id=255525#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77439/new/
https://reviews.llvm.org/D77439
Files:
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/include/llvm/CodeGen/MachineModuleInfo.h
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/MachineModuleInfo.cpp
Index: llvm/lib/CodeGen/MachineModuleInfo.cpp
===================================================================
--- llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -225,8 +225,7 @@
return I != MachineFunctions.end() ? I->second.get() : nullptr;
}
-MachineFunction &
-MachineModuleInfo::getOrCreateMachineFunction(const Function &F) {
+MachineFunction &MachineModuleInfo::getOrCreateMachineFunction(Function &F) {
// Shortcut for the common case where a sequence of MachineFunctionPasses
// all query for the same Function.
if (LastRequest == &F)
Index: llvm/lib/CodeGen/MachineFunction.cpp
===================================================================
--- llvm/lib/CodeGen/MachineFunction.cpp
+++ llvm/lib/CodeGen/MachineFunction.cpp
@@ -133,8 +133,7 @@
return STI->getFrameLowering()->getStackAlign().value();
}
-MachineFunction::MachineFunction(const Function &F,
- const LLVMTargetMachine &Target,
+MachineFunction::MachineFunction(Function &F, const LLVMTargetMachine &Target,
const TargetSubtargetInfo &STI,
unsigned FunctionNum, MachineModuleInfo &mmi)
: F(F), Target(Target), STI(&STI), Ctx(mmi.getContext()), MMI(mmi) {
Index: llvm/include/llvm/CodeGen/MachineModuleInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineModuleInfo.h
+++ llvm/include/llvm/CodeGen/MachineModuleInfo.h
@@ -165,9 +165,9 @@
/// Returns the MachineFunction constructed for the IR function \p F.
/// Creates a new MachineFunction if none exists yet.
- MachineFunction &getOrCreateMachineFunction(const Function &F);
+ MachineFunction &getOrCreateMachineFunction(Function &F);
- /// \bried Returns the MachineFunction associated to IR function \p F if there
+ /// \brief Returns the MachineFunction associated to IR function \p F if there
/// is one, otherwise nullptr.
MachineFunction *getMachineFunction(const Function &F) const;
Index: llvm/include/llvm/CodeGen/MachineFunction.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineFunction.h
+++ llvm/include/llvm/CodeGen/MachineFunction.h
@@ -224,7 +224,7 @@
};
class MachineFunction {
- const Function &F;
+ Function &F;
const LLVMTargetMachine &Target;
const TargetSubtargetInfo *STI;
MCContext &Ctx;
@@ -435,7 +435,7 @@
using VariableDbgInfoMapTy = SmallVector<VariableDbgInfo, 4>;
VariableDbgInfoMapTy VariableDbgInfos;
- MachineFunction(const Function &F, const LLVMTargetMachine &Target,
+ MachineFunction(Function &F, const LLVMTargetMachine &Target,
const TargetSubtargetInfo &STI, unsigned FunctionNum,
MachineModuleInfo &MMI);
MachineFunction(const MachineFunction &) = delete;
@@ -484,6 +484,9 @@
const DataLayout &getDataLayout() const;
/// Return the LLVM function that this machine code represents
+ Function &getFunction() { return F; }
+
+ /// Return the LLVM function that this machine code represents
const Function &getFunction() const { return F; }
/// getName - Return the name of the corresponding LLVM function.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77439.255525.patch
Type: text/x-patch
Size: 3262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200406/7bb3f4af/attachment.bin>
More information about the llvm-commits
mailing list