File indexing completed on 2026-05-10 08:44:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_MC_MCINSTBUILDER_H
0015 #define LLVM_MC_MCINSTBUILDER_H
0016
0017 #include "llvm/MC/MCInst.h"
0018
0019 namespace llvm {
0020
0021 class MCInstBuilder {
0022 MCInst Inst;
0023
0024 public:
0025
0026 MCInstBuilder(unsigned Opcode) {
0027 Inst.setOpcode(Opcode);
0028 }
0029
0030
0031 MCInstBuilder &setLoc(SMLoc SM) {
0032 Inst.setLoc(SM);
0033 return *this;
0034 }
0035
0036
0037 MCInstBuilder &addReg(MCRegister Reg) {
0038 Inst.addOperand(MCOperand::createReg(Reg));
0039 return *this;
0040 }
0041
0042
0043 MCInstBuilder &addImm(int64_t Val) {
0044 Inst.addOperand(MCOperand::createImm(Val));
0045 return *this;
0046 }
0047
0048
0049 MCInstBuilder &addSFPImm(uint32_t Val) {
0050 Inst.addOperand(MCOperand::createSFPImm(Val));
0051 return *this;
0052 }
0053
0054
0055 MCInstBuilder &addDFPImm(uint64_t Val) {
0056 Inst.addOperand(MCOperand::createDFPImm(Val));
0057 return *this;
0058 }
0059
0060
0061 MCInstBuilder &addExpr(const MCExpr *Val) {
0062 Inst.addOperand(MCOperand::createExpr(Val));
0063 return *this;
0064 }
0065
0066
0067 MCInstBuilder &addInst(const MCInst *Val) {
0068 Inst.addOperand(MCOperand::createInst(Val));
0069 return *this;
0070 }
0071
0072
0073 MCInstBuilder &addOperand(const MCOperand &Op) {
0074 Inst.addOperand(Op);
0075 return *this;
0076 }
0077
0078 operator MCInst&() {
0079 return Inst;
0080 }
0081 };
0082
0083 }
0084
0085 #endif