mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
78cee7e7ab
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4282 91177308-0d34-0410-b5e6-96231b3b80d8
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
//===-- MInstruction.cpp - Implementation code for the MInstruction class -===//
|
|
//
|
|
// This file contains a printer that converts from our internal representation
|
|
// of LLVM code to a nice human readable form that is suitable for debuggging.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/CodeGen/MBasicBlock.h"
|
|
|
|
/// MInstruction ctor - Create a new instruction, and append it to the
|
|
/// specified basic block.
|
|
///
|
|
MInstruction::MInstruction(MBasicBlock *BB, unsigned O, unsigned D)
|
|
: Opcode(O), Dest(D) {
|
|
// Add this instruction to the specified basic block
|
|
BB->getInstList().push_back(this);
|
|
}
|
|
|
|
|
|
/// addOperand - Add a new operand to the instruction with the specified value
|
|
/// and interpretation.
|
|
///
|
|
void MInstruction::addOperand(unsigned Value, MOperand::Interpretation Ty) {
|
|
if (Operands.size() < 4) {
|
|
OperandInterpretation[Operands.size()] = Ty; // Save interpretation
|
|
} else {
|
|
assert(Ty == MOperand::Register &&
|
|
"Trying to add 5th operand that is not a register to MInstruction!");
|
|
}
|
|
Operands.push_back(Value);
|
|
}
|