mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-18 10:31:57 +00:00
00b16889ab
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
73 lines
2.4 KiB
C++
73 lines
2.4 KiB
C++
//===- SparcV9TmpInstr.cpp - SparcV9 Intermediate Value class -------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Methods of class for temporary intermediate values used within the current
|
|
// SparcV9 backend.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "SparcV9TmpInstr.h"
|
|
#include "llvm/Type.h"
|
|
#include "llvm/Support/LeakDetector.h"
|
|
using namespace llvm;
|
|
|
|
TmpInstruction::TmpInstruction(const TmpInstruction &TI)
|
|
: Instruction(TI.getType(), TI.getOpcode(), Ops, TI.getNumOperands()) {
|
|
if (TI.getNumOperands()) {
|
|
Ops[0].init(TI.Ops[0], this);
|
|
if (TI.getNumOperands() == 2)
|
|
Ops[1].init(TI.Ops[1], this);
|
|
else
|
|
assert(0 && "Bad # operands to TmpInstruction!");
|
|
}
|
|
}
|
|
|
|
TmpInstruction::TmpInstruction(Value *s1, Value *s2, const std::string &name)
|
|
: Instruction(s1->getType(), Instruction::UserOp1, Ops, 1+(s2 != 0), name) {
|
|
Ops[0].init(s1, this); // s1 must be non-null
|
|
if (s2)
|
|
Ops[1].init(s2, this);
|
|
|
|
// TmpInstructions should not be garbage checked.
|
|
LeakDetector::removeGarbageObject(this);
|
|
}
|
|
|
|
TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
|
|
Value *s1, Value *s2, const std::string &name)
|
|
: Instruction(s1->getType(), Instruction::UserOp1, Ops, 1+(s2 != 0), name) {
|
|
mcfi.addTemp(this);
|
|
|
|
Ops[0].init(s1, this); // s1 must be non-null
|
|
if (s2)
|
|
Ops[1].init(s2, this);
|
|
|
|
// TmpInstructions should not be garbage checked.
|
|
LeakDetector::removeGarbageObject(this);
|
|
}
|
|
|
|
// Constructor that requires the type of the temporary to be specified.
|
|
// Both S1 and S2 may be NULL.
|
|
TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
|
|
const Type *Ty, Value *s1, Value* s2,
|
|
const std::string &name)
|
|
: Instruction(Ty, Instruction::UserOp1, Ops, (s1 != 0)+(s2 != 0), name) {
|
|
mcfi.addTemp(this);
|
|
|
|
assert((s1 != 0 || s2 == 0) &&
|
|
"s2 cannot be non-null if s1 is non-null!");
|
|
if (s1) {
|
|
Ops[0].init(s1, this);
|
|
if (s2)
|
|
Ops[1].init(s2, this);
|
|
}
|
|
|
|
// TmpInstructions should not be garbage checked.
|
|
LeakDetector::removeGarbageObject(this);
|
|
}
|