mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193765 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d7ef09bc9a
commit
cf940ceff7
@ -897,7 +897,7 @@ example:
|
|||||||
``minsize``
|
``minsize``
|
||||||
This attribute suggests that optimization passes and code generator
|
This attribute suggests that optimization passes and code generator
|
||||||
passes make choices that keep the code size of this function as small
|
passes make choices that keep the code size of this function as small
|
||||||
as possible and perform optimizations that may sacrifice runtime
|
as possible and perform optimizations that may sacrifice runtime
|
||||||
performance in order to minimize the size of the generated code.
|
performance in order to minimize the size of the generated code.
|
||||||
``naked``
|
``naked``
|
||||||
This attribute disables prologue / epilogue emission for the
|
This attribute disables prologue / epilogue emission for the
|
||||||
@ -942,12 +942,12 @@ example:
|
|||||||
unwind, its runtime behavior is undefined.
|
unwind, its runtime behavior is undefined.
|
||||||
``optnone``
|
``optnone``
|
||||||
This function attribute indicates that the function is not optimized
|
This function attribute indicates that the function is not optimized
|
||||||
by any optimization or code generator passes with the
|
by any optimization or code generator passes with the
|
||||||
exception of interprocedural optimization passes.
|
exception of interprocedural optimization passes.
|
||||||
This attribute cannot be used together with the ``alwaysinline``
|
This attribute cannot be used together with the ``alwaysinline``
|
||||||
attribute; this attribute is also incompatible
|
attribute; this attribute is also incompatible
|
||||||
with the ``minsize`` attribute and the ``optsize`` attribute.
|
with the ``minsize`` attribute and the ``optsize`` attribute.
|
||||||
|
|
||||||
The inliner should never inline this function in any situation.
|
The inliner should never inline this function in any situation.
|
||||||
Only functions with the ``alwaysinline`` attribute are valid
|
Only functions with the ``alwaysinline`` attribute are valid
|
||||||
candidates for inlining inside the body of this function.
|
candidates for inlining inside the body of this function.
|
||||||
@ -965,7 +965,7 @@ example:
|
|||||||
(including ``byval`` arguments) and never changes any state visible
|
(including ``byval`` arguments) and never changes any state visible
|
||||||
to callers. This means that it cannot unwind exceptions by calling
|
to callers. This means that it cannot unwind exceptions by calling
|
||||||
the ``C++`` exception throwing methods.
|
the ``C++`` exception throwing methods.
|
||||||
|
|
||||||
On an argument, this attribute indicates that the function does not
|
On an argument, this attribute indicates that the function does not
|
||||||
dereference that pointer argument, even though it may read or write the
|
dereference that pointer argument, even though it may read or write the
|
||||||
memory that the pointer points to if accessed through other pointers.
|
memory that the pointer points to if accessed through other pointers.
|
||||||
@ -979,7 +979,7 @@ example:
|
|||||||
called with the same set of arguments and global state. It cannot
|
called with the same set of arguments and global state. It cannot
|
||||||
unwind an exception by calling the ``C++`` exception throwing
|
unwind an exception by calling the ``C++`` exception throwing
|
||||||
methods.
|
methods.
|
||||||
|
|
||||||
On an argument, this attribute indicates that the function does not write
|
On an argument, this attribute indicates that the function does not write
|
||||||
through this pointer argument, even though it may write to the memory that
|
through this pointer argument, even though it may write to the memory that
|
||||||
the pointer points to.
|
the pointer points to.
|
||||||
|
@ -84,7 +84,7 @@ class SelectionDAGBuilder {
|
|||||||
const Instruction *CurInst;
|
const Instruction *CurInst;
|
||||||
|
|
||||||
DenseMap<const Value*, SDValue> NodeMap;
|
DenseMap<const Value*, SDValue> NodeMap;
|
||||||
|
|
||||||
/// UnusedArgNodeMap - Maps argument value for unused arguments. This is used
|
/// UnusedArgNodeMap - Maps argument value for unused arguments. This is used
|
||||||
/// to preserve debug information for incoming arguments.
|
/// to preserve debug information for incoming arguments.
|
||||||
DenseMap<const Value*, SDValue> UnusedArgNodeMap;
|
DenseMap<const Value*, SDValue> UnusedArgNodeMap;
|
||||||
@ -235,7 +235,7 @@ private:
|
|||||||
struct JumpTable {
|
struct JumpTable {
|
||||||
JumpTable(unsigned R, unsigned J, MachineBasicBlock *M,
|
JumpTable(unsigned R, unsigned J, MachineBasicBlock *M,
|
||||||
MachineBasicBlock *D): Reg(R), JTI(J), MBB(M), Default(D) {}
|
MachineBasicBlock *D): Reg(R), JTI(J), MBB(M), Default(D) {}
|
||||||
|
|
||||||
/// Reg - the virtual register containing the index of the jump table entry
|
/// Reg - the virtual register containing the index of the jump table entry
|
||||||
//. to jump to.
|
//. to jump to.
|
||||||
unsigned Reg;
|
unsigned Reg;
|
||||||
@ -514,9 +514,9 @@ public:
|
|||||||
FunctionLoweringInfo &FuncInfo;
|
FunctionLoweringInfo &FuncInfo;
|
||||||
|
|
||||||
/// OptLevel - What optimization level we're generating code for.
|
/// OptLevel - What optimization level we're generating code for.
|
||||||
///
|
///
|
||||||
CodeGenOpt::Level OptLevel;
|
CodeGenOpt::Level OptLevel;
|
||||||
|
|
||||||
/// GFI - Garbage collection metadata for the function.
|
/// GFI - Garbage collection metadata for the function.
|
||||||
GCFunctionInfo *GFI;
|
GCFunctionInfo *GFI;
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ public:
|
|||||||
assert(N.getNode() == 0 && "Already set a value for this node!");
|
assert(N.getNode() == 0 && "Already set a value for this node!");
|
||||||
N = NewN;
|
N = NewN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUnusedArgValue(const Value *V, SDValue NewN) {
|
void setUnusedArgValue(const Value *V, SDValue NewN) {
|
||||||
SDValue &N = UnusedArgNodeMap[V];
|
SDValue &N = UnusedArgNodeMap[V];
|
||||||
assert(N.getNode() == 0 && "Already set a value for this node!");
|
assert(N.getNode() == 0 && "Already set a value for this node!");
|
||||||
@ -673,7 +673,7 @@ public:
|
|||||||
void visitJumpTable(JumpTable &JT);
|
void visitJumpTable(JumpTable &JT);
|
||||||
void visitJumpTableHeader(JumpTable &JT, JumpTableHeader &JTH,
|
void visitJumpTableHeader(JumpTable &JT, JumpTableHeader &JTH,
|
||||||
MachineBasicBlock *SwitchBB);
|
MachineBasicBlock *SwitchBB);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// These all get lowered before this pass.
|
// These all get lowered before this pass.
|
||||||
void visitInvoke(const InvokeInst &I);
|
void visitInvoke(const InvokeInst &I);
|
||||||
@ -766,7 +766,7 @@ private:
|
|||||||
void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
|
void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
|
||||||
|
|
||||||
/// EmitFuncArgumentDbgValue - If V is an function argument then create
|
/// EmitFuncArgumentDbgValue - If V is an function argument then create
|
||||||
/// corresponding DBG_VALUE machine instruction for it now. At the end of
|
/// corresponding DBG_VALUE machine instruction for it now. At the end of
|
||||||
/// instruction selection, they will be inserted to the entry BB.
|
/// instruction selection, they will be inserted to the entry BB.
|
||||||
bool EmitFuncArgumentDbgValue(const Value *V, MDNode *Variable,
|
bool EmitFuncArgumentDbgValue(const Value *V, MDNode *Variable,
|
||||||
int64_t Offset, const SDValue &N);
|
int64_t Offset, const SDValue &N);
|
||||||
|
@ -333,21 +333,21 @@ void X86AsmPrinter::printIntelMemReference(const MachineInstr *MI, unsigned Op,
|
|||||||
const MachineOperand &IndexReg = MI->getOperand(Op+2);
|
const MachineOperand &IndexReg = MI->getOperand(Op+2);
|
||||||
const MachineOperand &DispSpec = MI->getOperand(Op+3);
|
const MachineOperand &DispSpec = MI->getOperand(Op+3);
|
||||||
const MachineOperand &SegReg = MI->getOperand(Op+4);
|
const MachineOperand &SegReg = MI->getOperand(Op+4);
|
||||||
|
|
||||||
// If this has a segment register, print it.
|
// If this has a segment register, print it.
|
||||||
if (SegReg.getReg()) {
|
if (SegReg.getReg()) {
|
||||||
printOperand(MI, Op+4, O, Modifier, AsmVariant);
|
printOperand(MI, Op+4, O, Modifier, AsmVariant);
|
||||||
O << ':';
|
O << ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
O << '[';
|
O << '[';
|
||||||
|
|
||||||
bool NeedPlus = false;
|
bool NeedPlus = false;
|
||||||
if (BaseReg.getReg()) {
|
if (BaseReg.getReg()) {
|
||||||
printOperand(MI, Op, O, Modifier, AsmVariant);
|
printOperand(MI, Op, O, Modifier, AsmVariant);
|
||||||
NeedPlus = true;
|
NeedPlus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IndexReg.getReg()) {
|
if (IndexReg.getReg()) {
|
||||||
if (NeedPlus) O << " + ";
|
if (NeedPlus) O << " + ";
|
||||||
if (ScaleVal != 1)
|
if (ScaleVal != 1)
|
||||||
|
@ -279,10 +279,10 @@ def CC_X86_Win64_C : CallingConv<[
|
|||||||
// The first 4 integer arguments are passed in integer registers.
|
// The first 4 integer arguments are passed in integer registers.
|
||||||
CCIfType<[i32], CCAssignToRegWithShadow<[ECX , EDX , R8D , R9D ],
|
CCIfType<[i32], CCAssignToRegWithShadow<[ECX , EDX , R8D , R9D ],
|
||||||
[XMM0, XMM1, XMM2, XMM3]>>,
|
[XMM0, XMM1, XMM2, XMM3]>>,
|
||||||
|
|
||||||
// Do not pass the sret argument in RCX, the Win64 thiscall calling
|
// Do not pass the sret argument in RCX, the Win64 thiscall calling
|
||||||
// convention requires "this" to be passed in RCX.
|
// convention requires "this" to be passed in RCX.
|
||||||
CCIfCC<"CallingConv::X86_ThisCall",
|
CCIfCC<"CallingConv::X86_ThisCall",
|
||||||
CCIfSRet<CCIfType<[i64], CCAssignToRegWithShadow<[RDX , R8 , R9 ],
|
CCIfSRet<CCIfType<[i64], CCAssignToRegWithShadow<[RDX , R8 , R9 ],
|
||||||
[XMM1, XMM2, XMM3]>>>>,
|
[XMM1, XMM2, XMM3]>>>>,
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ def CC_X86_32_Common : CallingConv<[
|
|||||||
// Integer/Float values get stored in stack slots that are 4 bytes in
|
// Integer/Float values get stored in stack slots that are 4 bytes in
|
||||||
// size and 4-byte aligned.
|
// size and 4-byte aligned.
|
||||||
CCIfType<[i32, f32], CCAssignToStack<4, 4>>,
|
CCIfType<[i32, f32], CCAssignToStack<4, 4>>,
|
||||||
|
|
||||||
// Doubles get 8-byte slots that are 4-byte aligned.
|
// Doubles get 8-byte slots that are 4-byte aligned.
|
||||||
CCIfType<[f64], CCAssignToStack<8, 4>>,
|
CCIfType<[f64], CCAssignToStack<8, 4>>,
|
||||||
|
|
||||||
@ -558,11 +558,11 @@ def CSR_MostRegs_64 : CalleeSavedRegs<(add RBX, RCX, RDX, RSI, RDI, R8, R9, R10,
|
|||||||
|
|
||||||
// Standard C + YMM6-15
|
// Standard C + YMM6-15
|
||||||
def CSR_Win64_Intel_OCL_BI_AVX : CalleeSavedRegs<(add RBX, RBP, RDI, RSI, R12,
|
def CSR_Win64_Intel_OCL_BI_AVX : CalleeSavedRegs<(add RBX, RBP, RDI, RSI, R12,
|
||||||
R13, R14, R15,
|
R13, R14, R15,
|
||||||
(sequence "YMM%u", 6, 15))>;
|
(sequence "YMM%u", 6, 15))>;
|
||||||
|
|
||||||
def CSR_Win64_Intel_OCL_BI_AVX512 : CalleeSavedRegs<(add RBX, RBP, RDI, RSI,
|
def CSR_Win64_Intel_OCL_BI_AVX512 : CalleeSavedRegs<(add RBX, RBP, RDI, RSI,
|
||||||
R12, R13, R14, R15,
|
R12, R13, R14, R15,
|
||||||
(sequence "ZMM%u", 6, 21),
|
(sequence "ZMM%u", 6, 21),
|
||||||
K4, K5, K6, K7)>;
|
K4, K5, K6, K7)>;
|
||||||
//Standard C + XMM 8-15
|
//Standard C + XMM 8-15
|
||||||
|
@ -84,10 +84,10 @@ void IntrinsicEmitter::run(raw_ostream &OS) {
|
|||||||
|
|
||||||
// Emit the function name recognizer.
|
// Emit the function name recognizer.
|
||||||
EmitFnNameRecognizer(Ints, OS);
|
EmitFnNameRecognizer(Ints, OS);
|
||||||
|
|
||||||
// Emit the intrinsic declaration generator.
|
// Emit the intrinsic declaration generator.
|
||||||
EmitGenerator(Ints, OS);
|
EmitGenerator(Ints, OS);
|
||||||
|
|
||||||
// Emit the intrinsic parameter attributes.
|
// Emit the intrinsic parameter attributes.
|
||||||
EmitAttributes(Ints, OS);
|
EmitAttributes(Ints, OS);
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
|
||||||
OS << " " << Ints[i].EnumName;
|
OS << " " << Ints[i].EnumName;
|
||||||
OS << ((i != e-1) ? ", " : " ");
|
OS << ((i != e-1) ? ", " : " ");
|
||||||
OS << std::string(40-Ints[i].EnumName.size(), ' ')
|
OS << std::string(40-Ints[i].EnumName.size(), ' ')
|
||||||
<< "// " << Ints[i].Name << "\n";
|
<< "// " << Ints[i].Name << "\n";
|
||||||
}
|
}
|
||||||
OS << "#endif\n\n";
|
OS << "#endif\n\n";
|
||||||
@ -146,13 +146,13 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void IntrinsicEmitter::
|
void IntrinsicEmitter::
|
||||||
EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints,
|
EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
// Build a 'first character of function name' -> intrinsic # mapping.
|
// Build a 'first character of function name' -> intrinsic # mapping.
|
||||||
std::map<char, std::vector<unsigned> > IntMapping;
|
std::map<char, std::vector<unsigned> > IntMapping;
|
||||||
for (unsigned i = 0, e = Ints.size(); i != e; ++i)
|
for (unsigned i = 0, e = Ints.size(); i != e; ++i)
|
||||||
IntMapping[Ints[i].Name[5]].push_back(i);
|
IntMapping[Ints[i].Name[5]].push_back(i);
|
||||||
|
|
||||||
OS << "// Function name -> enum value recognizer code.\n";
|
OS << "// Function name -> enum value recognizer code.\n";
|
||||||
OS << "#ifdef GET_FUNCTION_RECOGNIZER\n";
|
OS << "#ifdef GET_FUNCTION_RECOGNIZER\n";
|
||||||
OS << " StringRef NameR(Name+6, Len-6); // Skip over 'llvm.'\n";
|
OS << " StringRef NameR(Name+6, Len-6); // Skip over 'llvm.'\n";
|
||||||
@ -171,7 +171,7 @@ EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
// Emit all the overloaded intrinsics first, build a table of the
|
// Emit all the overloaded intrinsics first, build a table of the
|
||||||
// non-overloaded ones.
|
// non-overloaded ones.
|
||||||
std::vector<StringMatcher::StringPair> MatchTable;
|
std::vector<StringMatcher::StringPair> MatchTable;
|
||||||
|
|
||||||
for (unsigned i = 0, e = IntList.size(); i != e; ++i) {
|
for (unsigned i = 0, e = IntList.size(); i != e; ++i) {
|
||||||
unsigned IntNo = IntList[i];
|
unsigned IntNo = IntList[i];
|
||||||
std::string Result = "return " + TargetPrefix + "Intrinsic::" +
|
std::string Result = "return " + TargetPrefix + "Intrinsic::" +
|
||||||
@ -188,18 +188,18 @@ EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
OS << " if (NameR.startswith(\"" << TheStr << "\")) "
|
OS << " if (NameR.startswith(\"" << TheStr << "\")) "
|
||||||
<< Result << '\n';
|
<< Result << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the matcher logic for the fixed length strings.
|
// Emit the matcher logic for the fixed length strings.
|
||||||
StringMatcher("NameR", MatchTable, OS).Emit(1);
|
StringMatcher("NameR", MatchTable, OS).Emit(1);
|
||||||
OS << " break; // end of '" << I->first << "' case.\n";
|
OS << " break; // end of '" << I->first << "' case.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " }\n";
|
OS << " }\n";
|
||||||
OS << "#endif\n\n";
|
OS << "#endif\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntrinsicEmitter::
|
void IntrinsicEmitter::
|
||||||
EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints,
|
EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
OS << "// Intrinsic ID to name table\n";
|
OS << "// Intrinsic ID to name table\n";
|
||||||
OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n";
|
OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n";
|
||||||
@ -210,7 +210,7 @@ EmitIntrinsicToNameTable(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntrinsicEmitter::
|
void IntrinsicEmitter::
|
||||||
EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints,
|
EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
OS << "// Intrinsic ID to overload bitset\n";
|
OS << "// Intrinsic ID to overload bitset\n";
|
||||||
OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n";
|
OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n";
|
||||||
@ -278,7 +278,7 @@ static void EncodeFixedValueType(MVT::SimpleValueType VT,
|
|||||||
case 64: return Sig.push_back(IIT_I64);
|
case 64: return Sig.push_back(IIT_I64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (VT) {
|
switch (VT) {
|
||||||
default: PrintFatalError("unhandled MVT in intrinsic!");
|
default: PrintFatalError("unhandled MVT in intrinsic!");
|
||||||
case MVT::f16: return Sig.push_back(IIT_F16);
|
case MVT::f16: return Sig.push_back(IIT_F16);
|
||||||
@ -293,11 +293,11 @@ static void EncodeFixedValueType(MVT::SimpleValueType VT,
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma optimize("",off) // MSVC 2010 optimizer can't deal with this function.
|
#pragma optimize("",off) // MSVC 2010 optimizer can't deal with this function.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
|
static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
|
||||||
std::vector<unsigned char> &Sig) {
|
std::vector<unsigned char> &Sig) {
|
||||||
|
|
||||||
if (R->isSubClassOf("LLVMMatchType")) {
|
if (R->isSubClassOf("LLVMMatchType")) {
|
||||||
unsigned Number = R->getValueAsInt("Number");
|
unsigned Number = R->getValueAsInt("Number");
|
||||||
assert(Number < ArgCodes.size() && "Invalid matching number!");
|
assert(Number < ArgCodes.size() && "Invalid matching number!");
|
||||||
@ -309,7 +309,7 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
|
|||||||
Sig.push_back(IIT_ARG);
|
Sig.push_back(IIT_ARG);
|
||||||
return Sig.push_back((Number << 2) | ArgCodes[Number]);
|
return Sig.push_back((Number << 2) | ArgCodes[Number]);
|
||||||
}
|
}
|
||||||
|
|
||||||
MVT::SimpleValueType VT = getValueType(R->getValueAsDef("VT"));
|
MVT::SimpleValueType VT = getValueType(R->getValueAsDef("VT"));
|
||||||
|
|
||||||
unsigned Tmp = 0;
|
unsigned Tmp = 0;
|
||||||
@ -320,17 +320,17 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
|
|||||||
case MVT::fAny: ++Tmp; // FALL THROUGH.
|
case MVT::fAny: ++Tmp; // FALL THROUGH.
|
||||||
case MVT::iAny: {
|
case MVT::iAny: {
|
||||||
// If this is an "any" valuetype, then the type is the type of the next
|
// If this is an "any" valuetype, then the type is the type of the next
|
||||||
// type in the list specified to getIntrinsic().
|
// type in the list specified to getIntrinsic().
|
||||||
Sig.push_back(IIT_ARG);
|
Sig.push_back(IIT_ARG);
|
||||||
|
|
||||||
// Figure out what arg # this is consuming, and remember what kind it was.
|
// Figure out what arg # this is consuming, and remember what kind it was.
|
||||||
unsigned ArgNo = ArgCodes.size();
|
unsigned ArgNo = ArgCodes.size();
|
||||||
ArgCodes.push_back(Tmp);
|
ArgCodes.push_back(Tmp);
|
||||||
|
|
||||||
// Encode what sort of argument it must be in the low 2 bits of the ArgNo.
|
// Encode what sort of argument it must be in the low 2 bits of the ArgNo.
|
||||||
return Sig.push_back((ArgNo << 2) | Tmp);
|
return Sig.push_back((ArgNo << 2) | Tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
case MVT::iPTR: {
|
case MVT::iPTR: {
|
||||||
unsigned AddrSpace = 0;
|
unsigned AddrSpace = 0;
|
||||||
if (R->isSubClassOf("LLVMQualPointerType")) {
|
if (R->isSubClassOf("LLVMQualPointerType")) {
|
||||||
@ -346,7 +346,7 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
|
|||||||
return EncodeFixedType(R->getValueAsDef("ElTy"), ArgCodes, Sig);
|
return EncodeFixedType(R->getValueAsDef("ElTy"), ArgCodes, Sig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EVT(VT).isVector()) {
|
if (EVT(VT).isVector()) {
|
||||||
EVT VVT = VT;
|
EVT VVT = VT;
|
||||||
switch (VVT.getVectorNumElements()) {
|
switch (VVT.getVectorNumElements()) {
|
||||||
@ -358,7 +358,7 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
|
|||||||
case 16: Sig.push_back(IIT_V16); break;
|
case 16: Sig.push_back(IIT_V16); break;
|
||||||
case 32: Sig.push_back(IIT_V32); break;
|
case 32: Sig.push_back(IIT_V32); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EncodeFixedValueType(VVT.getVectorElementType().
|
return EncodeFixedValueType(VVT.getVectorElementType().
|
||||||
getSimpleVT().SimpleTy, Sig);
|
getSimpleVT().SimpleTy, Sig);
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
|
|||||||
static void ComputeFixedEncoding(const CodeGenIntrinsic &Int,
|
static void ComputeFixedEncoding(const CodeGenIntrinsic &Int,
|
||||||
std::vector<unsigned char> &TypeSig) {
|
std::vector<unsigned char> &TypeSig) {
|
||||||
std::vector<unsigned char> ArgCodes;
|
std::vector<unsigned char> ArgCodes;
|
||||||
|
|
||||||
if (Int.IS.RetVTs.empty())
|
if (Int.IS.RetVTs.empty())
|
||||||
TypeSig.push_back(IIT_Done);
|
TypeSig.push_back(IIT_Done);
|
||||||
else if (Int.IS.RetVTs.size() == 1 &&
|
else if (Int.IS.RetVTs.size() == 1 &&
|
||||||
@ -390,11 +390,11 @@ static void ComputeFixedEncoding(const CodeGenIntrinsic &Int,
|
|||||||
case 5: TypeSig.push_back(IIT_STRUCT5); break;
|
case 5: TypeSig.push_back(IIT_STRUCT5); break;
|
||||||
default: assert(0 && "Unhandled case in struct");
|
default: assert(0 && "Unhandled case in struct");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0, e = Int.IS.RetVTs.size(); i != e; ++i)
|
for (unsigned i = 0, e = Int.IS.RetVTs.size(); i != e; ++i)
|
||||||
EncodeFixedType(Int.IS.RetTypeDefs[i], ArgCodes, TypeSig);
|
EncodeFixedType(Int.IS.RetTypeDefs[i], ArgCodes, TypeSig);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0, e = Int.IS.ParamTypeDefs.size(); i != e; ++i)
|
for (unsigned i = 0, e = Int.IS.ParamTypeDefs.size(); i != e; ++i)
|
||||||
EncodeFixedType(Int.IS.ParamTypeDefs[i], ArgCodes, TypeSig);
|
EncodeFixedType(Int.IS.ParamTypeDefs[i], ArgCodes, TypeSig);
|
||||||
}
|
}
|
||||||
@ -403,16 +403,16 @@ static void printIITEntry(raw_ostream &OS, unsigned char X) {
|
|||||||
OS << (unsigned)X;
|
OS << (unsigned)X;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntrinsicEmitter::EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints,
|
void IntrinsicEmitter::EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
// If we can compute a 32-bit fixed encoding for this intrinsic, do so and
|
// If we can compute a 32-bit fixed encoding for this intrinsic, do so and
|
||||||
// capture it in this vector, otherwise store a ~0U.
|
// capture it in this vector, otherwise store a ~0U.
|
||||||
std::vector<unsigned> FixedEncodings;
|
std::vector<unsigned> FixedEncodings;
|
||||||
|
|
||||||
SequenceToOffsetTable<std::vector<unsigned char> > LongEncodingTable;
|
SequenceToOffsetTable<std::vector<unsigned char> > LongEncodingTable;
|
||||||
|
|
||||||
std::vector<unsigned char> TypeSig;
|
std::vector<unsigned char> TypeSig;
|
||||||
|
|
||||||
// Compute the unique argument type info.
|
// Compute the unique argument type info.
|
||||||
for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
|
||||||
// Get the signature for the intrinsic.
|
// Get the signature for the intrinsic.
|
||||||
@ -432,7 +432,7 @@ void IntrinsicEmitter::EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
}
|
}
|
||||||
Result = (Result << 4) | TypeSig[e-i-1];
|
Result = (Result << 4) | TypeSig[e-i-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this could be encoded into a 31-bit word, return it.
|
// If this could be encoded into a 31-bit word, return it.
|
||||||
if (!Failed && (Result >> 31) == 0) {
|
if (!Failed && (Result >> 31) == 0) {
|
||||||
FixedEncodings.push_back(Result);
|
FixedEncodings.push_back(Result);
|
||||||
@ -443,45 +443,45 @@ void IntrinsicEmitter::EmitGenerator(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
// Otherwise, we're going to unique the sequence into the
|
// Otherwise, we're going to unique the sequence into the
|
||||||
// LongEncodingTable, and use its offset in the 32-bit table instead.
|
// LongEncodingTable, and use its offset in the 32-bit table instead.
|
||||||
LongEncodingTable.add(TypeSig);
|
LongEncodingTable.add(TypeSig);
|
||||||
|
|
||||||
// This is a placehold that we'll replace after the table is laid out.
|
// This is a placehold that we'll replace after the table is laid out.
|
||||||
FixedEncodings.push_back(~0U);
|
FixedEncodings.push_back(~0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
LongEncodingTable.layout();
|
LongEncodingTable.layout();
|
||||||
|
|
||||||
OS << "// Global intrinsic function declaration type table.\n";
|
OS << "// Global intrinsic function declaration type table.\n";
|
||||||
OS << "#ifdef GET_INTRINSIC_GENERATOR_GLOBAL\n";
|
OS << "#ifdef GET_INTRINSIC_GENERATOR_GLOBAL\n";
|
||||||
|
|
||||||
OS << "static const unsigned IIT_Table[] = {\n ";
|
OS << "static const unsigned IIT_Table[] = {\n ";
|
||||||
|
|
||||||
for (unsigned i = 0, e = FixedEncodings.size(); i != e; ++i) {
|
for (unsigned i = 0, e = FixedEncodings.size(); i != e; ++i) {
|
||||||
if ((i & 7) == 7)
|
if ((i & 7) == 7)
|
||||||
OS << "\n ";
|
OS << "\n ";
|
||||||
|
|
||||||
// If the entry fit in the table, just emit it.
|
// If the entry fit in the table, just emit it.
|
||||||
if (FixedEncodings[i] != ~0U) {
|
if (FixedEncodings[i] != ~0U) {
|
||||||
OS << "0x" << utohexstr(FixedEncodings[i]) << ", ";
|
OS << "0x" << utohexstr(FixedEncodings[i]) << ", ";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeSig.clear();
|
TypeSig.clear();
|
||||||
ComputeFixedEncoding(Ints[i], TypeSig);
|
ComputeFixedEncoding(Ints[i], TypeSig);
|
||||||
|
|
||||||
|
|
||||||
// Otherwise, emit the offset into the long encoding table. We emit it this
|
// Otherwise, emit the offset into the long encoding table. We emit it this
|
||||||
// way so that it is easier to read the offset in the .def file.
|
// way so that it is easier to read the offset in the .def file.
|
||||||
OS << "(1U<<31) | " << LongEncodingTable.get(TypeSig) << ", ";
|
OS << "(1U<<31) | " << LongEncodingTable.get(TypeSig) << ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << "0\n};\n\n";
|
OS << "0\n};\n\n";
|
||||||
|
|
||||||
// Emit the shared table of register lists.
|
// Emit the shared table of register lists.
|
||||||
OS << "static const unsigned char IIT_LongEncodingTable[] = {\n";
|
OS << "static const unsigned char IIT_LongEncodingTable[] = {\n";
|
||||||
if (!LongEncodingTable.empty())
|
if (!LongEncodingTable.empty())
|
||||||
LongEncodingTable.emit(OS, printIITEntry);
|
LongEncodingTable.emit(OS, printIITEntry);
|
||||||
OS << " 255\n};\n\n";
|
OS << " 255\n};\n\n";
|
||||||
|
|
||||||
OS << "#endif\n\n"; // End of GET_INTRINSIC_GENERATOR_GLOBAL
|
OS << "#endif\n\n"; // End of GET_INTRINSIC_GENERATOR_GLOBAL
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
|
|||||||
OS << " AttrVec.push_back(Attribute::ReadOnly);\n";
|
OS << " AttrVec.push_back(Attribute::ReadOnly);\n";
|
||||||
break;
|
break;
|
||||||
case MRK_readnone:
|
case MRK_readnone:
|
||||||
OS << " AttrVec.push_back(Attribute::ReadNone);\n";
|
OS << " AttrVec.push_back(Attribute::ReadNone);\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, "
|
OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, "
|
||||||
@ -645,7 +645,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
|
|||||||
OS << " return AttributeSet();\n";
|
OS << " return AttributeSet();\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " }\n";
|
OS << " }\n";
|
||||||
OS << " }\n";
|
OS << " }\n";
|
||||||
OS << " return AttributeSet::get(C, ArrayRef<AttributeSet>(AS, "
|
OS << " return AttributeSet::get(C, ArrayRef<AttributeSet>(AS, "
|
||||||
@ -694,9 +694,9 @@ EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS){
|
|||||||
static void EmitTargetBuiltins(const std::map<std::string, std::string> &BIM,
|
static void EmitTargetBuiltins(const std::map<std::string, std::string> &BIM,
|
||||||
const std::string &TargetPrefix,
|
const std::string &TargetPrefix,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
|
|
||||||
std::vector<StringMatcher::StringPair> Results;
|
std::vector<StringMatcher::StringPair> Results;
|
||||||
|
|
||||||
for (std::map<std::string, std::string>::const_iterator I = BIM.begin(),
|
for (std::map<std::string, std::string>::const_iterator I = BIM.begin(),
|
||||||
E = BIM.end(); I != E; ++I) {
|
E = BIM.end(); I != E; ++I) {
|
||||||
std::string ResultCode =
|
std::string ResultCode =
|
||||||
@ -707,9 +707,9 @@ static void EmitTargetBuiltins(const std::map<std::string, std::string> &BIM,
|
|||||||
StringMatcher("BuiltinName", Results, OS).Emit();
|
StringMatcher("BuiltinName", Results, OS).Emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IntrinsicEmitter::
|
void IntrinsicEmitter::
|
||||||
EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints,
|
EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints,
|
||||||
raw_ostream &OS) {
|
raw_ostream &OS) {
|
||||||
typedef std::map<std::string, std::map<std::string, std::string> > BIMTy;
|
typedef std::map<std::string, std::map<std::string, std::string> > BIMTy;
|
||||||
BIMTy BuiltinMap;
|
BIMTy BuiltinMap;
|
||||||
@ -717,20 +717,20 @@ EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
if (!Ints[i].GCCBuiltinName.empty()) {
|
if (!Ints[i].GCCBuiltinName.empty()) {
|
||||||
// Get the map for this target prefix.
|
// Get the map for this target prefix.
|
||||||
std::map<std::string, std::string> &BIM =BuiltinMap[Ints[i].TargetPrefix];
|
std::map<std::string, std::string> &BIM =BuiltinMap[Ints[i].TargetPrefix];
|
||||||
|
|
||||||
if (!BIM.insert(std::make_pair(Ints[i].GCCBuiltinName,
|
if (!BIM.insert(std::make_pair(Ints[i].GCCBuiltinName,
|
||||||
Ints[i].EnumName)).second)
|
Ints[i].EnumName)).second)
|
||||||
PrintFatalError("Intrinsic '" + Ints[i].TheDef->getName() +
|
PrintFatalError("Intrinsic '" + Ints[i].TheDef->getName() +
|
||||||
"': duplicate GCC builtin name!");
|
"': duplicate GCC builtin name!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << "// Get the LLVM intrinsic that corresponds to a GCC builtin.\n";
|
OS << "// Get the LLVM intrinsic that corresponds to a GCC builtin.\n";
|
||||||
OS << "// This is used by the C front-end. The GCC builtin name is passed\n";
|
OS << "// This is used by the C front-end. The GCC builtin name is passed\n";
|
||||||
OS << "// in as BuiltinName, and a target prefix (e.g. 'ppc') is passed\n";
|
OS << "// in as BuiltinName, and a target prefix (e.g. 'ppc') is passed\n";
|
||||||
OS << "// in as TargetPrefix. The result is assigned to 'IntrinsicID'.\n";
|
OS << "// in as TargetPrefix. The result is assigned to 'IntrinsicID'.\n";
|
||||||
OS << "#ifdef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN\n";
|
OS << "#ifdef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN\n";
|
||||||
|
|
||||||
if (TargetOnly) {
|
if (TargetOnly) {
|
||||||
OS << "static " << TargetPrefix << "Intrinsic::ID "
|
OS << "static " << TargetPrefix << "Intrinsic::ID "
|
||||||
<< "getIntrinsicForGCCBuiltin(const char "
|
<< "getIntrinsicForGCCBuiltin(const char "
|
||||||
@ -739,10 +739,10 @@ EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints,
|
|||||||
OS << "Intrinsic::ID Intrinsic::getIntrinsicForGCCBuiltin(const char "
|
OS << "Intrinsic::ID Intrinsic::getIntrinsicForGCCBuiltin(const char "
|
||||||
<< "*TargetPrefixStr, const char *BuiltinNameStr) {\n";
|
<< "*TargetPrefixStr, const char *BuiltinNameStr) {\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " StringRef BuiltinName(BuiltinNameStr);\n";
|
OS << " StringRef BuiltinName(BuiltinNameStr);\n";
|
||||||
OS << " StringRef TargetPrefix(TargetPrefixStr);\n\n";
|
OS << " StringRef TargetPrefix(TargetPrefixStr);\n\n";
|
||||||
|
|
||||||
// Note: this could emit significantly better code if we cared.
|
// Note: this could emit significantly better code if we cared.
|
||||||
for (BIMTy::iterator I = BuiltinMap.begin(), E = BuiltinMap.end();I != E;++I){
|
for (BIMTy::iterator I = BuiltinMap.begin(), E = BuiltinMap.end();I != E;++I){
|
||||||
OS << " ";
|
OS << " ";
|
||||||
|
Loading…
Reference in New Issue
Block a user