mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
Move some more code out of SelectionDAGBuild.cpp and into
FunctionLoweringInfo.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7776452a18
commit
66336edf82
@ -55,6 +55,7 @@
|
|||||||
#include "llvm/Target/TargetLowering.h"
|
#include "llvm/Target/TargetLowering.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "SelectionDAGBuild.h"
|
#include "SelectionDAGBuild.h"
|
||||||
|
#include "FunctionLoweringInfo.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
unsigned FastISel::getRegForValue(Value *V) {
|
unsigned FastISel::getRegForValue(Value *V) {
|
||||||
|
@ -276,3 +276,68 @@ unsigned FunctionLoweringInfo::CreateRegForValue(const Value *V) {
|
|||||||
}
|
}
|
||||||
return FirstReg;
|
return FirstReg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
|
||||||
|
GlobalVariable *llvm::ExtractTypeInfo(Value *V) {
|
||||||
|
V = V->stripPointerCasts();
|
||||||
|
GlobalVariable *GV = dyn_cast<GlobalVariable>(V);
|
||||||
|
assert ((GV || isa<ConstantPointerNull>(V)) &&
|
||||||
|
"TypeInfo must be a global variable or NULL");
|
||||||
|
return GV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// AddCatchInfo - Extract the personality and type infos from an eh.selector
|
||||||
|
/// call, and add them to the specified machine basic block.
|
||||||
|
void llvm::AddCatchInfo(CallInst &I, MachineModuleInfo *MMI,
|
||||||
|
MachineBasicBlock *MBB) {
|
||||||
|
// Inform the MachineModuleInfo of the personality for this landing pad.
|
||||||
|
ConstantExpr *CE = cast<ConstantExpr>(I.getOperand(2));
|
||||||
|
assert(CE->getOpcode() == Instruction::BitCast &&
|
||||||
|
isa<Function>(CE->getOperand(0)) &&
|
||||||
|
"Personality should be a function");
|
||||||
|
MMI->addPersonality(MBB, cast<Function>(CE->getOperand(0)));
|
||||||
|
|
||||||
|
// Gather all the type infos for this landing pad and pass them along to
|
||||||
|
// MachineModuleInfo.
|
||||||
|
std::vector<GlobalVariable *> TyInfo;
|
||||||
|
unsigned N = I.getNumOperands();
|
||||||
|
|
||||||
|
for (unsigned i = N - 1; i > 2; --i) {
|
||||||
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(i))) {
|
||||||
|
unsigned FilterLength = CI->getZExtValue();
|
||||||
|
unsigned FirstCatch = i + FilterLength + !FilterLength;
|
||||||
|
assert (FirstCatch <= N && "Invalid filter length");
|
||||||
|
|
||||||
|
if (FirstCatch < N) {
|
||||||
|
TyInfo.reserve(N - FirstCatch);
|
||||||
|
for (unsigned j = FirstCatch; j < N; ++j)
|
||||||
|
TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
|
||||||
|
MMI->addCatchTypeInfo(MBB, TyInfo);
|
||||||
|
TyInfo.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!FilterLength) {
|
||||||
|
// Cleanup.
|
||||||
|
MMI->addCleanup(MBB);
|
||||||
|
} else {
|
||||||
|
// Filter.
|
||||||
|
TyInfo.reserve(FilterLength - 1);
|
||||||
|
for (unsigned j = i + 1; j < FirstCatch; ++j)
|
||||||
|
TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
|
||||||
|
MMI->addFilterTypeInfo(MBB, TyInfo);
|
||||||
|
TyInfo.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
N = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (N > 3) {
|
||||||
|
TyInfo.reserve(N - 3);
|
||||||
|
for (unsigned j = 3; j < N; ++j)
|
||||||
|
TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
|
||||||
|
MMI->addCatchTypeInfo(MBB, TyInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,10 +27,13 @@ namespace llvm {
|
|||||||
|
|
||||||
class AllocaInst;
|
class AllocaInst;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
|
class CallInst;
|
||||||
class Function;
|
class Function;
|
||||||
|
class GlobalVariable;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
class MachineBasicBlock;
|
class MachineBasicBlock;
|
||||||
class MachineFunction;
|
class MachineFunction;
|
||||||
|
class MachineModuleInfo;
|
||||||
class MachineRegisterInfo;
|
class MachineRegisterInfo;
|
||||||
class TargetLowering;
|
class TargetLowering;
|
||||||
class Value;
|
class Value;
|
||||||
@ -132,6 +135,13 @@ void ComputeValueVTs(const TargetLowering &TLI, const Type *Ty,
|
|||||||
SmallVectorImpl<uint64_t> *Offsets = 0,
|
SmallVectorImpl<uint64_t> *Offsets = 0,
|
||||||
uint64_t StartingOffset = 0);
|
uint64_t StartingOffset = 0);
|
||||||
|
|
||||||
|
/// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
|
||||||
|
GlobalVariable *ExtractTypeInfo(Value *V);
|
||||||
|
|
||||||
|
/// AddCatchInfo - Extract the personality and type infos from an eh.selector
|
||||||
|
/// call, and add them to the specified machine basic block.
|
||||||
|
void AddCatchInfo(CallInst &I, MachineModuleInfo *MMI, MachineBasicBlock *MBB);
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2790,73 +2790,6 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
|
|
||||||
static GlobalVariable *ExtractTypeInfo(Value *V) {
|
|
||||||
V = V->stripPointerCasts();
|
|
||||||
GlobalVariable *GV = dyn_cast<GlobalVariable>(V);
|
|
||||||
assert ((GV || isa<ConstantPointerNull>(V)) &&
|
|
||||||
"TypeInfo must be a global variable or NULL");
|
|
||||||
return GV;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace llvm {
|
|
||||||
|
|
||||||
/// AddCatchInfo - Extract the personality and type infos from an eh.selector
|
|
||||||
/// call, and add them to the specified machine basic block.
|
|
||||||
void AddCatchInfo(CallInst &I, MachineModuleInfo *MMI,
|
|
||||||
MachineBasicBlock *MBB) {
|
|
||||||
// Inform the MachineModuleInfo of the personality for this landing pad.
|
|
||||||
ConstantExpr *CE = cast<ConstantExpr>(I.getOperand(2));
|
|
||||||
assert(CE->getOpcode() == Instruction::BitCast &&
|
|
||||||
isa<Function>(CE->getOperand(0)) &&
|
|
||||||
"Personality should be a function");
|
|
||||||
MMI->addPersonality(MBB, cast<Function>(CE->getOperand(0)));
|
|
||||||
|
|
||||||
// Gather all the type infos for this landing pad and pass them along to
|
|
||||||
// MachineModuleInfo.
|
|
||||||
std::vector<GlobalVariable *> TyInfo;
|
|
||||||
unsigned N = I.getNumOperands();
|
|
||||||
|
|
||||||
for (unsigned i = N - 1; i > 2; --i) {
|
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(i))) {
|
|
||||||
unsigned FilterLength = CI->getZExtValue();
|
|
||||||
unsigned FirstCatch = i + FilterLength + !FilterLength;
|
|
||||||
assert (FirstCatch <= N && "Invalid filter length");
|
|
||||||
|
|
||||||
if (FirstCatch < N) {
|
|
||||||
TyInfo.reserve(N - FirstCatch);
|
|
||||||
for (unsigned j = FirstCatch; j < N; ++j)
|
|
||||||
TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
|
|
||||||
MMI->addCatchTypeInfo(MBB, TyInfo);
|
|
||||||
TyInfo.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!FilterLength) {
|
|
||||||
// Cleanup.
|
|
||||||
MMI->addCleanup(MBB);
|
|
||||||
} else {
|
|
||||||
// Filter.
|
|
||||||
TyInfo.reserve(FilterLength - 1);
|
|
||||||
for (unsigned j = i + 1; j < FirstCatch; ++j)
|
|
||||||
TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
|
|
||||||
MMI->addFilterTypeInfo(MBB, TyInfo);
|
|
||||||
TyInfo.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
N = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (N > 3) {
|
|
||||||
TyInfo.reserve(N - 3);
|
|
||||||
for (unsigned j = 3; j < N; ++j)
|
|
||||||
TyInfo.push_back(ExtractTypeInfo(I.getOperand(j)));
|
|
||||||
MMI->addCatchTypeInfo(MBB, TyInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// GetSignificand - Get the significand and build it into a floating-point
|
/// GetSignificand - Get the significand and build it into a floating-point
|
||||||
/// number with exponent of 1:
|
/// number with exponent of 1:
|
||||||
///
|
///
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "llvm/CodeGen/ValueTypes.h"
|
#include "llvm/CodeGen/ValueTypes.h"
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
@ -59,7 +58,6 @@ class LoadInst;
|
|||||||
class MachineBasicBlock;
|
class MachineBasicBlock;
|
||||||
class MachineFunction;
|
class MachineFunction;
|
||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
class MachineModuleInfo;
|
|
||||||
class MachineRegisterInfo;
|
class MachineRegisterInfo;
|
||||||
class PHINode;
|
class PHINode;
|
||||||
class PtrToIntInst;
|
class PtrToIntInst;
|
||||||
@ -484,11 +482,6 @@ private:
|
|||||||
const char *implVisitAluOverflow(CallInst &I, ISD::NodeType Op);
|
const char *implVisitAluOverflow(CallInst &I, ISD::NodeType Op);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// AddCatchInfo - Extract the personality and type infos from an eh.selector
|
|
||||||
/// call, and add them to the specified machine basic block.
|
|
||||||
void AddCatchInfo(CallInst &I, MachineModuleInfo *MMI,
|
|
||||||
MachineBasicBlock *MBB);
|
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user