[llvm] [SandboxIR] More boilerplate: Function, Argument, Constant, Instruction, OpaqueInst (PR #97343)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 10:59:12 PDT 2024
================
@@ -58,8 +58,127 @@ void Value::printAsOperandCommon(raw_ostream &OS) const {
OS << "NULL ";
}
+void Argument::printAsOperand(raw_ostream &OS) const {
+ printAsOperandCommon(OS);
+}
+void Argument::dump(raw_ostream &OS) const {
+ dumpCommonPrefix(OS);
+ dumpCommonSuffix(OS);
+}
+void Argument::dump() const {
+ dump(dbgs());
+ dbgs() << "\n";
+}
+
+bool User::classof(const Value *From) {
+ switch (From->getSubclassID()) {
+#define DEF_VALUE(ID, CLASS)
+#define DEF_USER(ID, CLASS) \
+ case ClassID::ID: \
+ return true;
+#define DEF_INSTR(ID, OPC, CLASS) \
+ case ClassID::ID: \
+ return true;
+#include "llvm/SandboxIR/SandboxIRValues.def"
+ default:
+ return false;
+ }
+ return false;
+}
+
void User::dumpCommonHeader(raw_ostream &OS) const {
Value::dumpCommonHeader(OS);
// TODO: This is incomplete
}
#endif // NDEBUG
+
+const char *Instruction::getOpcodeName(Opcode Opc) {
+ switch (Opc) {
+#define DEF_VALUE(ID, CLASS)
+#define DEF_USER(ID, CLASS)
+#define OP(OPC) \
+ case Opcode::OPC: \
+ return #OPC;
+#define OPCODES(...) __VA_ARGS__
----------------
vporpo wrote:
Oops it's not used yet, I will remove it.
https://github.com/llvm/llvm-project/pull/97343
More information about the llvm-commits
mailing list