mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
Change machinecode for instruction to not inherit from vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3274 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,18 +1,17 @@
|
|||||||
//===-- llvm/CodeGen/MachineCodeForInstruction.h -----------------*- C++ -*--=//
|
//===-- llvm/CodeGen/MachineCodeForInstruction.h ----------------*- C++ -*-===//
|
||||||
//
|
//
|
||||||
// Representation of the sequence of machine instructions created
|
// Representation of the sequence of machine instructions created for a single
|
||||||
// for a single VM instruction. Additionally records information
|
// VM instruction. Additionally records information about hidden and implicit
|
||||||
// about hidden and implicit values used by the machine instructions:
|
// values used by the machine instructions: about hidden values used by the
|
||||||
// about hidden values used by the machine instructions:
|
// machine instructions:
|
||||||
//
|
//
|
||||||
// "Temporary values" are intermediate values used in the machine
|
// "Temporary values" are intermediate values used in the machine instruction
|
||||||
// instruction sequence, but not in the VM instruction
|
// sequence, but not in the VM instruction Note that such values should be
|
||||||
// Note that such values should be treated as pure SSA values with
|
// treated as pure SSA values with no interpretation of their operands (i.e., as
|
||||||
// no interpretation of their operands (i.e., as a TmpInstruction
|
// a TmpInstruction object which actually represents such a value).
|
||||||
// object which actually represents such a value).
|
|
||||||
//
|
//
|
||||||
// (2) "Implicit uses" are values used in the VM instruction but not in
|
// (2) "Implicit uses" are values used in the VM instruction but not in
|
||||||
// the machine instruction sequence
|
// the machine instruction sequence
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
@@ -25,10 +24,9 @@ class MachineInstr;
|
|||||||
class Instruction;
|
class Instruction;
|
||||||
class Value;
|
class Value;
|
||||||
|
|
||||||
class MachineCodeForInstruction
|
class MachineCodeForInstruction : public Annotation {
|
||||||
: public Annotation, public std::vector<MachineInstr*> {
|
|
||||||
std::vector<Value*> tempVec; // used by m/c instr but not VM instr
|
std::vector<Value*> tempVec; // used by m/c instr but not VM instr
|
||||||
|
std::vector<MachineInstr*> Contents;
|
||||||
public:
|
public:
|
||||||
MachineCodeForInstruction();
|
MachineCodeForInstruction();
|
||||||
~MachineCodeForInstruction();
|
~MachineCodeForInstruction();
|
||||||
@@ -36,6 +34,31 @@ public:
|
|||||||
static MachineCodeForInstruction &get(const Instruction *I);
|
static MachineCodeForInstruction &get(const Instruction *I);
|
||||||
static void destroy(const Instruction *I);
|
static void destroy(const Instruction *I);
|
||||||
|
|
||||||
|
// Access to underlying machine instructions...
|
||||||
|
typedef std::vector<MachineInstr*>::iterator iterator;
|
||||||
|
typedef std::vector<MachineInstr*>::const_iterator const_iterator;
|
||||||
|
|
||||||
|
unsigned size() const { return Contents.size(); }
|
||||||
|
bool empty() const { return Contents.empty(); }
|
||||||
|
MachineInstr *front() const { return Contents.front(); }
|
||||||
|
MachineInstr *back() const { return Contents.back(); }
|
||||||
|
MachineInstr *&operator[](unsigned i) { return Contents[i]; }
|
||||||
|
MachineInstr *operator[](unsigned i) const { return Contents[i]; }
|
||||||
|
void pop_back() { Contents.pop_back(); }
|
||||||
|
|
||||||
|
iterator begin() { return Contents.begin(); }
|
||||||
|
iterator end() { return Contents.end(); }
|
||||||
|
const_iterator begin() const { return Contents.begin(); }
|
||||||
|
const_iterator end() const { return Contents.end(); }
|
||||||
|
|
||||||
|
template<class InIt>
|
||||||
|
void insert(iterator where, InIt first, InIt last) {
|
||||||
|
Contents.insert(where, first, last);
|
||||||
|
}
|
||||||
|
iterator erase(iterator where) { return Contents.erase(where); }
|
||||||
|
iterator erase(iterator s, iterator e) { return Contents.erase(s, e); }
|
||||||
|
|
||||||
|
|
||||||
// dropAllReferences() - This function drops all references within
|
// dropAllReferences() - This function drops all references within
|
||||||
// temporary (hidden) instructions created in implementing the original
|
// temporary (hidden) instructions created in implementing the original
|
||||||
// VM intruction. This ensures there are no remaining "uses" within
|
// VM intruction. This ensures there are no remaining "uses" within
|
||||||
@@ -46,7 +69,7 @@ public:
|
|||||||
const std::vector<Value*> &getTempValues() const { return tempVec; }
|
const std::vector<Value*> &getTempValues() const { return tempVec; }
|
||||||
std::vector<Value*> &getTempValues() { return tempVec; }
|
std::vector<Value*> &getTempValues() { return tempVec; }
|
||||||
|
|
||||||
inline MachineCodeForInstruction &addTemp(Value *tmp) {
|
MachineCodeForInstruction &addTemp(Value *tmp) {
|
||||||
tempVec.push_back(tmp);
|
tempVec.push_back(tmp);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@@ -1,18 +1,17 @@
|
|||||||
//===-- llvm/CodeGen/MachineCodeForInstruction.h -----------------*- C++ -*--=//
|
//===-- llvm/CodeGen/MachineCodeForInstruction.h ----------------*- C++ -*-===//
|
||||||
//
|
//
|
||||||
// Representation of the sequence of machine instructions created
|
// Representation of the sequence of machine instructions created for a single
|
||||||
// for a single VM instruction. Additionally records information
|
// VM instruction. Additionally records information about hidden and implicit
|
||||||
// about hidden and implicit values used by the machine instructions:
|
// values used by the machine instructions: about hidden values used by the
|
||||||
// about hidden values used by the machine instructions:
|
// machine instructions:
|
||||||
//
|
//
|
||||||
// "Temporary values" are intermediate values used in the machine
|
// "Temporary values" are intermediate values used in the machine instruction
|
||||||
// instruction sequence, but not in the VM instruction
|
// sequence, but not in the VM instruction Note that such values should be
|
||||||
// Note that such values should be treated as pure SSA values with
|
// treated as pure SSA values with no interpretation of their operands (i.e., as
|
||||||
// no interpretation of their operands (i.e., as a TmpInstruction
|
// a TmpInstruction object which actually represents such a value).
|
||||||
// object which actually represents such a value).
|
|
||||||
//
|
//
|
||||||
// (2) "Implicit uses" are values used in the VM instruction but not in
|
// (2) "Implicit uses" are values used in the VM instruction but not in
|
||||||
// the machine instruction sequence
|
// the machine instruction sequence
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
@@ -25,10 +24,9 @@ class MachineInstr;
|
|||||||
class Instruction;
|
class Instruction;
|
||||||
class Value;
|
class Value;
|
||||||
|
|
||||||
class MachineCodeForInstruction
|
class MachineCodeForInstruction : public Annotation {
|
||||||
: public Annotation, public std::vector<MachineInstr*> {
|
|
||||||
std::vector<Value*> tempVec; // used by m/c instr but not VM instr
|
std::vector<Value*> tempVec; // used by m/c instr but not VM instr
|
||||||
|
std::vector<MachineInstr*> Contents;
|
||||||
public:
|
public:
|
||||||
MachineCodeForInstruction();
|
MachineCodeForInstruction();
|
||||||
~MachineCodeForInstruction();
|
~MachineCodeForInstruction();
|
||||||
@@ -36,6 +34,31 @@ public:
|
|||||||
static MachineCodeForInstruction &get(const Instruction *I);
|
static MachineCodeForInstruction &get(const Instruction *I);
|
||||||
static void destroy(const Instruction *I);
|
static void destroy(const Instruction *I);
|
||||||
|
|
||||||
|
// Access to underlying machine instructions...
|
||||||
|
typedef std::vector<MachineInstr*>::iterator iterator;
|
||||||
|
typedef std::vector<MachineInstr*>::const_iterator const_iterator;
|
||||||
|
|
||||||
|
unsigned size() const { return Contents.size(); }
|
||||||
|
bool empty() const { return Contents.empty(); }
|
||||||
|
MachineInstr *front() const { return Contents.front(); }
|
||||||
|
MachineInstr *back() const { return Contents.back(); }
|
||||||
|
MachineInstr *&operator[](unsigned i) { return Contents[i]; }
|
||||||
|
MachineInstr *operator[](unsigned i) const { return Contents[i]; }
|
||||||
|
void pop_back() { Contents.pop_back(); }
|
||||||
|
|
||||||
|
iterator begin() { return Contents.begin(); }
|
||||||
|
iterator end() { return Contents.end(); }
|
||||||
|
const_iterator begin() const { return Contents.begin(); }
|
||||||
|
const_iterator end() const { return Contents.end(); }
|
||||||
|
|
||||||
|
template<class InIt>
|
||||||
|
void insert(iterator where, InIt first, InIt last) {
|
||||||
|
Contents.insert(where, first, last);
|
||||||
|
}
|
||||||
|
iterator erase(iterator where) { return Contents.erase(where); }
|
||||||
|
iterator erase(iterator s, iterator e) { return Contents.erase(s, e); }
|
||||||
|
|
||||||
|
|
||||||
// dropAllReferences() - This function drops all references within
|
// dropAllReferences() - This function drops all references within
|
||||||
// temporary (hidden) instructions created in implementing the original
|
// temporary (hidden) instructions created in implementing the original
|
||||||
// VM intruction. This ensures there are no remaining "uses" within
|
// VM intruction. This ensures there are no remaining "uses" within
|
||||||
@@ -46,7 +69,7 @@ public:
|
|||||||
const std::vector<Value*> &getTempValues() const { return tempVec; }
|
const std::vector<Value*> &getTempValues() const { return tempVec; }
|
||||||
std::vector<Value*> &getTempValues() { return tempVec; }
|
std::vector<Value*> &getTempValues() { return tempVec; }
|
||||||
|
|
||||||
inline MachineCodeForInstruction &addTemp(Value *tmp) {
|
MachineCodeForInstruction &addTemp(Value *tmp) {
|
||||||
tempVec.push_back(tmp);
|
tempVec.push_back(tmp);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user