File tree Expand file tree Collapse file tree 6 files changed +66
-29
lines changed Expand file tree Collapse file tree 6 files changed +66
-29
lines changed Original file line number Diff line number Diff line change 1+ // ===- Argument.h -----------------------------------------------*- C++ -*-===//
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+ #ifndef LLVM_SANDBOXIR_ARGUMENT_H
10+ #define LLVM_SANDBOXIR_ARGUMENT_H
11+
12+ #include " llvm/IR/Argument.h"
13+ #include " llvm/SandboxIR/Value.h"
14+
15+ namespace llvm ::sandboxir {
16+
17+ // / Argument of a sandboxir::Function.
18+ class Argument : public sandboxir ::Value {
19+ Argument (llvm::Argument *Arg, sandboxir::Context &Ctx)
20+ : Value(ClassID::Argument, Arg, Ctx) {}
21+ friend class Context ; // For constructor.
22+
23+ public:
24+ static bool classof (const sandboxir::Value *From) {
25+ return From->getSubclassID () == ClassID::Argument;
26+ }
27+ #ifndef NDEBUG
28+ void verify () const final {
29+ assert (isa<llvm::Argument>(Val) && " Expected Argument!" );
30+ }
31+ void printAsOperand (raw_ostream &OS) const ;
32+ void dumpOS (raw_ostream &OS) const final ;
33+ #endif
34+ };
35+
36+ } // namespace llvm::sandboxir
37+
38+ #endif // LLVM_SANDBOXIR_ARGUMENT_H
Original file line number Diff line number Diff line change 109109#include " llvm/IR/PatternMatch.h"
110110#include " llvm/IR/User.h"
111111#include " llvm/IR/Value.h"
112+ #include " llvm/SandboxIR/Argument.h"
112113#include " llvm/SandboxIR/Context.h"
113114#include " llvm/SandboxIR/Module.h"
114115#include " llvm/SandboxIR/Tracker.h"
@@ -189,25 +190,6 @@ class CmpInst;
189190class ICmpInst ;
190191class FCmpInst ;
191192
192- // / Argument of a sandboxir::Function.
193- class Argument : public sandboxir ::Value {
194- Argument (llvm::Argument *Arg, sandboxir::Context &Ctx)
195- : sandboxir::Value(ClassID::Argument, Arg, Ctx) {}
196- friend class Context ; // For constructor.
197-
198- public:
199- static bool classof (const sandboxir::Value *From) {
200- return From->getSubclassID () == ClassID::Argument;
201- }
202- #ifndef NDEBUG
203- void verify () const final {
204- assert (isa<llvm::Argument>(Val) && " Expected Argument!" );
205- }
206- void printAsOperand (raw_ostream &OS) const ;
207- void dumpOS (raw_ostream &OS) const final ;
208- #endif
209- };
210-
211193class Constant : public sandboxir ::User {
212194protected:
213195 Constant (llvm::Constant *C, sandboxir::Context &SBCtx)
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ namespace llvm::sandboxir {
1616
1717// Forward declare all classes to avoid some MSVC build errors.
1818#define DEF_INSTR (ID, OPC, CLASS ) class CLASS ;
19+ #define DEF_CONST (ID, CLASS ) class CLASS ;
20+ #define DEF_USER (ID, CLASS ) class CLASS ;
1921#include " llvm/SandboxIR/SandboxIRValues.def"
2022class Context ;
2123class FuncletPadInst ;
Original file line number Diff line number Diff line change 1+ // ===- Argument.cpp - The function Argument class of Sandbox IR -----------===//
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/Argument.h"
10+
11+ namespace llvm ::sandboxir {
12+
13+ #ifndef NDEBUG
14+ void Argument::printAsOperand (raw_ostream &OS) const {
15+ printAsOperandCommon (OS);
16+ }
17+ void Argument::dumpOS (raw_ostream &OS) const {
18+ dumpCommonPrefix (OS);
19+ dumpCommonSuffix (OS);
20+ }
21+ #endif // NDEBUG
22+
23+ } // namespace llvm::sandboxir
Original file line number Diff line number Diff line change 11add_llvm_component_library(LLVMSandboxIR
2+ Argument.cpp
23 Context.cpp
34 Module.cpp
45 Pass.cpp
Original file line number Diff line number Diff line change 1010#include " llvm/ADT/SmallPtrSet.h"
1111#include " llvm/ADT/SmallVector.h"
1212#include " llvm/IR/Constants.h"
13+ #include " llvm/SandboxIR/Argument.h"
1314#include " llvm/Support/Debug.h"
1415#include < sstream>
1516
@@ -105,16 +106,6 @@ int OperandUseIterator::operator-(const OperandUseIterator &Other) const {
105106 return ThisOpNo - OtherOpNo;
106107}
107108
108- #ifndef NDEBUG
109- void Argument::printAsOperand (raw_ostream &OS) const {
110- printAsOperandCommon (OS);
111- }
112- void Argument::dumpOS (raw_ostream &OS) const {
113- dumpCommonPrefix (OS);
114- dumpCommonSuffix (OS);
115- }
116- #endif // NDEBUG
117-
118109BBIterator &BBIterator::operator ++() {
119110 auto ItE = BB->end ();
120111 assert (It != ItE && " Already at end!" );
You can’t perform that action at this time.
0 commit comments