mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
Allow targets to have fine grained control over which types various ops get
promoted to, if they desire. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27389 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6e96740c6c
commit
e6bfffbae2
@ -24,9 +24,7 @@
|
|||||||
|
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||||
#include "llvm/CodeGen/ValueTypes.h"
|
#include <map>
|
||||||
#include "llvm/Support/DataTypes.h"
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class Value;
|
class Value;
|
||||||
@ -172,7 +170,7 @@ public:
|
|||||||
MVT::ValueType getTypeToTransformTo(MVT::ValueType VT) const {
|
MVT::ValueType getTypeToTransformTo(MVT::ValueType VT) const {
|
||||||
return TransformToType[VT];
|
return TransformToType[VT];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getPackedTypeBreakdown - Packed types are broken down into some number of
|
/// getPackedTypeBreakdown - Packed types are broken down into some number of
|
||||||
/// legal scalar types. For example, <8 x float> maps to 2 MVT::v2f32 values
|
/// legal scalar types. For example, <8 x float> maps to 2 MVT::v2f32 values
|
||||||
/// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack.
|
/// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack.
|
||||||
@ -223,6 +221,16 @@ public:
|
|||||||
MVT::ValueType getTypeToPromoteTo(unsigned Op, MVT::ValueType VT) const {
|
MVT::ValueType getTypeToPromoteTo(unsigned Op, MVT::ValueType VT) const {
|
||||||
assert(getOperationAction(Op, VT) == Promote &&
|
assert(getOperationAction(Op, VT) == Promote &&
|
||||||
"This operation isn't promoted!");
|
"This operation isn't promoted!");
|
||||||
|
|
||||||
|
// See if this has an explicit type specified.
|
||||||
|
std::map<std::pair<unsigned, MVT::ValueType>,
|
||||||
|
MVT::ValueType>::const_iterator PTTI =
|
||||||
|
PromoteToType.find(std::make_pair(Op, VT));
|
||||||
|
if (PTTI != PromoteToType.end()) return PTTI->second;
|
||||||
|
|
||||||
|
assert((MVT::isInteger(VT) || MVT::isFloatingPoint(VT)) &&
|
||||||
|
"Cannot autopromote this type, add it with AddPromotedToType.");
|
||||||
|
|
||||||
MVT::ValueType NVT = VT;
|
MVT::ValueType NVT = VT;
|
||||||
do {
|
do {
|
||||||
NVT = (MVT::ValueType)(NVT+1);
|
NVT = (MVT::ValueType)(NVT+1);
|
||||||
@ -484,6 +492,15 @@ protected:
|
|||||||
OpActions[Op] &= ~(3ULL << VT*2);
|
OpActions[Op] &= ~(3ULL << VT*2);
|
||||||
OpActions[Op] |= (uint64_t)Action << VT*2;
|
OpActions[Op] |= (uint64_t)Action << VT*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// AddPromotedToType - If Opc/OrigVT is specified as being promoted, the
|
||||||
|
/// promotion code defaults to trying a larger integer/fp until it can find
|
||||||
|
/// one that works. If that default is insufficient, this method can be used
|
||||||
|
/// by the target to override the default.
|
||||||
|
void AddPromotedToType(unsigned Opc, MVT::ValueType OrigVT,
|
||||||
|
MVT::ValueType DestVT) {
|
||||||
|
PromoteToType[std::make_pair(Opc, OrigVT)] = DestVT;
|
||||||
|
}
|
||||||
|
|
||||||
/// addLegalFPImmediate - Indicate that this target can instruction select
|
/// addLegalFPImmediate - Indicate that this target can instruction select
|
||||||
/// the specified FP immediate natively.
|
/// the specified FP immediate natively.
|
||||||
@ -629,7 +646,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
std::vector<unsigned> LegalAddressScales;
|
std::vector<unsigned> LegalAddressScales;
|
||||||
|
|
||||||
private:
|
|
||||||
TargetMachine &TM;
|
TargetMachine &TM;
|
||||||
const TargetData &TD;
|
const TargetData &TD;
|
||||||
|
|
||||||
@ -715,6 +731,14 @@ private:
|
|||||||
/// which sets a bit in this array.
|
/// which sets a bit in this array.
|
||||||
unsigned char TargetDAGCombineArray[156/(sizeof(unsigned char)*8)];
|
unsigned char TargetDAGCombineArray[156/(sizeof(unsigned char)*8)];
|
||||||
|
|
||||||
|
/// PromoteToType - For operations that must be promoted to a specific type,
|
||||||
|
/// this holds the destination type. This map should be sparse, so don't hold
|
||||||
|
/// it as an array.
|
||||||
|
///
|
||||||
|
/// Targets add entries to this map with AddPromotedToType(..), clients access
|
||||||
|
/// this with getTypeToPromoteTo(..).
|
||||||
|
std::map<std::pair<unsigned, MVT::ValueType>, MVT::ValueType> PromoteToType;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// When lowering %llvm.memset this field specifies the maximum number of
|
/// When lowering %llvm.memset this field specifies the maximum number of
|
||||||
/// store operations that may be substituted for the call to memset. Targets
|
/// store operations that may be substituted for the call to memset. Targets
|
||||||
|
Loading…
Reference in New Issue
Block a user