mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-03 11:24:18 +00:00
* Don't access TargetData directly
* Changes because frame info is not in MachineFunction directly anymore git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5171 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -14,6 +14,7 @@
|
|||||||
#include "SparcInternals.h"
|
#include "SparcInternals.h"
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
|
#include "llvm/CodeGen/MachineFunctionInfo.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
@ -193,17 +194,17 @@ public:
|
|||||||
{ // generate a symbolic expression for the byte address
|
{ // generate a symbolic expression for the byte address
|
||||||
const Value* ptrVal = CE->getOperand(0);
|
const Value* ptrVal = CE->getOperand(0);
|
||||||
std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
|
std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
|
||||||
|
const TargetData &TD = target.getTargetData();
|
||||||
S += "(" + valToExprString(ptrVal, target) + ") + ("
|
S += "(" + valToExprString(ptrVal, target) + ") + ("
|
||||||
+ utostr(target.DataLayout.getIndexedOffset(ptrVal->getType(),idxVec))
|
+ utostr(TD.getIndexedOffset(ptrVal->getType(),idxVec)) + ")";
|
||||||
+ ")";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Instruction::Cast:
|
case Instruction::Cast:
|
||||||
// Support only non-converting casts for now, i.e., a no-op.
|
// Support only non-converting casts for now, i.e., a no-op.
|
||||||
// This assertion is not a complete check.
|
// This assertion is not a complete check.
|
||||||
assert(target.DataLayout.getTypeSize(CE->getType()) ==
|
assert(target.getTargetData().getTypeSize(CE->getType()) ==
|
||||||
target.DataLayout.getTypeSize(CE->getOperand(0)->getType()));
|
target.getTargetData().getTypeSize(CE->getOperand(0)->getType()));
|
||||||
S += "(" + valToExprString(CE->getOperand(0), target) + ")";
|
S += "(" + valToExprString(CE->getOperand(0), target) + ")";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -803,7 +804,7 @@ SparcModuleAsmPrinter::printConstantValueOnly(const Constant* CV,
|
|||||||
else if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV))
|
else if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV))
|
||||||
{ // Print the fields in successive locations. Pad to align if needed!
|
{ // Print the fields in successive locations. Pad to align if needed!
|
||||||
const StructLayout *cvsLayout =
|
const StructLayout *cvsLayout =
|
||||||
Target.DataLayout.getStructLayout(CVS->getType());
|
Target.getTargetData().getStructLayout(CVS->getType());
|
||||||
const std::vector<Use>& constValues = CVS->getValues();
|
const std::vector<Use>& constValues = CVS->getValues();
|
||||||
unsigned sizeSoFar = 0;
|
unsigned sizeSoFar = 0;
|
||||||
for (unsigned i=0, N = constValues.size(); i < N; i++)
|
for (unsigned i=0, N = constValues.size(); i < N; i++)
|
||||||
@ -811,7 +812,8 @@ SparcModuleAsmPrinter::printConstantValueOnly(const Constant* CV,
|
|||||||
const Constant* field = cast<Constant>(constValues[i].get());
|
const Constant* field = cast<Constant>(constValues[i].get());
|
||||||
|
|
||||||
// Check if padding is needed and insert one or more 0s.
|
// Check if padding is needed and insert one or more 0s.
|
||||||
unsigned fieldSize = Target.DataLayout.getTypeSize(field->getType());
|
unsigned fieldSize =
|
||||||
|
Target.getTargetData().getTypeSize(field->getType());
|
||||||
int padSize = ((i == N-1? cvsLayout->StructSize
|
int padSize = ((i == N-1? cvsLayout->StructSize
|
||||||
: cvsLayout->MemberOffsets[i+1])
|
: cvsLayout->MemberOffsets[i+1])
|
||||||
- cvsLayout->MemberOffsets[i]) - fieldSize;
|
- cvsLayout->MemberOffsets[i]) - fieldSize;
|
||||||
@ -864,7 +866,7 @@ void SparcModuleAsmPrinter::FoldConstants(const Module &M,
|
|||||||
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
|
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
|
||||||
if (!I->isExternal()) {
|
if (!I->isExternal()) {
|
||||||
const hash_set<const Constant*> &pool =
|
const hash_set<const Constant*> &pool =
|
||||||
MachineFunction::get(I).getConstantPoolValues();
|
MachineFunction::get(I).getInfo()->getConstantPoolValues();
|
||||||
MC.insert(pool.begin(), pool.end());
|
MC.insert(pool.begin(), pool.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user