forked from OSchip/llvm-project
Add support for setting the location of an IROperandOwner.
PiperOrigin-RevId: 222995814
This commit is contained in:
parent
721a30d6a0
commit
759fd1c6a3
|
@ -77,6 +77,7 @@ class Instruction final
|
|||
public:
|
||||
using IROperandOwner::getContext;
|
||||
using IROperandOwner::getLoc;
|
||||
using IROperandOwner::setLoc;
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Operands
|
||||
|
|
|
@ -46,6 +46,9 @@ public:
|
|||
/// The source location the operation was defined or derived from.
|
||||
Location getLoc() const;
|
||||
|
||||
/// Set the source location the operation was defined or derived from.
|
||||
void setLoc(Location loc);
|
||||
|
||||
/// Return the function this operation is defined in. This has a verbose
|
||||
/// name to avoid name lookup ambiguities.
|
||||
Function *getOperationFunction();
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
using Statement::getLoc;
|
||||
using Statement::moveBefore;
|
||||
using Statement::print;
|
||||
using Statement::setLoc;
|
||||
|
||||
/// Check if this statement is a return statement.
|
||||
bool isReturn() const;
|
||||
|
|
|
@ -90,6 +90,9 @@ public:
|
|||
/// The source location the operation was defined or derived from.
|
||||
Location getLoc() const { return locationAndKind.getPointer(); }
|
||||
|
||||
/// Set the source location the operation was defined or derived from.
|
||||
void setLoc(Location loc) { locationAndKind.setPointer(loc); }
|
||||
|
||||
/// Return the context this operation is associated with.
|
||||
MLIRContext *getContext() const;
|
||||
|
||||
|
|
|
@ -87,6 +87,14 @@ Location Operation::getLoc() const {
|
|||
return llvm::cast<OperationStmt>(this)->getLoc();
|
||||
}
|
||||
|
||||
/// Set the source location the operation was defined or derived from.
|
||||
void Operation::setLoc(Location loc) {
|
||||
if (auto *inst = llvm::dyn_cast<Instruction>(this))
|
||||
inst->setLoc(loc);
|
||||
else
|
||||
llvm::cast<OperationStmt>(this)->setLoc(loc);
|
||||
}
|
||||
|
||||
/// Return the function this operation is defined in.
|
||||
Function *Operation::getOperationFunction() {
|
||||
if (auto *inst = llvm::dyn_cast<Instruction>(this))
|
||||
|
|
Loading…
Reference in New Issue