LLVM
20.0.0git
lib
SandboxIR
Use.cpp
Go to the documentation of this file.
1
//===- Use.cpp ------------------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "
llvm/SandboxIR/Use.h
"
10
#include "
llvm/SandboxIR/Context.h
"
11
#include "
llvm/SandboxIR/User.h
"
12
13
namespace
llvm::sandboxir
{
14
15
Value
*
Use::get
()
const
{
return
Ctx->
getValue
(LLVMUse->get()); }
16
17
void
Use::set
(
Value
*V) {
18
Ctx->
getTracker
().
emplaceIfTracking
<
UseSet
>(*this);
19
LLVMUse->set(V->Val);
20
}
21
22
unsigned
Use::getOperandNo
()
const
{
return
Usr->
getUseOperandNo
(*
this
); }
23
24
void
Use::swap
(
Use
&OtherUse) {
25
Ctx->
getTracker
().
emplaceIfTracking
<
UseSwap
>(*
this
, OtherUse);
26
LLVMUse->swap(*OtherUse.LLVMUse);
27
}
28
29
#ifndef NDEBUG
30
void
Use::dumpOS
(
raw_ostream
&
OS
)
const
{
31
Value
*Def =
nullptr
;
32
if
(LLVMUse ==
nullptr
)
33
OS
<<
"<null> LLVM Use! "
;
34
else
35
Def = Ctx->
getValue
(LLVMUse->get());
36
OS
<<
"Def: "
;
37
if
(Def ==
nullptr
)
38
OS
<<
"NULL"
;
39
else
40
OS
<< *Def;
41
OS
<<
"\n"
;
42
43
OS
<<
"User: "
;
44
if
(Usr ==
nullptr
)
45
OS
<<
"NULL"
;
46
else
47
OS
<< *Usr;
48
OS
<<
"\n"
;
49
50
OS
<<
"OperandNo: "
;
51
if
(Usr ==
nullptr
)
52
OS
<<
"N/A"
;
53
else
54
OS
<<
getOperandNo
();
55
OS
<<
"\n"
;
56
}
57
58
void
Use::dump
()
const
{
dumpOS
(
dbgs
()); }
59
#endif
// NDEBUG
60
61
}
// namespace llvm::sandboxir
OS
raw_pwrite_stream & OS
Definition:
SampleProfWriter.cpp:51
Context.h
Use.h
User.h
llvm::Value
LLVM Value Representation.
Definition:
Value.h:74
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:
raw_ostream.h:52
llvm::sandboxir::Context::getValue
sandboxir::Value * getValue(llvm::Value *V) const
Definition:
Context.cpp:601
llvm::sandboxir::Context::getTracker
Tracker & getTracker()
Definition:
Context.h:203
llvm::sandboxir::Tracker::emplaceIfTracking
bool emplaceIfTracking(ArgsT... Args)
A convenience wrapper for track() that constructs and tracks the Change object if tracking is enabled...
Definition:
Tracker.h:495
llvm::sandboxir::UseSet
Tracks the change of the source Value of a sandboxir::Use.
Definition:
Tracker.h:138
llvm::sandboxir::UseSwap
Tracks swapping a Use with another Use.
Definition:
Tracker.h:196
llvm::sandboxir::Use
Represents a Def-use/Use-def edge in SandboxIR.
Definition:
Use.h:32
llvm::sandboxir::Use::set
void set(Value *V)
Definition:
Use.cpp:17
llvm::sandboxir::Use::getOperandNo
unsigned getOperandNo() const
Definition:
Use.cpp:22
llvm::sandboxir::Use::dumpOS
void dumpOS(raw_ostream &OS) const
Definition:
Use.cpp:30
llvm::sandboxir::Use::swap
void swap(Use &OtherUse)
Definition:
Use.cpp:24
llvm::sandboxir::Use::dump
void dump() const
Definition:
Use.cpp:58
llvm::sandboxir::Use::get
Value * get() const
Definition:
Use.cpp:15
llvm::sandboxir::User::getUseOperandNo
virtual unsigned getUseOperandNo(const Use &Use) const =0
\Returns the operand index of Use.
llvm::sandboxir::Value
A SandboxIR Value has users. This is the base class.
Definition:
Value.h:63
llvm::sandboxir
Definition:
Argument.h:15
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition:
Debug.cpp:163
Generated on Sat Dec 21 2024 23:09:18 for LLVM by
1.9.6