|
| 1 | +//===- SandboxIR.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 | +// Sandbox IR is a lightweight overlay transactional IR on top of LLVM IR. |
| 10 | +// Features: |
| 11 | +// - You can save/rollback the state of the IR at any time. |
| 12 | +// - Any changes made to Sandbox IR will automatically update the underlying |
| 13 | +// LLVM IR so both IRs are always in sync. |
| 14 | +// - Feels like LLVM IR, similar API. |
| 15 | +// |
| 16 | +// SandboxIR forms a class hierarchy that resembles that of LLVM IR |
| 17 | +// but is in the `sandboxir` namespace: |
| 18 | +// |
| 19 | +// namespace sandboxir { |
| 20 | +// |
| 21 | +// Value -+- Argument |
| 22 | +// | |
| 23 | +// +- BasicBlock |
| 24 | +// | |
| 25 | +// +- User ------+- Constant ------ Function |
| 26 | +// | |
| 27 | +// +- Instruction -+- BinaryOperator |
| 28 | +// | |
| 29 | +// +- BranchInst |
| 30 | +// | |
| 31 | +// +- CastInst --------+- AddrSpaceCastInst |
| 32 | +// | | |
| 33 | +// | +- BitCastInst |
| 34 | +// | | |
| 35 | +// | +- FPExtInst |
| 36 | +// | | |
| 37 | +// | +- FPToSIInst |
| 38 | +// | | |
| 39 | +// | +- FPToUIInst |
| 40 | +// | | |
| 41 | +// | +- FPTruncInst |
| 42 | +// | | |
| 43 | +// | +- IntToPtrInst |
| 44 | +// | | |
| 45 | +// | +- PtrToIntInst |
| 46 | +// | | |
| 47 | +// | +- SExtInst |
| 48 | +// | | |
| 49 | +// | +- SIToFPInst |
| 50 | +// | | |
| 51 | +// | +- TruncInst |
| 52 | +// | | |
| 53 | +// | +- UIToFPInst |
| 54 | +// | | |
| 55 | +// | +- ZExtInst |
| 56 | +// | |
| 57 | +// +- CallBase --------+- CallBrInst |
| 58 | +// | | |
| 59 | +// | +- CallInst |
| 60 | +// | | |
| 61 | +// | +- InvokeInst |
| 62 | +// | |
| 63 | +// +- CmpInst ---------+- ICmpInst |
| 64 | +// | | |
| 65 | +// | +- FCmpInst |
| 66 | +// | |
| 67 | +// +- ExtractElementInst |
| 68 | +// | |
| 69 | +// +- GetElementPtrInst |
| 70 | +// | |
| 71 | +// +- InsertElementInst |
| 72 | +// | |
| 73 | +// +- OpaqueInst |
| 74 | +// | |
| 75 | +// +- PHINode |
| 76 | +// | |
| 77 | +// +- ReturnInst |
| 78 | +// | |
| 79 | +// +- SelectInst |
| 80 | +// | |
| 81 | +// +- ShuffleVectorInst |
| 82 | +// | |
| 83 | +// +- ExtractValueInst |
| 84 | +// | |
| 85 | +// +- InsertValueInst |
| 86 | +// | |
| 87 | +// +- StoreInst |
| 88 | +// | |
| 89 | +// +- UnaryInstruction -+- LoadInst |
| 90 | +// | | |
| 91 | +// | +- CastInst |
| 92 | +// | |
| 93 | +// +- UnaryOperator |
| 94 | +// | |
| 95 | +// +- UnreachableInst |
| 96 | +// |
| 97 | +// Use |
| 98 | +// |
| 99 | +// } // namespace sandboxir |
| 100 | +// |
| 101 | + |
| 102 | +#ifndef LLVM_SANDBOXIR_SANDBOXIR_H |
| 103 | +#define LLVM_SANDBOXIR_SANDBOXIR_H |
| 104 | + |
| 105 | +#include "llvm/IR/Function.h" |
| 106 | +#include "llvm/IR/IRBuilder.h" |
| 107 | +#include "llvm/IR/Instruction.h" |
| 108 | +#include "llvm/IR/IntrinsicInst.h" |
| 109 | +#include "llvm/IR/PatternMatch.h" |
| 110 | +#include "llvm/IR/User.h" |
| 111 | +#include "llvm/IR/Value.h" |
| 112 | +#include "llvm/SandboxIR/Argument.h" |
| 113 | +#include "llvm/SandboxIR/BasicBlock.h" |
| 114 | +#include "llvm/SandboxIR/Constant.h" |
| 115 | +#include "llvm/SandboxIR/Context.h" |
| 116 | +#include "llvm/SandboxIR/Module.h" |
| 117 | +#include "llvm/SandboxIR/Tracker.h" |
| 118 | +#include "llvm/SandboxIR/Type.h" |
| 119 | +#include "llvm/SandboxIR/Use.h" |
| 120 | +#include "llvm/SandboxIR/User.h" |
| 121 | +#include "llvm/SandboxIR/Value.h" |
| 122 | +#include "llvm/Support/raw_ostream.h" |
| 123 | +#include <iterator> |
| 124 | + |
| 125 | +namespace llvm { |
| 126 | + |
| 127 | +namespace sandboxir { |
| 128 | + |
| 129 | +class BasicBlock; |
| 130 | +class ConstantInt; |
| 131 | +class ConstantFP; |
| 132 | +class ConstantAggregateZero; |
| 133 | +class ConstantPointerNull; |
| 134 | +class PoisonValue; |
| 135 | +class BlockAddress; |
| 136 | +class DSOLocalEquivalent; |
| 137 | +class ConstantTokenNone; |
| 138 | +class GlobalValue; |
| 139 | +class GlobalObject; |
| 140 | +class GlobalIFunc; |
| 141 | +class GlobalVariable; |
| 142 | +class GlobalAlias; |
| 143 | +class NoCFIValue; |
| 144 | +class ConstantPtrAuth; |
| 145 | +class ConstantExpr; |
| 146 | +class Context; |
| 147 | +class Function; |
| 148 | +class Module; |
| 149 | +class Instruction; |
| 150 | +class VAArgInst; |
| 151 | +class FreezeInst; |
| 152 | +class FenceInst; |
| 153 | +class SelectInst; |
| 154 | +class ExtractElementInst; |
| 155 | +class InsertElementInst; |
| 156 | +class ShuffleVectorInst; |
| 157 | +class ExtractValueInst; |
| 158 | +class InsertValueInst; |
| 159 | +class BranchInst; |
| 160 | +class UnaryInstruction; |
| 161 | +class LoadInst; |
| 162 | +class ReturnInst; |
| 163 | +class StoreInst; |
| 164 | +class User; |
| 165 | +class UnreachableInst; |
| 166 | +class Value; |
| 167 | +class CallBase; |
| 168 | +class CallInst; |
| 169 | +class InvokeInst; |
| 170 | +class CallBrInst; |
| 171 | +class LandingPadInst; |
| 172 | +class FuncletPadInst; |
| 173 | +class CatchPadInst; |
| 174 | +class CleanupPadInst; |
| 175 | +class CatchReturnInst; |
| 176 | +class CleanupReturnInst; |
| 177 | +class GetElementPtrInst; |
| 178 | +class CastInst; |
| 179 | +class PossiblyNonNegInst; |
| 180 | +class PtrToIntInst; |
| 181 | +class BitCastInst; |
| 182 | +class AllocaInst; |
| 183 | +class ResumeInst; |
| 184 | +class CatchSwitchInst; |
| 185 | +class SwitchInst; |
| 186 | +class UnaryOperator; |
| 187 | +class BinaryOperator; |
| 188 | +class PossiblyDisjointInst; |
| 189 | +class AtomicRMWInst; |
| 190 | +class AtomicCmpXchgInst; |
| 191 | +class CmpInst; |
| 192 | +class ICmpInst; |
| 193 | +class FCmpInst; |
| 194 | + |
| 195 | +} // namespace sandboxir |
| 196 | +} // namespace llvm |
| 197 | + |
| 198 | +#endif // LLVM_SANDBOXIR_SANDBOXIR_H |
0 commit comments