forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SandboxIR][NFC] Move Argument into a separate file (llvm#110174)
- Loading branch information
Showing
6 changed files
with
66 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//===- Argument.h -----------------------------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_SANDBOXIR_ARGUMENT_H | ||
#define LLVM_SANDBOXIR_ARGUMENT_H | ||
|
||
#include "llvm/IR/Argument.h" | ||
#include "llvm/SandboxIR/Value.h" | ||
|
||
namespace llvm::sandboxir { | ||
|
||
/// Argument of a sandboxir::Function. | ||
class Argument : public sandboxir::Value { | ||
Argument(llvm::Argument *Arg, sandboxir::Context &Ctx) | ||
: Value(ClassID::Argument, Arg, Ctx) {} | ||
friend class Context; // For constructor. | ||
|
||
public: | ||
static bool classof(const sandboxir::Value *From) { | ||
return From->getSubclassID() == ClassID::Argument; | ||
} | ||
#ifndef NDEBUG | ||
void verify() const final { | ||
assert(isa<llvm::Argument>(Val) && "Expected Argument!"); | ||
} | ||
void printAsOperand(raw_ostream &OS) const; | ||
void dumpOS(raw_ostream &OS) const final; | ||
#endif | ||
}; | ||
|
||
} // namespace llvm::sandboxir | ||
|
||
#endif // LLVM_SANDBOXIR_ARGUMENT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//===- Argument.cpp - The function Argument class of Sandbox IR -----------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "llvm/SandboxIR/Argument.h" | ||
|
||
namespace llvm::sandboxir { | ||
|
||
#ifndef NDEBUG | ||
void Argument::printAsOperand(raw_ostream &OS) const { | ||
printAsOperandCommon(OS); | ||
} | ||
void Argument::dumpOS(raw_ostream &OS) const { | ||
dumpCommonPrefix(OS); | ||
dumpCommonSuffix(OS); | ||
} | ||
#endif // NDEBUG | ||
|
||
} // namespace llvm::sandboxir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
add_llvm_component_library(LLVMSandboxIR | ||
Argument.cpp | ||
Context.cpp | ||
Module.cpp | ||
Pass.cpp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters