mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
* Switch over to cleaner TmpInstruction model
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1648 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
06cb1b7382
commit
fb3b1ec982
@ -14,12 +14,14 @@
|
|||||||
#include "llvm/CodeGen/InstrSelectionSupport.h"
|
#include "llvm/CodeGen/InstrSelectionSupport.h"
|
||||||
#include "llvm/CodeGen/InstrSelection.h"
|
#include "llvm/CodeGen/InstrSelection.h"
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
|
#include "llvm/CodeGen/MachineCodeForInstruction.h"
|
||||||
|
#include "llvm/CodeGen/MachineCodeForMethod.h"
|
||||||
|
#include "llvm/CodeGen/InstrForest.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Target/MachineRegInfo.h"
|
#include "llvm/Target/MachineRegInfo.h"
|
||||||
#include "llvm/ConstantVals.h"
|
#include "llvm/ConstantVals.h"
|
||||||
#include "llvm/Method.h"
|
#include "llvm/Method.h"
|
||||||
#include "llvm/BasicBlock.h"
|
#include "llvm/BasicBlock.h"
|
||||||
#include "llvm/Instruction.h"
|
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/iMemory.h"
|
#include "llvm/iMemory.h"
|
||||||
using std::vector;
|
using std::vector;
|
||||||
@ -36,16 +38,16 @@ InsertCodeToLoadConstant(Value* opValue,
|
|||||||
vector<TmpInstruction*> tempVec;
|
vector<TmpInstruction*> tempVec;
|
||||||
|
|
||||||
// Create a tmp virtual register to hold the constant.
|
// Create a tmp virtual register to hold the constant.
|
||||||
TmpInstruction* tmpReg =
|
TmpInstruction* tmpReg = new TmpInstruction(opValue);
|
||||||
new TmpInstruction(TMP_INSTRUCTION_OPCODE, opValue, NULL);
|
MachineCodeForInstruction &MCFI = MachineCodeForInstruction::get(vmInstr);
|
||||||
vmInstr->getMachineInstrVec().addTempValue(tmpReg);
|
MCFI.addTemp(tmpReg);
|
||||||
|
|
||||||
target.getInstrInfo().CreateCodeToLoadConst(opValue, tmpReg,
|
target.getInstrInfo().CreateCodeToLoadConst(opValue, tmpReg,
|
||||||
loadConstVec, tempVec);
|
loadConstVec, tempVec);
|
||||||
|
|
||||||
// Register the new tmp values created for this m/c instruction sequence
|
// Register the new tmp values created for this m/c instruction sequence
|
||||||
for (unsigned i=0; i < tempVec.size(); i++)
|
for (unsigned i=0; i < tempVec.size(); i++)
|
||||||
vmInstr->getMachineInstrVec().addTempValue(tempVec[i]);
|
MCFI.addTemp(tempVec[i]);
|
||||||
|
|
||||||
// Record the mapping from the tmp VM instruction to machine instruction.
|
// Record the mapping from the tmp VM instruction to machine instruction.
|
||||||
// Do this for all machine instructions that were not mapped to any
|
// Do this for all machine instructions that were not mapped to any
|
||||||
|
@ -14,12 +14,14 @@
|
|||||||
#include "llvm/CodeGen/InstrSelectionSupport.h"
|
#include "llvm/CodeGen/InstrSelectionSupport.h"
|
||||||
#include "llvm/CodeGen/InstrSelection.h"
|
#include "llvm/CodeGen/InstrSelection.h"
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
|
#include "llvm/CodeGen/MachineCodeForInstruction.h"
|
||||||
|
#include "llvm/CodeGen/MachineCodeForMethod.h"
|
||||||
|
#include "llvm/CodeGen/InstrForest.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Target/MachineRegInfo.h"
|
#include "llvm/Target/MachineRegInfo.h"
|
||||||
#include "llvm/ConstantVals.h"
|
#include "llvm/ConstantVals.h"
|
||||||
#include "llvm/Method.h"
|
#include "llvm/Method.h"
|
||||||
#include "llvm/BasicBlock.h"
|
#include "llvm/BasicBlock.h"
|
||||||
#include "llvm/Instruction.h"
|
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/iMemory.h"
|
#include "llvm/iMemory.h"
|
||||||
using std::vector;
|
using std::vector;
|
||||||
@ -36,16 +38,16 @@ InsertCodeToLoadConstant(Value* opValue,
|
|||||||
vector<TmpInstruction*> tempVec;
|
vector<TmpInstruction*> tempVec;
|
||||||
|
|
||||||
// Create a tmp virtual register to hold the constant.
|
// Create a tmp virtual register to hold the constant.
|
||||||
TmpInstruction* tmpReg =
|
TmpInstruction* tmpReg = new TmpInstruction(opValue);
|
||||||
new TmpInstruction(TMP_INSTRUCTION_OPCODE, opValue, NULL);
|
MachineCodeForInstruction &MCFI = MachineCodeForInstruction::get(vmInstr);
|
||||||
vmInstr->getMachineInstrVec().addTempValue(tmpReg);
|
MCFI.addTemp(tmpReg);
|
||||||
|
|
||||||
target.getInstrInfo().CreateCodeToLoadConst(opValue, tmpReg,
|
target.getInstrInfo().CreateCodeToLoadConst(opValue, tmpReg,
|
||||||
loadConstVec, tempVec);
|
loadConstVec, tempVec);
|
||||||
|
|
||||||
// Register the new tmp values created for this m/c instruction sequence
|
// Register the new tmp values created for this m/c instruction sequence
|
||||||
for (unsigned i=0; i < tempVec.size(); i++)
|
for (unsigned i=0; i < tempVec.size(); i++)
|
||||||
vmInstr->getMachineInstrVec().addTempValue(tempVec[i]);
|
MCFI.addTemp(tempVec[i]);
|
||||||
|
|
||||||
// Record the mapping from the tmp VM instruction to machine instruction.
|
// Record the mapping from the tmp VM instruction to machine instruction.
|
||||||
// Do this for all machine instructions that were not mapped to any
|
// Do this for all machine instructions that were not mapped to any
|
||||||
|
Loading…
x
Reference in New Issue
Block a user