mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
!9107 clean prim type 2
Merge pull request !9107 from xuyuqing/cov_0903
This commit is contained in:
commit
dab66c4a6f
@ -563,7 +563,7 @@ private:
|
||||
PrimType pTy;
|
||||
if (o.GetKind() == Operand::kOpdRegister && static_cast<RegOperand &>(o).GetRegisterType() == kRegTyFloat) {
|
||||
// f128 is a vector placeholder, no use for now
|
||||
pTy = dsize == k32BitSize ? PTY_f32 : (dsize == k64BitSize ? PTY_f64 : PTY_f128);
|
||||
pTy = dsize == k32BitSize ? PTY_f32 : PTY_f64;
|
||||
} else {
|
||||
pTy = GetOperandTy(isIntty, dsize, asSigned);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ inline bool StrLdr16Valid(Operand *o)
|
||||
uint8 symAlign = 0;
|
||||
const MIRSymbol *sym = memOpnd->GetSymbol();
|
||||
if (sym) {
|
||||
symAlign = 1U << sym->GetSymbolAlign(CGOptions::IsArm64ilp32());
|
||||
symAlign = 1U << sym->GetSymbolAlign();
|
||||
}
|
||||
return ((symAlign + static_cast<uint64>(AArch64isa::GetMemOpndOffsetValue(o))) &
|
||||
static_cast<int64>(k1BitSize)) == static_cast<int64>(k0BitSize);
|
||||
@ -52,7 +52,7 @@ inline bool StrLdr32Valid(Operand *o)
|
||||
uint8 symAlign = 0;
|
||||
const MIRSymbol *sym = memOpnd->GetSymbol();
|
||||
if (sym) {
|
||||
symAlign = 1U << sym->GetSymbolAlign(CGOptions::IsArm64ilp32());
|
||||
symAlign = 1U << sym->GetSymbolAlign();
|
||||
}
|
||||
return ((symAlign + static_cast<uint64>(AArch64isa::GetMemOpndOffsetValue(o))) &
|
||||
static_cast<int64>(k3BitSize)) == static_cast<int64>(k0BitSize);
|
||||
@ -79,7 +79,7 @@ inline bool StrLdr64Valid(Operand *o)
|
||||
uint8 symAlign = 0;
|
||||
const MIRSymbol *sym = memOpnd->GetSymbol();
|
||||
if (sym) {
|
||||
symAlign = 1U << sym->GetSymbolAlign(CGOptions::IsArm64ilp32());
|
||||
symAlign = 1U << sym->GetSymbolAlign();
|
||||
}
|
||||
return ((symAlign + static_cast<uint64>(AArch64isa::GetMemOpndOffsetValue(o))) &
|
||||
static_cast<int64>(k7BitSize)) == static_cast<int64>(k0BitSize);
|
||||
@ -106,7 +106,7 @@ inline bool StrLdr128Valid(Operand *o)
|
||||
uint8 symAlign = 0;
|
||||
const MIRSymbol *sym = memOpnd->GetSymbol();
|
||||
if (sym && sym->IsConst()) {
|
||||
symAlign = 1U << sym->GetSymbolAlign(CGOptions::IsArm64ilp32());
|
||||
symAlign = 1U << sym->GetSymbolAlign();
|
||||
}
|
||||
return ((symAlign + static_cast<uint64>(AArch64isa::GetMemOpndOffsetValue(o))) &
|
||||
static_cast<int64>(k15BitSize)) == static_cast<int64>(k0BitSize);
|
||||
|
@ -342,11 +342,9 @@ public:
|
||||
case PTY_u32:
|
||||
case PTY_i64:
|
||||
case PTY_u64:
|
||||
case PTY_a32:
|
||||
case PTY_a64:
|
||||
case PTY_ptr:
|
||||
case PTY_ref:
|
||||
case PTY_agg:
|
||||
return kRegTyInt;
|
||||
case PTY_f32:
|
||||
case PTY_f64:
|
||||
|
@ -154,7 +154,6 @@ private:
|
||||
void SelectExtractbits(RegOperand &resOpnd, RegOperand &opnd0, uint8 bitOffset, uint8 bitSize, PrimType primType);
|
||||
void SelectBxor(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType);
|
||||
virtual RegOperand &GetTargetBasicPointer(PrimType primType) = 0;
|
||||
virtual RegOperand &GetTargetStackPointer(PrimType primType) = 0;
|
||||
void SelectMin(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType);
|
||||
void SelectMax(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType);
|
||||
virtual void SelectMinOrMax(bool isMin, Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType) = 0;
|
||||
|
@ -40,7 +40,6 @@ public:
|
||||
bool GenerateLiveIn(BB &bb);
|
||||
void BuildInOutforFunc();
|
||||
void ResetLiveSet();
|
||||
void ClearInOutDataInfo();
|
||||
void GetBBDefUse(BB &bb) const;
|
||||
void ProcessAsmListOpnd(BB &bb, Operand &opnd, uint32 idx) const;
|
||||
void ProcessListOpnd(BB &bb, Operand &opnd, bool isDef) const;
|
||||
|
@ -440,7 +440,6 @@ public:
|
||||
}
|
||||
|
||||
void InitELFHeader();
|
||||
void AddSymbol(const std::string &name, Word size, const Section §ion, Address value);
|
||||
void AddFuncSymbol(const MapleString &name, Word size, Address value);
|
||||
void ClearData();
|
||||
void HandleExceptFixup();
|
||||
@ -532,10 +531,6 @@ public:
|
||||
return textDataSize;
|
||||
}
|
||||
|
||||
void EmitMIRIntConst(EmitInfo &emitInfo);
|
||||
void EmitMIRAddrofConst(EmitInfo &emitInfo);
|
||||
void EmitMIRAddrofConstOffset(EmitInfo &emitInfo);
|
||||
void EmitMIRAddrofConstCommon(EmitInfo &emitInfo, uint64 specialOffset);
|
||||
void EmitFunctionSymbolTable(ObjFuncEmitInfo &objFuncEmitInfo, std::vector<uint32> &symbol2Offset);
|
||||
void EmitStr16Const(ObjFuncEmitInfo &objFuncEmitInfo, const MIRSymbol &str16Symbol);
|
||||
void EmitStrConst(ObjFuncEmitInfo &objFuncEmitInfo, const MIRSymbol &strSymbol);
|
||||
|
@ -122,8 +122,6 @@ public:
|
||||
}
|
||||
|
||||
virtual std::string GetPatternName() = 0;
|
||||
void DumpAfterPattern(std::vector<Insn *> &prevInsns, const Insn *replacedInsn, const Insn *newInsn);
|
||||
int64 GetLogValueAtBase2(int64 val) const;
|
||||
/* optimization support function */
|
||||
bool IfOperandIsLiveAfterInsn(const RegOperand ®Opnd, Insn &insn);
|
||||
bool FindRegLiveOut(const RegOperand ®Opnd, const BB &bb);
|
||||
|
@ -65,12 +65,9 @@ private:
|
||||
PrimType cmpPrimType);
|
||||
|
||||
Operand *SelectDivRem(RegOperand &opnd0, RegOperand &opnd1, PrimType primType, Opcode opcode);
|
||||
RegOperand &GetTargetStackPointer(PrimType primType) override;
|
||||
RegOperand &GetTargetBasicPointer(PrimType primType) override;
|
||||
void SelectMinOrMax(bool isMin, Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType) override;
|
||||
void SelectPseduoForReturn(std::vector<RegOperand *> &retRegs);
|
||||
RegOperand *PrepareMemcpyParm(MemOperand &memOperand, MOperator mOp);
|
||||
RegOperand *PrepareMemcpyParm(uint64 copySize);
|
||||
RegOperand &SelectSpecialRegread(PregIdx pregIdx, PrimType primType) override;
|
||||
void SelectRetypeFloat(RegOperand &resOpnd, Operand &opnd0, PrimType toType, PrimType fromType) override;
|
||||
|
||||
|
@ -54,10 +54,8 @@ BlockNode *CGLowerer::LowerReturnStructUsingFakeParm(NaryStmtNode &retNode)
|
||||
retNode.SetOpnd(LowerExpr(retNode, *retNode.GetNopndAt(i), *blk), i);
|
||||
}
|
||||
BaseNode *opnd0 = retNode.Opnd(0);
|
||||
if (!(opnd0 && opnd0->GetPrimType() == PTY_agg)) {
|
||||
/* It is possible function never returns and have a dummy return const instead of a struct. */
|
||||
maple::LogInfo::MapleLogger(kLlWarn) << "return struct should have a kid" << std::endl;
|
||||
}
|
||||
/* It is possible function never returns and have a dummy return const instead of a struct. */
|
||||
maple::LogInfo::MapleLogger(kLlWarn) << "return struct should have a kid" << std::endl;
|
||||
|
||||
MIRFunction *curFunc = GetCurrentFunc();
|
||||
MIRSymbol *retSt = curFunc->GetFormal(0);
|
||||
@ -142,7 +140,7 @@ void CGLowerer::LowerAsmStmt(AsmNode *asmNode, BlockNode *newBlk)
|
||||
StmtNode *assignNode = nullptr;
|
||||
BaseNode *readOpnd = nullptr;
|
||||
PrimType type = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdxUsed)->GetPrimType();
|
||||
if ((type != PTY_agg) && CGOptions::GetInstance().GetOptimizeLevel() >= CGOptions::kLevel2) {
|
||||
if (CGOptions::GetInstance().GetOptimizeLevel() >= CGOptions::kLevel2) {
|
||||
DEBUG_ASSERT(mirModule.CurFunction() != nullptr, "curFunction should not be nullptr");
|
||||
PregIdx pregIdx = mirModule.CurFunction()->GetPregTab()->CreatePreg(type);
|
||||
assignNode = mirBuilder->CreateStmtRegassign(type, pregIdx, opnd);
|
||||
|
@ -254,7 +254,6 @@ int32 AArch64WebKitJSCC::ClassificationArg(const BECommon &be, const MIRType &mi
|
||||
case PTY_i8:
|
||||
case PTY_u16:
|
||||
case PTY_i16:
|
||||
case PTY_a32:
|
||||
case PTY_u32:
|
||||
case PTY_i32:
|
||||
classes.push_back(kIntegerClass);
|
||||
|
@ -83,14 +83,9 @@ MOperator PickLdStInsn(bool isLoad, uint32 bitSize, PrimType primType)
|
||||
DEBUG_ASSERT(__builtin_popcount(bitSize) == 1, "PTY_u1 should have been lowered?");
|
||||
|
||||
/* __builtin_ffs(x) returns: 0 -> 0, 1 -> 1, 2 -> 2, 4 -> 3, 8 -> 4 */
|
||||
if ((IsPrimitiveInteger(primType) || primType == PTY_agg)) {
|
||||
if ((IsPrimitiveInteger(primType))) {
|
||||
auto *table = isLoad ? ldIs : stIs;
|
||||
int32 signedUnsigned = IsUnsignedInteger(primType) ? 0 : 1;
|
||||
if (primType == PTY_agg) {
|
||||
CHECK_FATAL(bitSize >= k8BitSize, " unexpect agg size");
|
||||
bitSize = static_cast<uint32>(RoundUp(bitSize, k8BitSize));
|
||||
DEBUG_ASSERT((bitSize & (bitSize - 1)) == 0, "bitlen error");
|
||||
}
|
||||
|
||||
/* __builtin_ffs(x) returns: 8 -> 4, 16 -> 5, 32 -> 6, 64 -> 7 */
|
||||
uint32 size = static_cast<uint32>(__builtin_ffs(static_cast<int32>(bitSize))) - k4BitSize;
|
||||
@ -313,11 +308,7 @@ void AArch64CGFunc::SelectCopyMemOpnd(Operand &dest, PrimType dtype, uint32 dsiz
|
||||
CHECK_FATAL(dsize == ssize, "dsize %u expect equals ssize %u", dtype, ssize);
|
||||
insn = &GetInsnBuilder()->BuildInsn(PickLdInsn(ssize, stype), dest, src);
|
||||
} else {
|
||||
if (stype == PTY_agg && dtype == PTY_agg) {
|
||||
mop = MOP_undef;
|
||||
} else {
|
||||
mop = PickExtInsn(dtype, stype);
|
||||
}
|
||||
mop = PickExtInsn(dtype, stype);
|
||||
if (ssize == (GetPrimTypeSize(dtype) * kBitsPerByte) || mop == MOP_undef) {
|
||||
insn = &GetInsnBuilder()->BuildInsn(PickLdInsn(ssize, stype), dest, src);
|
||||
} else {
|
||||
@ -386,9 +377,6 @@ void AArch64CGFunc::SelectCopyRegOpnd(Operand &dest, PrimType dtype, Operand::Op
|
||||
Operand &src, PrimType stype)
|
||||
{
|
||||
if (opndType != Operand::kOpdMem) {
|
||||
if (!CGOptions::IsArm64ilp32()) {
|
||||
DEBUG_ASSERT(stype != PTY_a32, "");
|
||||
}
|
||||
GetCurBB()->AppendInsn(GetInsnBuilder()->BuildInsn(PickMovBetweenRegs(dtype, stype), dest, src));
|
||||
return;
|
||||
}
|
||||
@ -719,9 +707,6 @@ void AArch64CGFunc::SelectDassign(StIdx stIdx, FieldID fieldId, PrimType rhsPTyp
|
||||
MOperator mOp = MOP_undef;
|
||||
|
||||
uint32 dataSize = GetPrimTypeBitSize(type->GetPrimType());
|
||||
if (type->GetPrimType() == PTY_agg) {
|
||||
dataSize = GetPrimTypeBitSize(PTY_a64);
|
||||
}
|
||||
MemOperand *memOpnd = nullptr;
|
||||
if (parmCopy) {
|
||||
memOpnd = &LoadStructCopyBase(*symbol, offset, static_cast<int>(dataSize));
|
||||
@ -737,9 +722,6 @@ void AArch64CGFunc::SelectDassign(StIdx stIdx, FieldID fieldId, PrimType rhsPTyp
|
||||
DEBUG_ASSERT(((type->GetKind() == kTypeScalar) || (type->GetKind() == kTypePointer) ||
|
||||
(type->GetKind() == kTypeFunction) || (type->GetKind() == kTypeArray)), "NYI dassign type");
|
||||
PrimType ptyp = type->GetPrimType();
|
||||
if (ptyp == PTY_agg) {
|
||||
ptyp = PTY_a64;
|
||||
}
|
||||
|
||||
mOp = PickStInsn(GetPrimTypeBitSize(ptyp), ptyp);
|
||||
Insn &insn = GetInsnBuilder()->BuildInsn(mOp, stOpnd, *memOpnd);
|
||||
@ -852,9 +834,6 @@ void AArch64CGFunc::SelectIassign(IassignNode &stmt)
|
||||
GetPrimTypeBitSize(styp));
|
||||
|
||||
PrimType destType = pointedType->GetPrimType();
|
||||
if (destType == PTY_agg) {
|
||||
destType = PTY_a64;
|
||||
}
|
||||
DEBUG_ASSERT(stmt.Opnd(0) != nullptr, "null ptr check");
|
||||
MemOperand &memOpnd = CreateMemOpnd(destType, stmt, *stmt.Opnd(0), offset);
|
||||
SelectCopy(memOpnd, destType, srcOpnd, destType);
|
||||
@ -874,16 +853,6 @@ Operand *AArch64CGFunc::SelectDread(const BaseNode &parent, DreadNode &expr)
|
||||
uint32 dataSize = GetPrimTypeBitSize(symType);
|
||||
uint32 aggSize = 0;
|
||||
PrimType resultType = expr.GetPrimType();
|
||||
if (symType == PTY_agg) {
|
||||
if (expr.GetPrimType() == PTY_agg) {
|
||||
aggSize = static_cast<uint32>(GetBecommon().GetTypeSize(symbol->GetType()->GetTypeIndex().GetIdx()));
|
||||
dataSize = ((expr.GetFieldID() == 0) ? GetPointerSize() : aggSize) << k8BitShift;
|
||||
resultType = PTY_u64;
|
||||
symType = resultType;
|
||||
} else {
|
||||
dataSize = GetPrimTypeBitSize(expr.GetPrimType());
|
||||
}
|
||||
}
|
||||
MemOperand *memOpnd = nullptr;
|
||||
if (aggSize > k8ByteSize) {
|
||||
if (parent.op == OP_eval) {
|
||||
@ -964,15 +933,7 @@ Operand *AArch64CGFunc::SelectIread(const BaseNode &parent, IreadNode &expr, int
|
||||
|
||||
RegType regType = GetRegTyFromPrimTy(expr.GetPrimType());
|
||||
uint32 regSize = GetPrimTypeSize(expr.GetPrimType());
|
||||
if (expr.GetFieldID() == 0 && pointedType->GetPrimType() == PTY_agg) {
|
||||
/* Maple IR can passing small struct to be loaded into a single register. */
|
||||
if (regType == kRegTyFloat) {
|
||||
/* regsize is correct */
|
||||
} else {
|
||||
uint32 sz = GetBecommon().GetTypeSize(pointedType->GetTypeIndex().GetIdx());
|
||||
regSize = (sz <= k4ByteSize) ? k4ByteSize : k8ByteSize;
|
||||
}
|
||||
} else if (regSize < k4ByteSize) {
|
||||
if (regSize < k4ByteSize) {
|
||||
regSize = k4ByteSize; /* 32-bit */
|
||||
}
|
||||
Operand *result = nullptr;
|
||||
@ -990,26 +951,6 @@ Operand *AArch64CGFunc::SelectIread(const BaseNode &parent, IreadNode &expr, int
|
||||
if (regType == kRegTyFloat) {
|
||||
destType = expr.GetPrimType();
|
||||
bitSize = GetPrimTypeBitSize(destType);
|
||||
} else if (destType == PTY_agg) {
|
||||
switch (bitSize) {
|
||||
case k8BitSize:
|
||||
destType = PTY_u8;
|
||||
break;
|
||||
case k16BitSize:
|
||||
destType = PTY_u16;
|
||||
break;
|
||||
case k32BitSize:
|
||||
destType = PTY_u32;
|
||||
break;
|
||||
case k64BitSize:
|
||||
destType = PTY_u64;
|
||||
break;
|
||||
default:
|
||||
destType = PTY_u64; // when eval agg . a way to round up
|
||||
DEBUG_ASSERT(bitSize == 0, " round up empty agg ");
|
||||
bitSize = k64BitSize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PrimType memType = (finalBitFieldDestType == kPtyInvalid ? destType : finalBitFieldDestType);
|
||||
@ -2733,7 +2674,6 @@ void AArch64CGFunc::SelectCvtFloat2Int(Operand &resOpnd, Operand &srcOpnd, PrimT
|
||||
mOp = !is64BitsFloat ? MOP_vcvtrf : MOP_vcvtrd;
|
||||
break;
|
||||
case PTY_u32:
|
||||
case PTY_a32:
|
||||
mOp = !is64BitsFloat ? MOP_vcvturf : MOP_vcvturd;
|
||||
break;
|
||||
case PTY_i64:
|
||||
@ -3427,11 +3367,6 @@ std::pair<MIRFunction *, MIRFuncType *> AArch64CGFunc::GetCalleeFunction(StmtNod
|
||||
void AArch64CGFunc::SelectParmListPassByStack(const MIRType &mirType, Operand &opnd, uint32 memOffset, bool preCopyed,
|
||||
std::vector<Insn *> &insnForStackArgs)
|
||||
{
|
||||
if (!preCopyed && mirType.GetPrimType() == PTY_agg) {
|
||||
CHECK_FATAL(false, "NIY");
|
||||
return;
|
||||
}
|
||||
|
||||
PrimType primType = preCopyed ? PTY_a64 : mirType.GetPrimType();
|
||||
auto &valReg = LoadIntoRegister(opnd, primType);
|
||||
auto &actMemOpnd = CreateMemOpnd(RSP, memOffset, GetPrimTypeBitSize(primType));
|
||||
@ -3488,8 +3423,6 @@ void AArch64CGFunc::SelectParmList(StmtNode &naryNode, ListOperand &srcOpnds, bo
|
||||
opnd = &CreateVirtualRegisterOperand(NewVReg(kRegTyInt, k8ByteSize));
|
||||
auto &spReg = GetOrCreatePhysicalRegisterOperand(RSP, k64BitSize, kRegTyInt);
|
||||
SelectAdd(*opnd, spReg, CreateImmOperand(argsDesc[i].offset, k64BitSize, false), PTY_a64);
|
||||
} else if (mirType->GetPrimType() == PTY_agg) {
|
||||
CHECK_FATAL(false, "NIY");
|
||||
} else { // base type, clac true val
|
||||
opnd = &LoadIntoRegister(*HandleExpr(naryNode, *argsDesc[i].argExpr), mirType->GetPrimType());
|
||||
}
|
||||
@ -3501,24 +3434,20 @@ void AArch64CGFunc::SelectParmList(StmtNode &naryNode, ListOperand &srcOpnds, bo
|
||||
}
|
||||
|
||||
if (ploc.reg0 != kRinvalid) { // load to the register.
|
||||
if (mirType->GetPrimType() == PTY_agg && !preCopyed) {
|
||||
CHECK_FATAL(false, "NIY");
|
||||
} else {
|
||||
CHECK_FATAL(ploc.reg1 == kRinvalid, "NIY");
|
||||
auto &phyReg = GetOrCreatePhysicalRegisterOperand(static_cast<AArch64reg>(ploc.reg0),
|
||||
GetPrimTypeBitSize(ploc.primTypeOfReg0),
|
||||
GetRegTyFromPrimTy(ploc.primTypeOfReg0));
|
||||
DEBUG_ASSERT(opnd->IsRegister(), "NIY, must be reg");
|
||||
if (!DoCallerEnsureValidParm(phyReg, static_cast<RegOperand &>(*opnd), ploc.primTypeOfReg0)) {
|
||||
if (argsDesc[i].isSpecialArg) {
|
||||
regMapForTmpBB.emplace_back(RegMapForPhyRegCpy(
|
||||
&phyReg, ploc.primTypeOfReg0, static_cast<RegOperand *>(opnd), ploc.primTypeOfReg0));
|
||||
} else {
|
||||
SelectCopy(phyReg, ploc.primTypeOfReg0, *opnd, ploc.primTypeOfReg0);
|
||||
}
|
||||
CHECK_FATAL(ploc.reg1 == kRinvalid, "NIY");
|
||||
auto &phyReg = GetOrCreatePhysicalRegisterOperand(static_cast<AArch64reg>(ploc.reg0),
|
||||
GetPrimTypeBitSize(ploc.primTypeOfReg0),
|
||||
GetRegTyFromPrimTy(ploc.primTypeOfReg0));
|
||||
DEBUG_ASSERT(opnd->IsRegister(), "NIY, must be reg");
|
||||
if (!DoCallerEnsureValidParm(phyReg, static_cast<RegOperand &>(*opnd), ploc.primTypeOfReg0)) {
|
||||
if (argsDesc[i].isSpecialArg) {
|
||||
regMapForTmpBB.emplace_back(RegMapForPhyRegCpy(
|
||||
&phyReg, ploc.primTypeOfReg0, static_cast<RegOperand *>(opnd), ploc.primTypeOfReg0));
|
||||
} else {
|
||||
SelectCopy(phyReg, ploc.primTypeOfReg0, *opnd, ploc.primTypeOfReg0);
|
||||
}
|
||||
srcOpnds.PushOpnd(phyReg);
|
||||
}
|
||||
srcOpnds.PushOpnd(phyReg);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,6 @@ void AArch64AsmEmitter::EmitAArch64Insn(maplebe::Emitter &emitter, Insn &insn) c
|
||||
(void)emitter.Emit(nameOpnd->GetName() + emitter.HugeSoPostFix());
|
||||
break;
|
||||
}
|
||||
auto *opnd = &insn.GetOperand(static_cast<uint32>(seq[i]));
|
||||
A64OpndEmitVisitor visitor(emitter, md->opndMD[static_cast<uint32>(seq[i])]);
|
||||
|
||||
insn.GetOperand(static_cast<uint32>(seq[i])).Accept(visitor);
|
||||
|
@ -48,29 +48,7 @@ uint32 AArch64MemLayout::ComputeStackSpaceRequirementForCall(StmtNode &stmt, int
|
||||
for (uint32 anum = 0; i < stmt.NumOpnds(); ++i, ++anum) {
|
||||
BaseNode *opnd = stmt.Opnd(i);
|
||||
MIRType *ty = nullptr;
|
||||
if (opnd->GetPrimType() != PTY_agg) {
|
||||
ty = GlobalTables::GetTypeTable().GetTypeTable()[static_cast<uint32>(opnd->GetPrimType())];
|
||||
} else {
|
||||
Opcode opndOpcode = opnd->GetOpCode();
|
||||
if (be.GetMIRModule().GetFlavor() != kFlavorLmbc) {
|
||||
DEBUG_ASSERT(opndOpcode == OP_dread || opndOpcode == OP_iread,
|
||||
"opndOpcode should be OP_dread or OP_iread");
|
||||
}
|
||||
if (opndOpcode == OP_dread) {
|
||||
DreadNode *dread = static_cast<DreadNode *>(opnd);
|
||||
CHECK_NULL_FATAL(be.GetMIRModule().CurFunction());
|
||||
MIRSymbol *sym = be.GetMIRModule().CurFunction()->GetLocalOrGlobalSymbol(dread->GetStIdx());
|
||||
ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(sym->GetTyIdx());
|
||||
} else if (opndOpcode == OP_iread) {
|
||||
IreadNode *iread = static_cast<IreadNode *>(opnd);
|
||||
ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(iread->GetTyIdx());
|
||||
DEBUG_ASSERT(ty->GetKind() == kTypePointer, "expect pointer");
|
||||
ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<MIRPtrType *>(ty)->GetPointedTyIdx());
|
||||
}
|
||||
if (ty == nullptr) { /* type mismatch */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ty = GlobalTables::GetTypeTable().GetTypeTable()[static_cast<uint32>(opnd->GetPrimType())];
|
||||
CCLocInfo ploc;
|
||||
aggCopySize += static_cast<int32>(parmLocator.LocateNextParm(*ty, ploc));
|
||||
if (ploc.reg0 != 0) {
|
||||
@ -111,14 +89,7 @@ void AArch64MemLayout::LayoutFormalParams()
|
||||
SetSizeAlignForTypeIdx(ptyIdx, size, align);
|
||||
symLoc->SetMemSegment(GetSegArgsRegPassed());
|
||||
/* the type's alignment requirement may be smaller than a registser's byte size */
|
||||
if (ty->GetPrimType() == PTY_agg) {
|
||||
/* struct param aligned on 8 byte boundary unless it is small enough */
|
||||
if (CGOptions::IsArm64ilp32()) {
|
||||
align = k8ByteSize;
|
||||
} else {
|
||||
align = GetPointerSize();
|
||||
}
|
||||
}
|
||||
align = GetPointerSize();
|
||||
segArgsRegPassed.SetSize(static_cast<uint32>(RoundUp(segArgsRegPassed.GetSize(), align)));
|
||||
symLoc->SetOffset(segArgsRegPassed.GetSize());
|
||||
segArgsRegPassed.SetSize(segArgsRegPassed.GetSize() + size);
|
||||
@ -184,7 +155,7 @@ void AArch64MemLayout::LayoutLocalVariables(std::vector<MIRSymbol *> &tempVar, s
|
||||
symLoc->SetMemSegment(segLocals);
|
||||
MIRType *ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx);
|
||||
uint32 align = ty->GetAlign();
|
||||
if (ty->GetPrimType() == PTY_agg && align < k8BitSize) {
|
||||
if (align < k8BitSize) {
|
||||
segLocals.SetSize(static_cast<uint32>(RoundUp(segLocals.GetSize(), k8BitSize)));
|
||||
} else {
|
||||
segLocals.SetSize(static_cast<uint32>(RoundUp(segLocals.GetSize(), align)));
|
||||
|
@ -419,10 +419,6 @@ static void HandleDassign(StmtNode &stmt, CGFunc &cgFunc)
|
||||
DEBUG_ASSERT(dassignNode.GetOpCode() == OP_dassign, "expect dassign");
|
||||
BaseNode *rhs = dassignNode.GetRHS();
|
||||
DEBUG_ASSERT(rhs != nullptr, "get rhs of dassignNode failed");
|
||||
if (rhs->GetPrimType() == PTY_agg) {
|
||||
CHECK_FATAL(false, "NIY");
|
||||
return;
|
||||
}
|
||||
bool isSaveRetvalToLocal = false;
|
||||
if (rhs->GetOpCode() == OP_regread) {
|
||||
isSaveRetvalToLocal = (static_cast<RegreadNode *>(rhs)->GetRegIdx() == -kSregRetval0);
|
||||
@ -455,7 +451,7 @@ static void HandleIassign(StmtNode &stmt, CGFunc &cgFunc)
|
||||
{
|
||||
DEBUG_ASSERT(stmt.GetOpCode() == OP_iassign, "expect stmt");
|
||||
auto &iassignNode = static_cast<IassignNode &>(stmt);
|
||||
if ((iassignNode.GetRHS() != nullptr) && iassignNode.GetRHS()->GetPrimType() != PTY_agg) {
|
||||
if ((iassignNode.GetRHS() != nullptr)) {
|
||||
cgFunc.SelectIassign(iassignNode);
|
||||
} else {
|
||||
CHECK_FATAL(false, "NIY");
|
||||
|
@ -389,11 +389,7 @@ void Emitter::EmitAsmLabel(const MIRSymbol &mirSymbol, AsmLabel label)
|
||||
align = Globals::GetInstance()->GetBECommon()->GetTypeAlign(mirSymbol.GetType()->GetTypeIndex());
|
||||
if (GetCG()->GetTargetMachine()->isAArch64() || GetCG()->GetTargetMachine()->isRiscV() ||
|
||||
GetCG()->GetTargetMachine()->isArm32() || GetCG()->GetTargetMachine()->isArk()) {
|
||||
if (CGOptions::IsArm64ilp32() && mirSymbol.GetType()->GetPrimType() == PTY_a32) {
|
||||
align = kAlignOfU8;
|
||||
} else {
|
||||
align = static_cast<uint8>(log2(align));
|
||||
}
|
||||
align = static_cast<uint8>(log2(align));
|
||||
}
|
||||
}
|
||||
Emit(asmInfo->GetAlign());
|
||||
|
@ -163,11 +163,7 @@ static void HandleIassign(StmtNode &stmt, MPISel &iSel)
|
||||
if (opndRhs == nullptr || opndAddr == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (rhs->GetPrimType() != PTY_agg) {
|
||||
iSel.SelectIassign(iassignNode, *opndAddr, *opndRhs);
|
||||
} else {
|
||||
CHECK_FATAL(false, "NIY");
|
||||
}
|
||||
iSel.SelectIassign(iassignNode, *opndAddr, *opndRhs);
|
||||
}
|
||||
|
||||
static void HandleRegassign(StmtNode &stmt, MPISel &iSel)
|
||||
@ -591,20 +587,10 @@ std::pair<FieldID, MIRType *> MPISel::GetFieldIdAndMirTypeFromMirNode(const Base
|
||||
} else if (node.GetOpCode() == maple::OP_iassign) {
|
||||
auto &iassign = static_cast<const IassignNode &>(node);
|
||||
fieldId = iassign.GetFieldID();
|
||||
AddrofNode &addrofNode = static_cast<AddrofNode &>(iassign.GetAddrExprBase());
|
||||
MIRType *iassignMirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(iassign.GetTyIdx());
|
||||
MIRPtrType *pointerType = nullptr;
|
||||
if (iassignMirType->GetPrimType() == PTY_agg) {
|
||||
CHECK_NULL_FATAL(cgFunc->GetMirModule().CurFunction());
|
||||
MIRSymbol *addrSym = cgFunc->GetMirModule().CurFunction()->GetLocalOrGlobalSymbol(addrofNode.GetStIdx());
|
||||
MIRType *addrMirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(addrSym->GetTyIdx());
|
||||
addrMirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(addrMirType->GetTypeIndex());
|
||||
DEBUG_ASSERT(addrMirType->GetKind() == kTypePointer, "non-pointer");
|
||||
pointerType = static_cast<MIRPtrType *>(addrMirType);
|
||||
} else {
|
||||
DEBUG_ASSERT(iassignMirType->GetKind() == kTypePointer, "non-pointer");
|
||||
pointerType = static_cast<MIRPtrType *>(iassignMirType);
|
||||
}
|
||||
DEBUG_ASSERT(iassignMirType->GetKind() == kTypePointer, "non-pointer");
|
||||
pointerType = static_cast<MIRPtrType *>(iassignMirType);
|
||||
mirType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(pointerType->GetPointedTyIdx());
|
||||
} else {
|
||||
CHECK_FATAL(false, "unsupported OpCode");
|
||||
@ -617,10 +603,6 @@ MirTypeInfo MPISel::GetMirTypeInfoFormFieldIdAndMirType(FieldID fieldId, MIRType
|
||||
MirTypeInfo mirTypeInfo;
|
||||
/* fixup primType and offset */
|
||||
mirTypeInfo.primType = mirType->GetPrimType();
|
||||
// aggSize for AggType
|
||||
if (mirTypeInfo.primType == maple::PTY_agg) {
|
||||
mirTypeInfo.size = cgFunc->GetBecommon().GetTypeSize(mirType->GetTypeIndex());
|
||||
}
|
||||
return mirTypeInfo;
|
||||
}
|
||||
|
||||
@ -641,14 +623,7 @@ void MPISel::SelectDassign(const DassignNode &stmt, Operand &opndRhs)
|
||||
/* rhs mirType info */
|
||||
PrimType rhsType = stmt.GetRHS()->GetPrimType();
|
||||
/* Generate Insn */
|
||||
if (rhsType == PTY_agg) {
|
||||
CHECK_FATAL(false, "NIY");
|
||||
return;
|
||||
}
|
||||
PrimType memType = symbolInfo.primType;
|
||||
if (memType == PTY_agg) {
|
||||
memType = PTY_a64;
|
||||
}
|
||||
SelectCopy(symbolMem, opndRhs, memType, rhsType);
|
||||
if (rhsType == PTY_ref) {
|
||||
cgFunc->AddReferenceStackSlot(symbolMem.GetOffsetImmediate()->GetOffsetValue());
|
||||
@ -663,9 +638,6 @@ void MPISel::SelectIassign(const IassignNode &stmt, Operand &opndAddr, Operand &
|
||||
MirTypeInfo symbolInfo = GetMirTypeInfoFromMirNode(stmt);
|
||||
/* handle Lhs, generate (%Rxx) via Rxx*/
|
||||
PrimType memType = symbolInfo.primType;
|
||||
if (memType == PTY_agg) {
|
||||
memType = PTY_a64;
|
||||
}
|
||||
RegOperand &lhsBaseOpnd = SelectCopy2Reg(opndAddr, stmt.Opnd(0)->GetPrimType());
|
||||
MemOperand &lhsMemOpnd =
|
||||
cgFunc->GetOpndBuilder()->CreateMem(lhsBaseOpnd, symbolInfo.offset, GetPrimTypeBitSize(memType));
|
||||
@ -808,11 +780,6 @@ Operand *MPISel::SelectDread(const BaseNode &parent, const AddrofNode &expr)
|
||||
cgFunc->AddReferenceStackSlot(symbolMem.GetOffsetImmediate()->GetOffsetValue());
|
||||
}
|
||||
|
||||
/* for AggType, return it's location in stack. */
|
||||
if (symbolType == maple::PTY_agg) {
|
||||
CHECK_FATAL(primType == maple::PTY_agg, "NIY");
|
||||
return &symbolMem;
|
||||
}
|
||||
/* for BasicType, load symbolVal to register. */
|
||||
RegOperand ®Opnd =
|
||||
cgFunc->GetOpndBuilder()->CreateVReg(GetPrimTypeBitSize(primType), cgFunc->GetRegTyFromPrimTy(primType));
|
||||
@ -1069,32 +1036,6 @@ void MPISel::SelectAdd(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimTyp
|
||||
SelectBasicOp(resOpnd, opnd0, opnd1, mOp, primType);
|
||||
}
|
||||
|
||||
Operand *MPISel::SelectNeg(const UnaryNode &node, Operand &opnd0, const BaseNode &parent)
|
||||
{
|
||||
PrimType dtype = node.GetPrimType();
|
||||
|
||||
RegOperand *resOpnd = nullptr;
|
||||
resOpnd = &cgFunc->GetOpndBuilder()->CreateVReg(GetPrimTypeBitSize(dtype), cgFunc->GetRegTyFromPrimTy(dtype));
|
||||
RegOperand ®Opnd0 = SelectCopy2Reg(opnd0, dtype, node.Opnd(0)->GetPrimType());
|
||||
SelectNeg(*resOpnd, regOpnd0, dtype);
|
||||
return resOpnd;
|
||||
}
|
||||
|
||||
void MPISel::SelectNeg(Operand &resOpnd, Operand &opnd0, PrimType primType)
|
||||
{
|
||||
MOperator mOp = abstract::MOP_undef;
|
||||
if (IsPrimitiveInteger(primType)) {
|
||||
const static auto fastNegMappingFunc = DEF_MOPERATOR_MAPPING_FUNC(neg);
|
||||
mOp = fastNegMappingFunc(GetPrimTypeBitSize(primType));
|
||||
} else {
|
||||
const static auto fastNegFloatMappingFunc = DEF_FLOAT_MOPERATOR_MAPPING_FUNC(neg);
|
||||
mOp = fastNegFloatMappingFunc(GetPrimTypeBitSize(primType));
|
||||
}
|
||||
Insn &insn = cgFunc->GetInsnBuilder()->BuildInsn(mOp, InsnDesc::GetAbstractId(mOp));
|
||||
(void)insn.AddOpndChain(resOpnd).AddOpndChain(opnd0);
|
||||
cgFunc->GetCurBB()->AppendInsn(insn);
|
||||
}
|
||||
|
||||
Operand *MPISel::SelectBior(const BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
|
||||
{
|
||||
PrimType primType = node.GetPrimType();
|
||||
@ -1147,10 +1088,6 @@ Operand *MPISel::SelectIread(const BaseNode &parent, const IreadNode &expr, int
|
||||
MirTypeInfo lhsInfo = GetMirTypeInfoFromMirNode(expr);
|
||||
/* get memOpnd */
|
||||
MemOperand &memOpnd = *GetOrCreateMemOpndFromIreadNode(expr, lhsInfo.primType, lhsInfo.offset + extraOffset);
|
||||
/* for AggType, return addr it self. */
|
||||
if (lhsInfo.primType == PTY_agg) {
|
||||
return &memOpnd;
|
||||
}
|
||||
/* for BasicType, load val in addr to register. */
|
||||
PrimType primType = expr.GetPrimType();
|
||||
RegOperand &result =
|
||||
|
@ -402,18 +402,6 @@ void LiveAnalysis::InitBB(BB &bb)
|
||||
bb.SetUse(*NewUse(maxRegCount));
|
||||
}
|
||||
|
||||
void LiveAnalysis::ClearInOutDataInfo()
|
||||
{
|
||||
FOR_ALL_BB(bb, cgFunc)
|
||||
{
|
||||
bb->SetLiveInChange(false);
|
||||
bb->DefClearDataInfo();
|
||||
bb->UseClearDataInfo();
|
||||
bb->LiveInClearDataInfo();
|
||||
bb->LiveOutClearDataInfo();
|
||||
}
|
||||
}
|
||||
|
||||
void CgLiveAnalysis::GetAnalysisDependence(AnalysisDep &aDep) const
|
||||
{
|
||||
#if TARGX86_64
|
||||
|
@ -152,14 +152,6 @@ void ObjEmitter::WriteObjFile()
|
||||
}
|
||||
}
|
||||
|
||||
void ObjEmitter::AddSymbol(const std::string &name, Word size, const Section §ion, Address value)
|
||||
{
|
||||
auto nameIndex = strTabSection->AddString(name);
|
||||
symbolTabSection->AppendSymbol({static_cast<Word>(nameIndex),
|
||||
static_cast<uint8_t>((STB_GLOBAL << 4) + (STT_SECTION & 0xf)), 0,
|
||||
section.GetIndex(), value, size});
|
||||
}
|
||||
|
||||
void ObjEmitter::AddFuncSymbol(const MapleString &name, Word size, Address value)
|
||||
{
|
||||
auto symbolStrIndex = strTabSection->AddString(name);
|
||||
@ -204,51 +196,6 @@ void ObjEmitter::InitELFHeader()
|
||||
header.e_phnum = 0;
|
||||
}
|
||||
|
||||
void ObjEmitter::EmitMIRIntConst(EmitInfo &emitInfo)
|
||||
{
|
||||
DEBUG_ASSERT(IsPrimitiveScalar(emitInfo.elemConst.GetType().GetPrimType()), "must be primitive type!");
|
||||
MIRIntConst &intConst = static_cast<MIRIntConst &>(emitInfo.elemConst);
|
||||
size_t size = GetPrimTypeSize(emitInfo.elemConst.GetType().GetPrimType());
|
||||
const IntVal &value = intConst.GetValue();
|
||||
int64 val = value.GetExtValue();
|
||||
dataSection->AppendData(&val, size);
|
||||
emitInfo.offset += size;
|
||||
#ifdef OBJ_DEBUG
|
||||
LogInfo::MapleLogger() << val << " size: " << size << "\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjEmitter::EmitMIRAddrofConstCommon(EmitInfo &emitInfo, uint64 specialOffset)
|
||||
{
|
||||
MIRAddrofConst &symAddr = static_cast<MIRAddrofConst &>(emitInfo.elemConst);
|
||||
MIRSymbol *symAddrSym = GlobalTables::GetGsymTable().GetSymbolFromStidx(symAddr.GetSymbolIndex().Idx());
|
||||
DEBUG_ASSERT(symAddrSym != nullptr, "null ptr check");
|
||||
const std::string &symAddrName = symAddrSym->GetName();
|
||||
LabelFixup labelFixup(symAddrName, emitInfo.offset, kLabelFixupDirect64);
|
||||
if (specialOffset != 0) {
|
||||
DataSection::AddLabelFixup(emitInfo.labelFixups, labelFixup);
|
||||
}
|
||||
uint64 value = specialOffset - emitInfo.offset;
|
||||
size_t size = GetPrimTypeSize(emitInfo.elemConst.GetType().GetPrimType());
|
||||
dataSection->AppendData(&value, size);
|
||||
emitInfo.offset += size;
|
||||
|
||||
#ifdef OBJ_DEBUG
|
||||
LogInfo::MapleLogger() << symAddrName << " size: " << size << "\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjEmitter::EmitMIRAddrofConst(EmitInfo &emitInfo)
|
||||
{
|
||||
EmitMIRAddrofConstCommon(emitInfo, 0);
|
||||
}
|
||||
|
||||
void ObjEmitter::EmitMIRAddrofConstOffset(EmitInfo &emitInfo)
|
||||
{
|
||||
/* 2 is fixed offset in runtime */
|
||||
EmitMIRAddrofConstCommon(emitInfo, 2);
|
||||
}
|
||||
|
||||
void ObjEmitter::EmitFunctionSymbolTable(ObjFuncEmitInfo &objFuncEmitInfo, std::vector<uint32> &symbol2Offset)
|
||||
{
|
||||
CGFunc &cgFunc = objFuncEmitInfo.GetCGFunc();
|
||||
|
@ -26,40 +26,6 @@
|
||||
|
||||
namespace maplebe {
|
||||
#if TARGAARCH64
|
||||
int64 CGPeepPattern::GetLogValueAtBase2(int64 val) const
|
||||
{
|
||||
return (__builtin_popcountll(static_cast<uint64>(val)) == 1) ? (__builtin_ffsll(val) - 1) : -1;
|
||||
}
|
||||
|
||||
void CGPeepPattern::DumpAfterPattern(std::vector<Insn *> &prevInsns, const Insn *replacedInsn, const Insn *newInsn)
|
||||
{
|
||||
LogInfo::MapleLogger() << ">>>>>>> In " << GetPatternName() << " : <<<<<<<\n";
|
||||
if (!prevInsns.empty()) {
|
||||
if ((replacedInsn == nullptr) && (newInsn == nullptr)) {
|
||||
LogInfo::MapleLogger() << "======= RemoveInsns : {\n";
|
||||
} else {
|
||||
LogInfo::MapleLogger() << "======= PrevInsns : {\n";
|
||||
}
|
||||
for (auto *prevInsn : prevInsns) {
|
||||
if (prevInsn != nullptr) {
|
||||
LogInfo::MapleLogger() << "[primal form] ";
|
||||
prevInsn->Dump();
|
||||
}
|
||||
}
|
||||
LogInfo::MapleLogger() << "}\n";
|
||||
}
|
||||
if (replacedInsn != nullptr) {
|
||||
LogInfo::MapleLogger() << "======= OldInsn :\n";
|
||||
LogInfo::MapleLogger() << "[primal form] ";
|
||||
replacedInsn->Dump();
|
||||
}
|
||||
if (newInsn != nullptr) {
|
||||
LogInfo::MapleLogger() << "======= NewInsn :\n";
|
||||
LogInfo::MapleLogger() << "[primal form] ";
|
||||
newInsn->Dump();
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if a regOpnd is live after insn. True if live, otherwise false. */
|
||||
bool CGPeepPattern::IfOperandIsLiveAfterInsn(const RegOperand ®Opnd, Insn &insn)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ MemOperand &X64MPIsel::GetOrCreateMemOpndFromSymbol(const MIRSymbol &symbol, Fie
|
||||
int32 fieldOffset = 0;
|
||||
CHECK_FATAL(fieldId == 0, "fieldId must be 0");
|
||||
symType = symbol.GetType()->GetPrimType();
|
||||
uint32 opndSz = (symType == PTY_agg) ? k64BitSize : GetPrimTypeBitSize(symType);
|
||||
uint32 opndSz = GetPrimTypeBitSize(symType);
|
||||
return GetOrCreateMemOpndFromSymbol(symbol, opndSz, fieldOffset);
|
||||
}
|
||||
MemOperand &X64MPIsel::GetOrCreateMemOpndFromSymbol(const MIRSymbol &symbol, uint32 opndSize, int64 offset) const
|
||||
@ -137,10 +137,6 @@ void X64MPIsel::SelectParmList(StmtNode &naryNode, ListOperand &srcOpnds, uint32
|
||||
PrimType primType = argExpr->GetPrimType();
|
||||
DEBUG_ASSERT(primType != PTY_void, "primType should not be void");
|
||||
bool isArgUnused = (callee != nullptr && callee->GetFuncDesc().IsArgUnused(i));
|
||||
if (primType == PTY_agg) {
|
||||
CHECK_FATAL(false, "NIY");
|
||||
continue;
|
||||
}
|
||||
|
||||
Operand *argOpnd = HandleExpr(naryNode, *argExpr);
|
||||
DEBUG_ASSERT(argOpnd != nullptr, "not null check");
|
||||
@ -209,23 +205,6 @@ Operand *X64MPIsel::SelectFloatingConst(MIRConst &floatingConst, PrimType primTy
|
||||
return result;
|
||||
}
|
||||
|
||||
RegOperand *X64MPIsel::PrepareMemcpyParm(MemOperand &memOperand, MOperator mOp)
|
||||
{
|
||||
RegOperand ®Result = cgFunc->GetOpndBuilder()->CreateVReg(k64BitSize, kRegTyInt);
|
||||
Insn &addrInsn = (cgFunc->GetInsnBuilder()->BuildInsn(mOp, X64CG::kMd[mOp]));
|
||||
addrInsn.AddOpndChain(memOperand).AddOpndChain(regResult);
|
||||
cgFunc->GetCurBB()->AppendInsn(addrInsn);
|
||||
return ®Result;
|
||||
}
|
||||
|
||||
RegOperand *X64MPIsel::PrepareMemcpyParm(uint64 copySize)
|
||||
{
|
||||
RegOperand ®Result = cgFunc->GetOpndBuilder()->CreateVReg(k64BitSize, kRegTyInt);
|
||||
ImmOperand &sizeOpnd = cgFunc->GetOpndBuilder()->CreateImm(k64BitSize, copySize);
|
||||
SelectCopy(regResult, sizeOpnd, PTY_i64);
|
||||
return ®Result;
|
||||
}
|
||||
|
||||
Insn &X64MPIsel::AppendCall(x64::X64MOP_t mOp, Operand &targetOpnd, ListOperand ¶mOpnds, ListOperand &retOpnds)
|
||||
{
|
||||
Insn &callInsn = cgFunc->GetInsnBuilder()->BuildInsn(mOp, X64CG::kMd[mOp]);
|
||||
@ -242,7 +221,7 @@ void X64MPIsel::SelectCalleeReturn(MIRType *retType, ListOperand &retOpnds)
|
||||
return;
|
||||
}
|
||||
auto retSize = retType->GetSize() * kBitsPerByte;
|
||||
if (retType->GetPrimType() != PTY_agg || retSize <= k128BitSize) {
|
||||
if (retSize <= k128BitSize) {
|
||||
if (retSize > k0BitSize) {
|
||||
retOpnds.PushOpnd(cgFunc->GetOpndBuilder()->CreatePReg(x64::RAX, k64BitSize, kRegTyInt));
|
||||
}
|
||||
@ -885,12 +864,6 @@ Operand *X64MPIsel::SelectCclz(IntrinsicopNode &node, Operand &opnd0, const Base
|
||||
return &destReg;
|
||||
}
|
||||
|
||||
RegOperand &X64MPIsel::GetTargetStackPointer(PrimType primType)
|
||||
{
|
||||
return cgFunc->GetOpndBuilder()->CreatePReg(x64::RSP, GetPrimTypeBitSize(primType),
|
||||
cgFunc->GetRegTyFromPrimTy(primType));
|
||||
}
|
||||
|
||||
RegOperand &X64MPIsel::GetTargetBasicPointer(PrimType primType)
|
||||
{
|
||||
return cgFunc->GetOpndBuilder()->CreatePReg(x64::RBP, GetPrimTypeBitSize(primType),
|
||||
|
@ -101,14 +101,10 @@ X64ArgInfo X64MoveRegArgs::GetArgInfo(std::map<uint32, X64reg> &argsList, uint32
|
||||
} else if (argInfo.symSize > k16ByteSize) {
|
||||
/* For large struct passing, a pointer to the copy is used. */
|
||||
argInfo.symSize = argInfo.stkSize = GetPointerSize();
|
||||
} else if ((argInfo.mirTy->GetPrimType() == PTY_agg) && (argInfo.symSize < k8ByteSize)) {
|
||||
argInfo.symSize = argInfo.stkSize = k8ByteSize;
|
||||
} else {
|
||||
argInfo.stkSize = (argInfo.symSize < k4ByteSize) ? k4ByteSize : argInfo.symSize;
|
||||
if (argInfo.symSize > k4ByteSize) {
|
||||
argInfo.symSize = k8ByteSize;
|
||||
} else if ((argInfo.mirTy->GetPrimType() == PTY_agg) && (argInfo.symSize <= k4ByteSize)) {
|
||||
argInfo.symSize = k4ByteSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ int32 CCallConventionInfo::Classification(const BECommon &be, MIRType &mirType,
|
||||
case PTY_i8:
|
||||
case PTY_u16:
|
||||
case PTY_i16:
|
||||
case PTY_a32:
|
||||
case PTY_u32:
|
||||
case PTY_i32:
|
||||
case PTY_a64:
|
||||
@ -69,7 +68,6 @@ int32 WebKitJSCallConventionInfo::Classification(const BECommon &be, MIRType &mi
|
||||
case PTY_i8:
|
||||
case PTY_u16:
|
||||
case PTY_i16:
|
||||
case PTY_a32:
|
||||
case PTY_u32:
|
||||
case PTY_i32:
|
||||
classes.push_back(kIntegerClass);
|
||||
@ -102,7 +100,6 @@ int32 GHCCallConventionInfo::Classification(const BECommon &be, MIRType &mirType
|
||||
case PTY_i8:
|
||||
case PTY_u16:
|
||||
case PTY_i16:
|
||||
case PTY_a32:
|
||||
case PTY_u32:
|
||||
case PTY_i32:
|
||||
case PTY_a64:
|
||||
@ -172,7 +169,7 @@ int32 X64CallConvImpl::LocateRetVal(MIRType &retType, CCLocInfo &pLoc)
|
||||
pLoc.reg0 = AllocateGPReturnRegister();
|
||||
DEBUG_ASSERT(nextGeneralReturnRegNO <= GetCallConvInfo().GetIntReturnRegsNum(), "RegNo should be pramRegNO");
|
||||
CHECK_FATAL(nextGeneralReturnRegNO == kOneRegister, "RegNo should be pramRegNO");
|
||||
pLoc.primTypeOfReg0 = retType.GetPrimType() == PTY_agg ? PTY_u64 : retType.GetPrimType();
|
||||
pLoc.primTypeOfReg0 = retType.GetPrimType();
|
||||
return 0;
|
||||
} else if (classes[0] == kFloatClass) {
|
||||
/* If the class is SSE, the next available vector register of the sequence %xmm0, */
|
||||
@ -181,7 +178,7 @@ int32 X64CallConvImpl::LocateRetVal(MIRType &retType, CCLocInfo &pLoc)
|
||||
pLoc.regCount = 1;
|
||||
pLoc.reg0 = AllocateSIMDFPReturnRegister();
|
||||
CHECK_FATAL(nextFloatRetRegNO == kOneRegister, "RegNo should be pramRegNO");
|
||||
pLoc.primTypeOfReg0 = retType.GetPrimType() == PTY_agg ? PTY_f64 : retType.GetPrimType();
|
||||
pLoc.primTypeOfReg0 = retType.GetPrimType();
|
||||
return 0;
|
||||
}
|
||||
CHECK_FATAL(false, "NYI");
|
||||
|
@ -38,24 +38,7 @@ uint32 X64MemLayout::ComputeStackSpaceRequirementForCall(StmtNode &stmt, int32 &
|
||||
for (uint32 anum = 0; i < stmt.NumOpnds(); ++i, ++anum) {
|
||||
BaseNode *opnd = stmt.Opnd(i);
|
||||
MIRType *ty = nullptr;
|
||||
if (opnd->GetPrimType() != PTY_agg) {
|
||||
ty = GlobalTables::GetTypeTable().GetTypeTable()[static_cast<uint32>(opnd->GetPrimType())];
|
||||
} else {
|
||||
Opcode opndOpcode = opnd->GetOpCode();
|
||||
DEBUG_ASSERT(opndOpcode == OP_dread || opndOpcode == OP_iread, "opndOpcode should be OP_dread or OP_iread");
|
||||
if (opndOpcode == OP_dread) {
|
||||
DreadNode *dread = static_cast<DreadNode *>(opnd);
|
||||
CHECK_NULL_FATAL(be.GetMIRModule().CurFunction());
|
||||
MIRSymbol *sym = be.GetMIRModule().CurFunction()->GetLocalOrGlobalSymbol(dread->GetStIdx());
|
||||
ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(sym->GetTyIdx());
|
||||
} else {
|
||||
/* OP_iread */
|
||||
IreadNode *iread = static_cast<IreadNode *>(opnd);
|
||||
ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(iread->GetTyIdx());
|
||||
DEBUG_ASSERT(ty->GetKind() == kTypePointer, "expect pointer");
|
||||
ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<MIRPtrType *>(ty)->GetPointedTyIdx());
|
||||
}
|
||||
}
|
||||
ty = GlobalTables::GetTypeTable().GetTypeTable()[static_cast<uint32>(opnd->GetPrimType())];
|
||||
CCLocInfo ploc;
|
||||
aggCopySize += parmLocator.LocateNextParm(*ty, ploc);
|
||||
if (ploc.reg0 != 0) {
|
||||
@ -159,11 +142,6 @@ void X64MemLayout::LayoutFormalParams()
|
||||
if (!sym->IsPreg()) {
|
||||
SetSizeAlignForTypeIdx(ptyIdx, size, align);
|
||||
symLoc->SetMemSegment(GetSegArgsRegPassed());
|
||||
if (ty->GetPrimType() == PTY_agg &&
|
||||
GlobalTables::GetTypeTable().GetTypeFromTyIdx(ptyIdx)->GetSize() > k4ByteSize) {
|
||||
/* struct param aligned on 8 byte boundary unless it is small enough */
|
||||
align = GetPointerSize();
|
||||
}
|
||||
segArgsRegPassed.SetSize(static_cast<uint32>(RoundUp(segArgsRegPassed.GetSize(), align)));
|
||||
symLoc->SetOffset(segArgsRegPassed.GetSize());
|
||||
segArgsRegPassed.SetSize(segArgsRegPassed.GetSize() + size);
|
||||
@ -196,11 +174,7 @@ void X64MemLayout::LayoutLocalVariables()
|
||||
symLoc->SetMemSegment(segLocals);
|
||||
MIRType *ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx);
|
||||
uint32 align = ty->GetAlign();
|
||||
if (ty->GetPrimType() == PTY_agg && align < k8BitSize) {
|
||||
segLocals.SetSize(static_cast<uint32>(RoundUp(segLocals.GetSize(), k8BitSize)));
|
||||
} else {
|
||||
segLocals.SetSize(static_cast<uint32>(RoundUp(segLocals.GetSize(), align)));
|
||||
}
|
||||
segLocals.SetSize(static_cast<uint32>(RoundUp(segLocals.GetSize(), align)));
|
||||
symLoc->SetOffset(segLocals.GetSize());
|
||||
segLocals.SetSize(segLocals.GetSize() + GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetSize());
|
||||
}
|
||||
|
@ -37,17 +37,14 @@ struct PrimitiveTypeProperty {
|
||||
PrimType type;
|
||||
|
||||
PrimitiveTypeProperty(PrimType type, bool isInteger, bool isUnsigned, bool isAddress, bool isFloat, bool isPointer,
|
||||
bool isSimple, bool isDynamic, bool isDynamicAny, bool isDynamicNone)
|
||||
bool isSimple)
|
||||
: type(type),
|
||||
isInteger(isInteger),
|
||||
isUnsigned(isUnsigned),
|
||||
isAddress(isAddress),
|
||||
isFloat(isFloat),
|
||||
isPointer(isPointer),
|
||||
isSimple(isSimple),
|
||||
isDynamic(isDynamic),
|
||||
isDynamicAny(isDynamicAny),
|
||||
isDynamicNone(isDynamicNone)
|
||||
isSimple(isSimple)
|
||||
{
|
||||
}
|
||||
|
||||
@ -97,18 +94,6 @@ struct PrimitiveTypeProperty {
|
||||
{
|
||||
return isSimple;
|
||||
}
|
||||
bool IsDynamic() const
|
||||
{
|
||||
return isDynamic;
|
||||
}
|
||||
bool IsDynamicAny() const
|
||||
{
|
||||
return isDynamicAny;
|
||||
}
|
||||
bool IsDynamicNone() const
|
||||
{
|
||||
return isDynamicNone;
|
||||
}
|
||||
|
||||
private:
|
||||
bool isInteger;
|
||||
@ -117,9 +102,6 @@ private:
|
||||
bool isFloat;
|
||||
bool isPointer;
|
||||
bool isSimple;
|
||||
bool isDynamic;
|
||||
bool isDynamicAny;
|
||||
bool isDynamicNone;
|
||||
};
|
||||
|
||||
const PrimitiveTypeProperty &GetPrimitiveTypeProperty(PrimType pType);
|
||||
|
@ -182,12 +182,6 @@ public:
|
||||
return typeTable.at(PTY_f64);
|
||||
}
|
||||
|
||||
MIRType *GetFloat128() const
|
||||
{
|
||||
DEBUG_ASSERT(PTY_f128 < typeTable.size(), "array index out of range");
|
||||
return typeTable.at(PTY_f128);
|
||||
}
|
||||
|
||||
MIRType *GetUInt1() const
|
||||
{
|
||||
DEBUG_ASSERT(PTY_u1 < typeTable.size(), "array index out of range");
|
||||
@ -295,12 +289,6 @@ public:
|
||||
return typeTable.at(PTY_ref);
|
||||
}
|
||||
|
||||
MIRType *GetAddr32() const
|
||||
{
|
||||
DEBUG_ASSERT(PTY_a32 < typeTable.size(), "array index out of range");
|
||||
return typeTable.at(PTY_a32);
|
||||
}
|
||||
|
||||
MIRType *GetAddr64() const
|
||||
{
|
||||
DEBUG_ASSERT(PTY_a64 < typeTable.size(), "array index out of range");
|
||||
@ -313,12 +301,6 @@ public:
|
||||
return typeTable.at(PTY_void);
|
||||
}
|
||||
|
||||
MIRType *GetUnknown() const
|
||||
{
|
||||
DEBUG_ASSERT(PTY_unknown < typeTable.size(), "array index out of range");
|
||||
return typeTable.at(PTY_unknown);
|
||||
}
|
||||
|
||||
// Get or Create derived types.
|
||||
MIRType *GetOrCreatePointerType(const TyIdx &pointedTyIdx, PrimType primType = PTY_ptr,
|
||||
const TypeAttrs &attrs = TypeAttrs());
|
||||
|
@ -16,21 +16,21 @@
|
||||
// DEF_MIR_INTRINSIC(STR, NAME, INTRN_CLASS, RETURN_TYPE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5)
|
||||
|
||||
DEF_MIR_INTRINSIC(C_strcmp,\
|
||||
"strcmp", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyI32, kArgTyPtr, kArgTyPtr)
|
||||
"strcmp", kArgTyI32, kArgTyPtr, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(C_strncmp,\
|
||||
"strncmp", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyI32, kArgTyPtr, kArgTyPtr, kArgTyU32)
|
||||
"strncmp", kArgTyI32, kArgTyPtr, kArgTyPtr, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C_strcpy,\
|
||||
"strcpy", 0, kArgTyVoid, kArgTyPtr, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(C_strncpy,\
|
||||
"strncpy", 0, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_strlen,\
|
||||
"strlen", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyU64, kArgTyPtr)
|
||||
"strlen", kArgTyU64, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(C_strchr,\
|
||||
"strchr", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyPtr, kArgTyPtr, kArgTyU32)
|
||||
"strchr", kArgTyPtr, kArgTyPtr, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C_strrchr,\
|
||||
"strrchr", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyPtr, kArgTyPtr, kArgTyU32)
|
||||
"strrchr", kArgTyPtr, kArgTyPtr, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C_memcmp,\
|
||||
"memcmp", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyI32, kArgTyPtr, kArgTyPtr, kArgTyU64)
|
||||
"memcmp", kArgTyI32, kArgTyPtr, kArgTyPtr, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_memcpy,\
|
||||
"memcpy", 0, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_memmove,\
|
||||
@ -38,87 +38,87 @@ DEF_MIR_INTRINSIC(C_memmove,\
|
||||
DEF_MIR_INTRINSIC(C_memset,\
|
||||
"memset", 0, kArgTyVoid, kArgTyPtr, kArgTyI32, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_acosf,\
|
||||
"acosf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"acosf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_asinf,\
|
||||
"asinf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"asinf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_atanf,\
|
||||
"atanf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"atanf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_cosf,\
|
||||
"cosf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"cosf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_coshf,\
|
||||
"coshf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"coshf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_expf,\
|
||||
"expf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"expf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_logf,\
|
||||
"logf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"logf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_log10f,\
|
||||
"log10f", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"log10f", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_sinf,\
|
||||
"sinf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"sinf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_sinhf,\
|
||||
"sinhf", INTRNISPURE, kArgTyF32, kArgTyF32)
|
||||
"sinhf", kArgTyF32, kArgTyF32)
|
||||
DEF_MIR_INTRINSIC(C_acos,\
|
||||
"acos", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"acos", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_asin,\
|
||||
"asin", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"asin", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_atan,\
|
||||
"atan", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"atan", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_cos,\
|
||||
"cos", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"cos", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_cosh,\
|
||||
"cosh", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"cosh", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_exp,\
|
||||
"exp", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"exp", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_log,\
|
||||
"log", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"log", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_log10,\
|
||||
"log10", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"log10", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_sin,\
|
||||
"sin", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"sin", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_sinh,\
|
||||
"sinh", INTRNISPURE, kArgTyF64, kArgTyF64)
|
||||
"sinh", kArgTyF64, kArgTyF64)
|
||||
DEF_MIR_INTRINSIC(C_ffs,\
|
||||
"ffs", INTRNISPURE, kArgTyI32, kArgTyI32)
|
||||
"ffs", kArgTyI32, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C_va_start,\
|
||||
"sinh", INTRNISPURE | INTRNISSPECIAL, kArgTyVoid, kArgTyPtr, kArgTyI32)
|
||||
"sinh", INTRNISSPECIAL, kArgTyVoid, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C_constant_p,\
|
||||
"sinh", 0, kArgTyI32, kArgTyDynany)
|
||||
"sinh", 0, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C_clz32,\
|
||||
"sinh", INTRNISPURE, kArgTyI32, kArgTyU32)
|
||||
"sinh", kArgTyI32, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C_clz64,\
|
||||
"sinh", INTRNISPURE, kArgTyI32, kArgTyU64)
|
||||
"sinh", kArgTyI32, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_ctz32,\
|
||||
"sinh", INTRNISPURE, kArgTyI32, kArgTyU32)
|
||||
"sinh", kArgTyI32, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C_ctz64,\
|
||||
"sinh", INTRNISPURE, kArgTyI32, kArgTyU64)
|
||||
"sinh", kArgTyI32, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_popcount32,\
|
||||
"popcount32", INTRNISPURE, kArgTyI32, kArgTyU32)
|
||||
"popcount32", kArgTyI32, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C_popcount64,\
|
||||
"popcount64", INTRNISPURE, kArgTyI32, kArgTyU64)
|
||||
"popcount64", kArgTyI32, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_parity32,\
|
||||
"parity32", INTRNISPURE, kArgTyI32, kArgTyU32)
|
||||
"parity32", kArgTyI32, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C_parity64,\
|
||||
"parity64", INTRNISPURE, kArgTyI32, kArgTyU64)
|
||||
"parity64", kArgTyI32, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_clrsb32,\
|
||||
"clrsb32", INTRNISPURE, kArgTyI32, kArgTyU32)
|
||||
"clrsb32", kArgTyI32, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C_clrsb64,\
|
||||
"clrsb64", INTRNISPURE, kArgTyI32, kArgTyU64)
|
||||
"clrsb64", kArgTyI32, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_isaligned,\
|
||||
"isaligned", INTRNISPURE, kArgTyU1, kArgTyPtr, kArgTyU64)
|
||||
"isaligned", kArgTyU1, kArgTyPtr, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_alignup,\
|
||||
"alignup", INTRNISPURE, kArgTyU1, kArgTyPtr, kArgTyU64)
|
||||
"alignup", kArgTyU1, kArgTyPtr, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_aligndown,\
|
||||
"aligndown", INTRNISPURE, kArgTyU1, kArgTyPtr, kArgTyU64)
|
||||
"aligndown", kArgTyU1, kArgTyPtr, kArgTyU64)
|
||||
DEF_MIR_INTRINSIC(C_rev16_2,\
|
||||
"rev16", INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI16, kArgTyI16)
|
||||
"rev16", kArgTyI16, kArgTyI16)
|
||||
DEF_MIR_INTRINSIC(C_rev_4,\
|
||||
"rev", INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI32, kArgTyI32)
|
||||
"rev", kArgTyI32, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C_rev_8,\
|
||||
"rev", INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI64, kArgTyI64)
|
||||
"rev", kArgTyI64, kArgTyI64)
|
||||
DEF_MIR_INTRINSIC(C_stack_save,\
|
||||
"stack_save", INTRNISPURE | INTRNISSPECIAL, kArgTyPtr)
|
||||
"stack_save", INTRNISSPECIAL, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(C_stack_restore,\
|
||||
"stack_restore", INTRNISPURE | INTRNISSPECIAL, kArgTyPtr)
|
||||
"stack_restore", INTRNISSPECIAL, kArgTyPtr)
|
||||
// sync
|
||||
DEF_MIR_INTRINSIC(C___sync_add_and_fetch_1,\
|
||||
"__sync_add_and_fetch_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
|
||||
@ -252,51 +252,51 @@ DEF_MIR_INTRINSIC(C___sync_synchronize,\
|
||||
"__sync_synchronize", INTRNATOMIC, kArgTyUndef)
|
||||
|
||||
DEF_MIR_INTRINSIC(C__builtin_return_address,\
|
||||
"__builtin_return_address", INTRNISPURE, kArgTyPtr, kArgTyU32)
|
||||
"__builtin_return_address", kArgTyPtr, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(C__builtin_extract_return_addr,\
|
||||
"__builtin_extract_return_addr", INTRNISPURE, kArgTyPtr, kArgTyPtr)
|
||||
"__builtin_extract_return_addr", kArgTyPtr, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(C___builtin_expect,\
|
||||
"__builtin_expect", INTRNISPURE, kArgTyI32, kArgTyI32, kArgTyI32)
|
||||
"__builtin_expect", kArgTyI32, kArgTyI32, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___builtin_division_exception,\
|
||||
"__builtin_division_exception", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyVoid, kArgTyI64)
|
||||
"__builtin_division_exception", kArgTyVoid, kArgTyI64)
|
||||
|
||||
// atomic
|
||||
DEF_MIR_INTRINSIC(C___atomic_load_n,\
|
||||
"__atomic_load_n", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyI32)
|
||||
"__atomic_load_n", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_load,\
|
||||
"__atomic_load", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_store_n,\
|
||||
"__atomic_store_n", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_store_n", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_store,\
|
||||
"__atomic_store", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_exchange_n,\
|
||||
"__atomic_exchange_n", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_exchange_n", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_exchange,\
|
||||
"__atomic_exchange", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_add_fetch,\
|
||||
"__atomic_add_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_add_fetch", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_sub_fetch,\
|
||||
"__atomic_sub_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_sub_fetch", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_and_fetch,\
|
||||
"__atomic_and_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_and_fetch", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_xor_fetch,\
|
||||
"__atomic_xor_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_xor_fetch", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_or_fetch,\
|
||||
"__atomic_or_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_or_fetch", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_nand_fetch,\
|
||||
"__atomic_nand_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_nand_fetch", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_fetch_add,\
|
||||
"__atomic_fetch_add", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_fetch_add", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_fetch_sub,\
|
||||
"__atomic_fetch_sub", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_fetch_sub", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_fetch_and,\
|
||||
"__atomic_fetch_and", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_fetch_and", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_fetch_xor,\
|
||||
"__atomic_fetch_xor", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_fetch_xor", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_fetch_or,\
|
||||
"__atomic_fetch_or", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_fetch_or", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_fetch_nand,\
|
||||
"__atomic_fetch_nand", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
|
||||
"__atomic_fetch_nand", INTRNATOMIC, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_test_and_set,\
|
||||
"__atomic_test_and_set", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_clear,\
|
||||
@ -310,6 +310,6 @@ DEF_MIR_INTRINSIC(C___atomic_always_lock_free,\
|
||||
DEF_MIR_INTRINSIC(C___atomic_is_lock_free,\
|
||||
"__atomic_is_lock_free", INTRNATOMIC, kArgTyU1, kArgTyU64, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(C___atomic_compare_exchange_n,\
|
||||
"__atomic_compare_exchange_n", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyPtr, kArgTyDynany, kArgTyU1, kArgTyI32, kArgTyI32)
|
||||
"__atomic_compare_exchange_n", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyPtr, kArgTyU1, kArgTyI32, kArgTyI32)
|
||||
DEF_MIR_INTRINSIC(C___atomic_compare_exchange,\
|
||||
"__atomic_compare_exchange", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyPtr, kArgTyPtr, kArgTyU1, kArgTyI32, kArgTyI32)
|
||||
|
@ -15,110 +15,110 @@
|
||||
|
||||
// DEF_MIR_INTRINSIC(STR, NAME, INTRN_CLASS, RETURN_TYPE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5)
|
||||
DEF_MIR_INTRINSIC(JS_INIT_CONTEXT,\
|
||||
"__js_init_context", INTRNISJS, kArgTyVoid, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_init_context", kArgTyVoid, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_REQUIRE,\
|
||||
"__js_require", INTRNISJS | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_require", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_BIOBJECT,\
|
||||
"__jsobj_get_or_create_builtin", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_builtin", kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_BISTRING,\
|
||||
"__jsstr_get_builtin", INTRNISJS | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTySimplestr, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsstr_get_builtin", kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_THIS,\
|
||||
"__jsop_this", INTRNISJS | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_this", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_ADD,\
|
||||
"__jsop_add", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_add", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(ADD_WITH_OVERFLOW,\
|
||||
"__add_with_overflow", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__add_with_overflow", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(SUB_WITH_OVERFLOW,\
|
||||
"__sub_with_overflow", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__sub_with_overflow", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MUL_WITH_OVERFLOW,\
|
||||
"__mul_with_overflow", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mul_with_overflow", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_CONCAT,\
|
||||
"__jsstr_concat_2", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTySimplestr, kArgTySimplestr, kArgTySimplestr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsstr_concat_2", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_STRICTEQ,\
|
||||
"__jsop_stricteq", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyU1, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_stricteq", kArgTyU1, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSSTR_STRICTEQ,\
|
||||
"__jsstr_equal", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyU1, kArgTySimplestr, kArgTySimplestr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsstr_equal", kArgTyU1, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_STRICTNE,\
|
||||
"__jsop_strictne", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyU1, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_strictne", kArgTyU1, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSSTR_STRICTNE,\
|
||||
"__jsstr_ne", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyU1, kArgTySimplestr, kArgTySimplestr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsstr_ne", kArgTyU1, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_INSTANCEOF,\
|
||||
"__jsop_instanceof", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyU1, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_instanceof", kArgTyU1, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_IN,\
|
||||
"__jsop_in", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyU1, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_in", kArgTyU1, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_OR,\
|
||||
"__jsop_or", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI32, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_or", kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_AND,\
|
||||
"__jsop_and", INTRNISJS | INTRNISJSBINARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI32, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_and", kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_TYPEOF,\
|
||||
"__jsop_typeof", INTRNISJS | INTRNISJSUNARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_typeof", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_NEW,\
|
||||
"__js_new", INTRNISJS | INTRNNOSIDEEFFECT, kArgTyPtr, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_new", kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_STRING,\
|
||||
"__js_ToString", INTRNISJS | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTySimplestr, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_ToString", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSSTR_LENGTH,\
|
||||
"__jsstr_get_length", INTRNISJS | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyU32, kArgTySimplestr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsstr_get_length", kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_BOOLEAN,\
|
||||
"__js_ToBoolean", INTRNISJS | INTRNISJSUNARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyU1, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_ToBoolean", kArgTyU1, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_NUMBER,\
|
||||
"__js_ToNumber", INTRNISJS | INTRNISJSUNARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI32, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_ToNumber", kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_INT32,\
|
||||
"__js_ToInt32", INTRNISJS | INTRNISJSUNARY | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI32, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_ToInt32", kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_PRINT,\
|
||||
"__jsop_print", INTRNISJS | INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_print", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_ERROR,\
|
||||
"__js_error", INTRNISJS | INTRNISPURE | INTRNNOSIDEEFFECT | INTRNNEVERRETURN, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_error", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_EVAL,\
|
||||
"__js_eval", kIntrnUndef, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_eval", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_ICALL,\
|
||||
"__js_icall", INTRNISJS | INTRNRETURNSTRUCT, kArgTyDynany, kArgTyA32, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_icall", kArgTyA32, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_CALL,
|
||||
"__jsop_call", INTRNISJS, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_call", kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_CCALL,\
|
||||
"__jsop_ccall", INTRNISJS, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_ccall", kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_NEW,
|
||||
"__jsop_new", INTRNISJS | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_new", kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_SETTIMEOUT,
|
||||
"__js_setTimeout", INTRNISJS | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_setTimeout", kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_SETCYCLEHEADER,\
|
||||
"__js_setCycleHeader", INTRNISJS, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_setCycleHeader", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_NEW_OBJECT_0,\
|
||||
"__js_new_obj_obj_0", INTRNISJS | INTRNNOSIDEEFFECT, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_new_obj_obj_0", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_NEW_OBJECT_1,\
|
||||
"__js_new_obj_obj_1", INTRNISJS | INTRNNOSIDEEFFECT, kArgTySimpleobj, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_new_obj_obj_1", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_SETPROP,\
|
||||
"__jsop_setprop", INTRNISJS, kArgTyVoid, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_setprop", kArgTyVoid, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_GETPROP,\
|
||||
"__jsop_getprop", INTRNISJS | INTRNLOADMEM | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_getprop", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_DELPROP,\
|
||||
"__jsop_delprop", INTRNISJS, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_delprop", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_SETPROP_BY_NAME,\
|
||||
"__jsop_setprop_by_name", INTRNISJS, kArgTyVoid, kArgTyDynany, kArgTySimplestr, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_setprop_by_name", kArgTyVoid, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_GETPROP_BY_NAME,\
|
||||
"__jsop_getprop_by_name", INTRNISJS | INTRNLOADMEM | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTySimplestr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_getprop_by_name", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_SETPROP_BY_INDEX,\
|
||||
"__jsop_setprop_by_index", INTRNISJS, kArgTyVoid, kArgTyDynany, kArgTyU32, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_setprop_by_index", kArgTyVoid, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_GETPROP_BY_INDEX,\
|
||||
"__jsop_getprop_by_index", INTRNISJS | INTRNLOADMEM | INTRNNOSIDEEFFECT, kArgTyDynany, kArgTyDynany, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_getprop_by_index", kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_INITPROP_BY_NAME,\
|
||||
"__jsop_initprop", INTRNISJS, kArgTyVoid, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_initprop", kArgTyVoid, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_INITPROP_GETTER,\
|
||||
"__jsop_initprop_getter", INTRNISJS, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_initprop_getter", kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_INITPROP_SETTER,\
|
||||
"__jsop_initprop_setter", INTRNISJS, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_initprop_setter", kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_NEW_FUNCTION,\
|
||||
"__js_new_function", INTRNISJS, kArgTyDynany, kArgTyPtr, kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_new_function", kArgTyPtr, kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_NEW_ARR_ELEMS,\
|
||||
"__js_new_arr_elems", INTRNISJS | INTRNNOSIDEEFFECT, kArgTySimpleobj, kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_new_arr_elems", kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_NEW_ARR_LENGTH,\
|
||||
"__js_new_arr_length", INTRNISJS | INTRNNOSIDEEFFECT, kArgTySimpleobj, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_new_arr_length", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_LENGTH,\
|
||||
"__jsop_length", INTRNISJS | INTRNLOADMEM | INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyI32, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_length", kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_NEW_ITERATOR,\
|
||||
"__jsop_valueto_iterator", INTRNISJS, kArgTyPtr, kArgTyDynany, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_valueto_iterator", kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_NEXT_ITERATOR,\
|
||||
"__jsop_iterator_next", INTRNISJS, kArgTyDynany, kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_iterator_next", kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_MORE_ITERATOR,\
|
||||
"__jsop_more_iterator", INTRNISJS, kArgTyU32, kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_more_iterator", kArgTyU32, kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_ADDSYSEVENTLISTENER,\
|
||||
"__js_add_sysevent_listener", INTRNISJS, kArgTyU32, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__js_add_sysevent_listener", kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
|
@ -15,20 +15,20 @@
|
||||
|
||||
// DEF_MIR_INTRINSIC(STR, NAME, INTRN_CLASS, RETURN_TYPE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5)
|
||||
DEF_MIR_INTRINSIC(JS_GET_ARGUMENTOBJECT,\
|
||||
"__jsobj_get_or_create_argument", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_argument", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_ERROR_OBJECT,\
|
||||
"__jsobj_get_or_create_error", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_error", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_EVALERROR_OBJECT,\
|
||||
"__jsobj_get_or_create_evalError", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_evalError", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_RANGEERROR_OBJECT,\
|
||||
"__jsobj_get_or_create_rangeError", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_rangeError", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_REFERENCEERROR_OBJECT,\
|
||||
"__jsobj_get_or_create_referenceError", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_referenceError", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_SYNTAXERROR_OBJECT,\
|
||||
"__jsobj_get_or_create_syntaxError", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_syntaxError", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_TYPEERROR_OBJECT,\
|
||||
"__jsobj_get_or_create_typeError", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_typeError", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JS_GET_URIERROR_OBJECT,\
|
||||
"__jsobj_get_or_create_uriError", INTRNISJS | INTRNISPURE, kArgTySimpleobj, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsobj_get_or_create_uriError", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(JSOP_ASSERTVALUE,
|
||||
"__jsop_assert_value", INTRNISJS, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__jsop_assert_value", kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
@ -15,123 +15,123 @@
|
||||
|
||||
// DEF_MIR_INTRINSIC(STR, NAME, INTRN_CLASS, RETURN_TYPE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5)
|
||||
DEF_MIR_INTRINSIC(UNDEFINED,\
|
||||
nullptr, kIntrnUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
nullptr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(DEX_ATOMIC_INC,\
|
||||
"__dex_ainc", kIntrnIsAtomic, kArgTyI32, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__dex_ainc", kIntrnIsAtomic, kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(DEX_ATOMIC_DEC,\
|
||||
"__dex_adec", kIntrnIsAtomic, kArgTyI32, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__dex_adec", kIntrnIsAtomic, kArgTyI32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_ATOMIC_EXCHANGE_PTR,\
|
||||
"__mpl_atomic_exchange_ptr", kIntrnIsAtomic, kArgTyPtr, kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_PROF_COUNTER_INC,\
|
||||
"__mpl_prof_counter_inc", INTRNNOSIDEEFFECT | INTRNISSPECIAL, kArgTyVoid, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mpl_prof_counter_inc", INTRNISSPECIAL, kArgTyVoid, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_CLEAR_STACK,\
|
||||
"__mpl_clear_stack", kIntrnUndef, kArgTyVoid, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mpl_clear_stack", kArgTyVoid, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_GET_VTAB_FUNC,\
|
||||
"MCC_getFuncPtrFromVtab", kIntrnUndef, kArgTyA64, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"MCC_getFuncPtrFromVtab", kArgTyA64, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_READ_OVTABLE_ENTRY,\
|
||||
"__mpl_const_offset", INTRNISPURE, kArgTyA32, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mpl_const_offset", kArgTyA32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_READ_OVTABLE_ENTRY2,\
|
||||
"__mpl_const_offset2", INTRNISPURE, kArgTyA32, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mpl_const_offset2", kArgTyA32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_READ_OVTABLE_ENTRY_LAZY,\
|
||||
"__mpl_const_offset_lazy", INTRNNOSIDEEFFECT, kArgTyA32, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mpl_const_offset_lazy", kArgTyA32, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_READ_OVTABLE_ENTRY_VTAB_LAZY,\
|
||||
"__mpl_const_offset_vtab_lazy", INTRNISPURE, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mpl_const_offset_vtab_lazy", kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_READ_OVTABLE_ENTRY_FIELD_LAZY,\
|
||||
"__mpl_const_offset_field_lazy", INTRNISPURE, kArgTyA32, kArgTyDynany, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mpl_const_offset_field_lazy", kArgTyA32, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_READ_ARRAYCLASS_CACHE_ENTRY,\
|
||||
"__mpl_const_arrayclass_cache", kIntrnUndef, kArgTyPtr, kArgTyU32, kArgTyDynany, kArgTyDynany, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"__mpl_const_arrayclass_cache", kArgTyPtr, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
|
||||
// start of RC Intrinsics with one parameters
|
||||
DEF_MIR_INTRINSIC(MCCSetPermanent,\
|
||||
"MCC_SetObjectPermanent", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef)
|
||||
"MCC_SetObjectPermanent", kArgTyVoid, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCIncRef,\
|
||||
"MCC_IncRef_NaiveRCFast", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef)
|
||||
"MCC_IncRef_NaiveRCFast", kArgTyVoid, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCDecRef,\
|
||||
"MCC_DecRef_NaiveRCFast", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef)
|
||||
"MCC_DecRef_NaiveRCFast", kArgTyVoid, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCDecRefReset,\
|
||||
"MCC_ClearLocalStackRef", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyPtr)
|
||||
"MCC_ClearLocalStackRef", kArgTyVoid, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(MCCLoadRefSVol,\
|
||||
"MCC_LoadVolatileStaticField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef)
|
||||
"MCC_LoadVolatileStaticField", kArgTyVoid, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCLoadRefS,\
|
||||
"MCC_LoadRefStatic", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef)
|
||||
"MCC_LoadRefStatic", kArgTyVoid, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCSetObjectPermanent,\
|
||||
"MCC_SetObjectPermanent", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef)
|
||||
"MCC_SetObjectPermanent", kArgTyVoid, kArgTyRef)
|
||||
|
||||
// start of RC Intrinsics with two parameters
|
||||
DEF_MIR_INTRINSIC(MCCCheck,\
|
||||
"MCC_CheckRefCount", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyU32)
|
||||
"MCC_CheckRefCount", kArgTyVoid, kArgTyRef, kArgTyU32)
|
||||
DEF_MIR_INTRINSIC(MCCCheckArrayStore,\
|
||||
"MCC_Reflect_Check_Arraystore", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_Reflect_Check_Arraystore", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCIncDecRef,\
|
||||
"MCC_IncDecRef_NaiveRCFast", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_IncDecRef_NaiveRCFast", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCIncDecRefReset,\
|
||||
"MCC_IncDecRefReset", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyPtr)
|
||||
"MCC_IncDecRefReset", kArgTyVoid, kArgTyRef, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(MCCDecRefResetPair,\
|
||||
"MCC_DecRefResetPair", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyPtr, kArgTyPtr)
|
||||
"MCC_DecRefResetPair", kArgTyVoid, kArgTyPtr, kArgTyPtr)
|
||||
DEF_MIR_INTRINSIC(MCCLoadWeakVol,\
|
||||
"MCC_LoadVolatileWeakField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_LoadVolatileWeakField", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCLoadWeak,\
|
||||
"MCC_LoadWeakField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_LoadWeakField", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCLoadRef,\
|
||||
"MCC_LoadRefField_NaiveRCFast", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_LoadRefField_NaiveRCFast", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCLoadRefVol,\
|
||||
"MCC_LoadVolatileField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_LoadVolatileField", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteReferent,\
|
||||
"MCC_WriteReferent", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteReferent", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteSVolNoInc,\
|
||||
"MCC_WriteVolatileStaticFieldNoInc", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileStaticFieldNoInc", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteSVolNoDec,\
|
||||
"MCC_WriteVolatileStaticFieldNoDec", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileStaticFieldNoDec", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteSVolNoRC,\
|
||||
"MCC_WriteVolatileStaticFieldNoRC", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileStaticFieldNoRC", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteSVol,\
|
||||
"MCC_WriteVolatileStaticField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileStaticField", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteSNoInc,\
|
||||
"MCC_WriteRefFieldStaticNoInc", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteRefFieldStaticNoInc", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteSNoDec,\
|
||||
"MCC_WriteRefFieldStaticNoDec", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteRefFieldStaticNoDec", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteSNoRC,\
|
||||
"MCC_WriteRefFieldStaticNoRC", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteRefFieldStaticNoRC", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteS,\
|
||||
"MCC_WriteRefFieldStatic", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteRefFieldStatic", kArgTyVoid, kArgTyRef, kArgTyRef)
|
||||
|
||||
// start of RC intrinsics with three parameters
|
||||
DEF_MIR_INTRINSIC(MCCWriteVolNoInc,\
|
||||
"MCC_WriteVolatileFieldNoInc", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileFieldNoInc", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteVolNoDec,\
|
||||
"MCC_WriteVolatileFieldNoDec", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileFieldNoDec", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteVolNoRC,\
|
||||
"MCC_WriteVolatileFieldNoRC", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileFieldNoRC", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteVol,\
|
||||
"MCC_WriteVolatileField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileField", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteNoInc,\
|
||||
"MCC_WriteRefFieldNoInc", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteRefFieldNoInc", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteNoDec,\
|
||||
"MCC_WriteRefFieldNoDec", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteRefFieldNoDec", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteNoRC,\
|
||||
"MCC_WriteRefFieldNoRC", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteRefFieldNoRC", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWrite,\
|
||||
"MCC_WriteRefField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteRefField", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteVolWeak,\
|
||||
"MCC_WriteVolatileWeakField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteVolatileWeakField", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
DEF_MIR_INTRINSIC(MCCWriteWeak,\
|
||||
"MCC_WriteWeakField", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
"MCC_WriteWeakField", kArgTyVoid, kArgTyRef, kArgTyRef, kArgTyRef)
|
||||
|
||||
DEF_MIR_INTRINSIC(MPL_MEMSET_LOCALVAR,\
|
||||
"", kIntrnUndef, kArgTyPtr, kArgTyU32, kArgTyU8, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"", kArgTyPtr, kArgTyU32, kArgTyU8, kArgTyU32, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
DEF_MIR_INTRINSIC(MPL_SET_CLASS,\
|
||||
"", kIntrnUndef, kArgTyPtr, kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
"", kArgTyPtr, kArgTyPtr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
|
||||
// start of GC Intrinsics
|
||||
DEF_MIR_INTRINSIC(MCCGCCheck,\
|
||||
"MCC_CheckObjAllocated", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef)
|
||||
"MCC_CheckObjAllocated", kArgTyVoid, kArgTyRef)
|
||||
|
||||
// start of Profile Intrinsics
|
||||
DEF_MIR_INTRINSIC(MCCSaveProf,\
|
||||
"MCC_SaveProfile", INTRNISRC | INTRNNOSIDEEFFECT, kArgTyVoid, kArgTyRef)
|
||||
"MCC_SaveProfile", kArgTyVoid, kArgTyRef)
|
||||
|
||||
#include "intrinsic_c.def"
|
||||
#include "intrinsic_js.def"
|
||||
#include "intrinsic_js_eng.def"
|
||||
DEF_MIR_INTRINSIC(LAST,\
|
||||
nullptr, kIntrnUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
nullptr, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef, kArgTyUndef)
|
||||
|
@ -20,18 +20,8 @@
|
||||
|
||||
namespace maple {
|
||||
enum IntrinProperty {
|
||||
kIntrnUndef,
|
||||
kIntrnIsJs,
|
||||
kIntrnIsJsUnary,
|
||||
kIntrnIsJsBinary,
|
||||
kIntrnIsReturnStruct,
|
||||
kIntrnNoSideEffect,
|
||||
kIntrnIsLoadMem,
|
||||
kIntrnIsPure,
|
||||
kIntrnNeverReturn,
|
||||
kIntrnIsAtomic,
|
||||
kIntrnIsRC,
|
||||
kIntrnIsSpecial,
|
||||
kIntrnIsSpecial
|
||||
};
|
||||
|
||||
enum IntrinArgType {
|
||||
@ -52,35 +42,10 @@ enum IntrinArgType {
|
||||
kArgTyA64,
|
||||
kArgTyF32,
|
||||
kArgTyF64,
|
||||
kArgTyF128,
|
||||
kArgTyAgg,
|
||||
#ifdef DYNAMICLANG
|
||||
kArgTyDynany,
|
||||
kArgTyDynu32,
|
||||
kArgTyDyni32,
|
||||
kArgTyDynundef,
|
||||
kArgTyDynnull,
|
||||
kArgTyDynhole,
|
||||
kArgTyDynbool,
|
||||
kArgTyDynf64,
|
||||
kArgTyDynf32,
|
||||
kArgTySimplestr,
|
||||
kArgTyDynstr,
|
||||
kArgTySimpleobj,
|
||||
kArgTyDynobj
|
||||
#endif
|
||||
kArgTyF128
|
||||
};
|
||||
|
||||
constexpr uint32 INTRNISJS = 1U << kIntrnIsJs;
|
||||
constexpr uint32 INTRNISJSUNARY = 1U << kIntrnIsJsUnary;
|
||||
constexpr uint32 INTRNISJSBINARY = 1U << kIntrnIsJsBinary;
|
||||
constexpr uint32 INTRNNOSIDEEFFECT = 1U << kIntrnNoSideEffect;
|
||||
constexpr uint32 INTRNRETURNSTRUCT = 1U << kIntrnIsReturnStruct;
|
||||
constexpr uint32 INTRNLOADMEM = 1U << kIntrnIsLoadMem;
|
||||
constexpr uint32 INTRNISPURE = 1U << kIntrnIsPure;
|
||||
constexpr uint32 INTRNNEVERRETURN = 1U << kIntrnNeverReturn;
|
||||
constexpr uint32 INTRNATOMIC = 1U << kIntrnIsAtomic;
|
||||
constexpr uint32 INTRNISRC = 1U << kIntrnIsRC;
|
||||
constexpr uint32 INTRNISSPECIAL = 1U << kIntrnIsSpecial;
|
||||
class MIRType; // circular dependency exists, no other choice
|
||||
class MIRModule; // circular dependency exists, no other choice
|
||||
@ -89,66 +54,16 @@ struct IntrinDesc {
|
||||
const char *name;
|
||||
uint32 properties;
|
||||
IntrinArgType argTypes[1 + kMaxArgsNum]; // argTypes[0] is the return type
|
||||
bool IsJS() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNISJS);
|
||||
}
|
||||
|
||||
bool IsJsUnary() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNISJSUNARY);
|
||||
}
|
||||
|
||||
bool IsJsBinary() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNISJSBINARY);
|
||||
}
|
||||
|
||||
bool IsJsOp() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNISJSUNARY) || static_cast<bool>(properties & INTRNISJSBINARY);
|
||||
}
|
||||
|
||||
bool IsLoadMem() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNLOADMEM);
|
||||
}
|
||||
|
||||
bool IsJsReturnStruct() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNRETURNSTRUCT);
|
||||
}
|
||||
|
||||
bool IsPure() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNISPURE);
|
||||
}
|
||||
|
||||
bool IsNeverReturn() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNNEVERRETURN);
|
||||
}
|
||||
|
||||
bool IsAtomic() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNATOMIC);
|
||||
}
|
||||
|
||||
bool IsRC() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNISRC);
|
||||
}
|
||||
|
||||
bool IsSpecial() const
|
||||
{
|
||||
return static_cast<bool>(properties & INTRNISSPECIAL);
|
||||
}
|
||||
|
||||
bool HasNoSideEffect() const
|
||||
{
|
||||
return properties & INTRNNOSIDEEFFECT;
|
||||
}
|
||||
|
||||
MIRType *GetReturnType() const;
|
||||
MIRType *GetArgType(uint32 index) const;
|
||||
MIRType *GetTypeFromArgTy(IntrinArgType argType) const;
|
||||
|
@ -27,7 +27,6 @@ REGISTER_SAFE_CAST(MIRStrConst, from.GetKind() == kConstStrConst);
|
||||
REGISTER_SAFE_CAST(MIRStr16Const, from.GetKind() == kConstStr16Const);
|
||||
REGISTER_SAFE_CAST(MIRFloatConst, from.GetKind() == kConstFloatConst);
|
||||
REGISTER_SAFE_CAST(MIRDoubleConst, from.GetKind() == kConstDoubleConst);
|
||||
REGISTER_SAFE_CAST(MIRFloat128Const, from.GetKind() == kConstFloat128Const);
|
||||
REGISTER_SAFE_CAST(MIRAggConst, from.GetKind() == kConstAggConst);
|
||||
REGISTER_SAFE_CAST(MIRStConst, from.GetKind() == kConstStConst);
|
||||
#endif
|
||||
|
@ -536,57 +536,6 @@ private:
|
||||
} value;
|
||||
};
|
||||
|
||||
class MIRFloat128Const : public MIRConst {
|
||||
public:
|
||||
MIRFloat128Const(const uint64 &val, MIRType &type) : MIRConst(type, kConstFloat128Const)
|
||||
{
|
||||
value = &val;
|
||||
}
|
||||
|
||||
~MIRFloat128Const() = default;
|
||||
|
||||
const uint64 *GetIntValue() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
static PrimType GetPrimType()
|
||||
{
|
||||
return kPrimType;
|
||||
}
|
||||
|
||||
bool IsZero() const override
|
||||
{
|
||||
MIR_ASSERT(value && "value must not be nullptr!");
|
||||
return value[0] == 0 && value[1] == 0;
|
||||
}
|
||||
|
||||
bool IsOne() const override
|
||||
{
|
||||
MIR_ASSERT(value && "value must not be nullptr!");
|
||||
return value[0] == 0 && value[1] == 0x3FFF000000000000;
|
||||
};
|
||||
bool IsAllBitsOne() const
|
||||
{
|
||||
MIR_ASSERT(value && "value must not be nullptr!");
|
||||
return (value[0] == 0xffffffffffffffff && value[1] == 0xffffffffffffffff);
|
||||
};
|
||||
bool operator==(const MIRConst &rhs) const override;
|
||||
|
||||
MIRFloat128Const *Clone(MemPool &memPool) const override
|
||||
{
|
||||
auto *res = memPool.New<MIRFloat128Const>(*this);
|
||||
return res;
|
||||
}
|
||||
#ifdef ARK_LITECG_DEBUG
|
||||
void Dump(const MIRSymbolTable *localSymTab) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
static const PrimType kPrimType = PTY_f128;
|
||||
// value[0]: Low 64 bits; value[1]: High 64 bits.
|
||||
const uint64 *value;
|
||||
};
|
||||
|
||||
class MIRAggConst : public MIRConst {
|
||||
public:
|
||||
|
@ -547,17 +547,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
uint8 GetSymbolAlign(bool isArm64ilp32) const
|
||||
uint8 GetSymbolAlign() const
|
||||
{
|
||||
uint8 align = GetAttrs().GetAlignValue();
|
||||
if (align == 0) {
|
||||
align = static_cast<uint8>(GetType()->GetAlign());
|
||||
if (Triple::GetTriple().IsAarch64BeOrLe()) {
|
||||
if (isArm64ilp32 && GetType()->GetPrimType() == PTY_a32) {
|
||||
align = 3; // 3: alignment in bytes of uint8
|
||||
} else {
|
||||
align = static_cast<uint8>(log2(align));
|
||||
}
|
||||
align = static_cast<uint8>(log2(align));
|
||||
}
|
||||
}
|
||||
return align;
|
||||
|
@ -106,13 +106,13 @@ inline bool IsPossible64BitAddress(PrimType tp)
|
||||
|
||||
inline bool IsPossible32BitAddress(PrimType tp)
|
||||
{
|
||||
return (tp == PTY_ptr || tp == PTY_ref || tp == PTY_u32 || tp == PTY_a32);
|
||||
return (tp == PTY_ptr || tp == PTY_ref || tp == PTY_u32);
|
||||
}
|
||||
|
||||
|
||||
inline bool IsPrimitivePureScalar(PrimitiveType primitiveType)
|
||||
{
|
||||
return primitiveType.IsInteger() && !primitiveType.IsAddress() && !primitiveType.IsDynamic();
|
||||
return primitiveType.IsInteger() && !primitiveType.IsAddress();
|
||||
}
|
||||
|
||||
inline bool IsPrimitiveUnsigned(PrimitiveType primitiveType)
|
||||
@ -122,38 +122,27 @@ inline bool IsPrimitiveUnsigned(PrimitiveType primitiveType)
|
||||
|
||||
inline bool IsUnsignedInteger(PrimitiveType primitiveType)
|
||||
{
|
||||
return IsPrimitiveUnsigned(primitiveType) && primitiveType.IsInteger() && !primitiveType.IsDynamic();
|
||||
return IsPrimitiveUnsigned(primitiveType) && primitiveType.IsInteger();
|
||||
}
|
||||
|
||||
inline bool IsSignedInteger(PrimitiveType primitiveType)
|
||||
{
|
||||
return !IsPrimitiveUnsigned(primitiveType) && primitiveType.IsInteger() && !primitiveType.IsDynamic();
|
||||
return !IsPrimitiveUnsigned(primitiveType) && primitiveType.IsInteger();
|
||||
}
|
||||
|
||||
inline bool IsPrimitiveInteger(PrimitiveType primitiveType)
|
||||
{
|
||||
return primitiveType.IsInteger() && !primitiveType.IsDynamic();
|
||||
}
|
||||
|
||||
inline bool IsPrimitiveDynType(PrimitiveType primitiveType)
|
||||
{
|
||||
return primitiveType.IsDynamic();
|
||||
}
|
||||
|
||||
inline bool IsPrimitiveDynInteger(PrimitiveType primitiveType)
|
||||
{
|
||||
return primitiveType.IsDynamic() && primitiveType.IsInteger();
|
||||
return primitiveType.IsInteger();
|
||||
}
|
||||
|
||||
inline bool IsPrimitiveFloat(PrimitiveType primitiveType)
|
||||
{
|
||||
return primitiveType.IsFloat() && !primitiveType.IsDynamic();
|
||||
return primitiveType.IsFloat();
|
||||
}
|
||||
|
||||
inline bool IsPrimitiveScalar(PrimitiveType primitiveType)
|
||||
{
|
||||
return primitiveType.IsInteger() || primitiveType.IsFloat() ||
|
||||
(primitiveType.IsDynamic() && !primitiveType.IsDynamicNone()) || primitiveType.IsSimple();
|
||||
return primitiveType.IsInteger() || primitiveType.IsFloat() || primitiveType.IsSimple();
|
||||
}
|
||||
|
||||
inline bool IsPrimitivePoint(PrimitiveType primitiveType)
|
||||
@ -708,8 +697,12 @@ class MIRFuncType;
|
||||
|
||||
class MIRType {
|
||||
public:
|
||||
MIRType(MIRTypeKind kind) : typeKind(kind) {}
|
||||
|
||||
MIRType(MIRTypeKind kind, PrimType pType) : typeKind(kind), primType(pType) {}
|
||||
|
||||
MIRType(MIRTypeKind kind, GStrIdx strIdx) : typeKind(kind), nameStrIdx(strIdx) {}
|
||||
|
||||
MIRType(MIRTypeKind kind, PrimType pType, GStrIdx strIdx) : typeKind(kind), primType(pType), nameStrIdx(strIdx) {}
|
||||
|
||||
virtual ~MIRType() = default;
|
||||
@ -922,11 +915,11 @@ private:
|
||||
|
||||
class MIRArrayType : public MIRType {
|
||||
public:
|
||||
MIRArrayType() : MIRType(kTypeArray, PTY_agg) {}
|
||||
explicit MIRArrayType(GStrIdx strIdx) : MIRType(kTypeArray, PTY_agg, strIdx) {}
|
||||
MIRArrayType() : MIRType(kTypeArray) {}
|
||||
explicit MIRArrayType(GStrIdx strIdx) : MIRType(kTypeArray, strIdx) {}
|
||||
|
||||
MIRArrayType(TyIdx eTyIdx, const std::vector<uint64> &sizeArray)
|
||||
: MIRType(kTypeArray, PTY_agg), eTyIdx(eTyIdx), dim(sizeArray.size())
|
||||
: MIRType(kTypeArray), eTyIdx(eTyIdx), dim(sizeArray.size())
|
||||
{
|
||||
for (size_t i = 0; i < kMaxArrayDim; ++i) {
|
||||
this->sizeArray[i] = (i < dim) ? sizeArray[i] : 0;
|
||||
|
@ -28,12 +28,9 @@
|
||||
PRIMTYPE(u1)
|
||||
PRIMTYPE(ptr)
|
||||
PRIMTYPE(ref)
|
||||
PRIMTYPE(a32)
|
||||
PRIMTYPE(a64)
|
||||
PRIMTYPE(f32)
|
||||
PRIMTYPE(f64)
|
||||
PRIMTYPE(f128)
|
||||
PRIMTYPE(agg)
|
||||
PRIMTYPE(unknown)
|
||||
#endif // ~LOAD_ALGO_PRIMARY_TYPE
|
||||
|
||||
@ -43,109 +40,94 @@
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_begin = {
|
||||
/*type=*/PTY_begin, /*isInteger=*/false, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_void = {
|
||||
/*type=*/PTY_void, /*isInteger=*/false, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_i8 = {
|
||||
/*type=*/PTY_i8, /*isInteger=*/true, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_i16 = {
|
||||
/*type=*/PTY_i16, /*isInteger=*/true, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_i32 = {
|
||||
/*type=*/PTY_i32, /*isInteger=*/true, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_i64 = {
|
||||
/*type=*/PTY_i64, /*isInteger=*/true, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_u8 = {
|
||||
/*type=*/PTY_u8, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_u16 = {
|
||||
/*type=*/PTY_u16, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
/* isAddress and isPointer are overloaded in getter method for PTProperty_u32 */
|
||||
static const PrimitiveTypeProperty PTProperty_u32 = {
|
||||
/*type=*/PTY_u32, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
/* isAddress and isPointer are overloaded in getter method for PTProperty_64 */
|
||||
static const PrimitiveTypeProperty PTProperty_u64 = {
|
||||
/*type=*/PTY_u64, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/true, /*isFloat=*/false,
|
||||
/*isPointer=*/true, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false,
|
||||
/*isPointer=*/true, /*isSimple=*/false,
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_u1 = {
|
||||
/*type=*/PTY_u1, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_ptr = {
|
||||
/*type=*/PTY_ptr, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/true, /*isFloat=*/false,
|
||||
/*isPointer=*/true, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/true, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_ref = {
|
||||
/*type=*/PTY_ref, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/true, /*isFloat=*/false,
|
||||
/*isPointer=*/true, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_a32 = {
|
||||
/*type=*/PTY_a32, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/true, /*isFloat=*/false,
|
||||
/*isPointer=*/true, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/true, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_a64 = {
|
||||
/*type=*/PTY_a64, /*isInteger=*/true, /*isUnsigned=*/true, /*isAddress=*/true, /*isFloat=*/false,
|
||||
/*isPointer=*/true, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/true, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_f32 = {
|
||||
/*type=*/PTY_f32, /*isInteger=*/false, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/true,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_f64 = {
|
||||
/*type=*/PTY_f64, /*isInteger=*/false, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/true,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_f128 = {
|
||||
/*type=*/PTY_f128, /*isInteger=*/false, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/true,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_agg = {
|
||||
/*type=*/PTY_agg, /*isInteger=*/false, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_unknown = {
|
||||
/*type=*/PTY_unknown, /*isInteger=*/false, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
static const PrimitiveTypeProperty PTProperty_end = {
|
||||
/*type=*/PTY_end, /*isInteger=*/false, /*isUnsigned=*/false, /*isAddress=*/false, /*isFloat=*/false,
|
||||
/*isPointer=*/false, /*isSimple=*/false, /*isDynamic=*/false, /*isDynamicAny=*/false, /*isDynamicNone=*/false
|
||||
/*isPointer=*/false, /*isSimple=*/false
|
||||
};
|
||||
|
||||
#endif // ~LOAD_PRIMARY_TYPE_PROPERTY
|
||||
|
@ -50,23 +50,10 @@ public:
|
||||
{
|
||||
return property.IsPointer();
|
||||
}
|
||||
bool IsDynamic() const
|
||||
{
|
||||
return property.IsDynamic();
|
||||
}
|
||||
bool IsSimple() const
|
||||
{
|
||||
return property.IsSimple();
|
||||
}
|
||||
bool IsDynamicAny() const
|
||||
{
|
||||
return property.IsDynamicAny();
|
||||
}
|
||||
bool IsDynamicNone() const
|
||||
{
|
||||
return property.IsDynamicNone();
|
||||
}
|
||||
|
||||
private:
|
||||
const PrimitiveTypeProperty &property;
|
||||
};
|
||||
|
@ -60,18 +60,12 @@ MIRType *IntrinDesc::GetTypeFromArgTy(IntrinArgType argType) const
|
||||
return GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<TyIdx>(PTY_ptr));
|
||||
case kArgTyRef:
|
||||
return GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<TyIdx>(PTY_ref));
|
||||
case kArgTyA32:
|
||||
return GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<TyIdx>(PTY_a32));
|
||||
case kArgTyA64:
|
||||
return GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<TyIdx>(PTY_a64));
|
||||
case kArgTyF32:
|
||||
return GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<TyIdx>(PTY_f32));
|
||||
case kArgTyF64:
|
||||
return GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<TyIdx>(PTY_f64));
|
||||
case kArgTyF128:
|
||||
return GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<TyIdx>(PTY_f128));
|
||||
case kArgTyAgg:
|
||||
return GlobalTables::GetTypeTable().GetTypeFromTyIdx(static_cast<TyIdx>(PTY_agg));
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -223,8 +223,6 @@ IreadNode *MIRBuilder::CreateExprIread(const MIRType &returnType, const MIRType
|
||||
TyIdx returnTypeIdx = returnType.GetTypeIndex();
|
||||
CHECK(returnTypeIdx < GlobalTables::GetTypeTable().GetTypeTable().size(),
|
||||
"index out of range in MIRBuilder::CreateExprIread");
|
||||
DEBUG_ASSERT(fieldID != 0 || ptrType.GetPrimType() != PTY_agg,
|
||||
"Error: Fieldid should not be 0 when trying to iread a field from type ");
|
||||
PrimType type = GetRegPrimType(returnType.GetPrimType());
|
||||
return NewNode<IreadNode>(OP_iread, type, ptrType.GetTypeIndex(), fieldID, addr);
|
||||
}
|
||||
|
@ -182,21 +182,6 @@ bool MIRDoubleConst::operator==(const MIRConst &rhs) const
|
||||
return (floatConst.value.intValue == value.intValue);
|
||||
}
|
||||
|
||||
bool MIRFloat128Const::operator==(const MIRConst &rhs) const
|
||||
{
|
||||
if (&rhs == this) {
|
||||
return true;
|
||||
}
|
||||
if (GetKind() != rhs.GetKind()) {
|
||||
return false;
|
||||
}
|
||||
const auto &floatConst = static_cast<const MIRFloat128Const &>(rhs);
|
||||
if ((value[0] == floatConst.value[0]) && (value[1] == floatConst.value[1])) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MIRAggConst::operator==(const MIRConst &rhs) const
|
||||
{
|
||||
if (&rhs == this) {
|
||||
@ -228,16 +213,6 @@ void MIRDoubleConst::Dump(const MIRSymbolTable *) const
|
||||
LogInfo::MapleLogger() << std::setprecision(std::numeric_limits<double>::max_digits10) << value.dValue;
|
||||
}
|
||||
|
||||
void MIRFloat128Const::Dump(const MIRSymbolTable *) const
|
||||
{
|
||||
constexpr int fieldWidth = 16;
|
||||
std::ios::fmtflags f(LogInfo::MapleLogger().flags());
|
||||
LogInfo::MapleLogger().setf(std::ios::uppercase);
|
||||
LogInfo::MapleLogger() << "0xL" << std::hex << std::setfill('0') << std::setw(fieldWidth) << value[0]
|
||||
<< std::setfill('0') << std::setw(fieldWidth) << value[1];
|
||||
LogInfo::MapleLogger().flags(f);
|
||||
}
|
||||
|
||||
void MIRAggConst::Dump(const MIRSymbolTable *localSymTab) const
|
||||
{
|
||||
LogInfo::MapleLogger() << "[";
|
||||
|
@ -359,10 +359,6 @@ BlockNode *MIRLower::LowerBlock(BlockNode &block)
|
||||
MIRFuncType *funcType = FuncTypeFromFuncPtrExpr(stmt->Opnd(0));
|
||||
CHECK_FATAL(funcType != nullptr, "MIRLower::LowerBlock: cannot find prototype for icall");
|
||||
ic->SetRetTyIdx(funcType->GetTypeIndex());
|
||||
MIRType *retType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(funcType->GetRetTyIdx());
|
||||
if (retType->GetPrimType() == PTY_agg && retType->GetSize() > k16BitSize) {
|
||||
funcType->funcAttrs.SetAttr(FUNCATTR_firstarg_return);
|
||||
}
|
||||
}
|
||||
newBlock->AddStatement(stmt);
|
||||
break;
|
||||
|
@ -134,13 +134,11 @@ uint8 GetPointerSize()
|
||||
|
||||
PrimType GetLoweredPtrType()
|
||||
{
|
||||
#if TARGX86 || TARGARM32 || TARGVM
|
||||
return PTY_a32;
|
||||
#elif TARGX86_64 || TARGAARCH64
|
||||
#if TARGX86_64 || TARGAARCH64
|
||||
if (Triple::GetTriple().GetArch() == Triple::ArchType::x64) {
|
||||
return PTY_a64;
|
||||
} else if (Triple::GetTriple().GetArch() == Triple::ArchType::aarch64) {
|
||||
auto pty = (Triple::GetTriple().GetEnvironment() == Triple::GNUILP32) ? PTY_a32 : PTY_a64;
|
||||
auto pty = PTY_a64;
|
||||
return pty;
|
||||
} else {
|
||||
CHECK_FATAL(false, "Unsupported target");
|
||||
@ -152,7 +150,7 @@ PrimType GetLoweredPtrType()
|
||||
|
||||
PrimType GetExactPtrPrimType()
|
||||
{
|
||||
return (GetPointerSize() == k8ByteSize) ? PTY_a64 : PTY_a32;
|
||||
return PTY_a64;
|
||||
}
|
||||
|
||||
// answer in bytes; 0 if unknown
|
||||
@ -160,7 +158,6 @@ uint32 GetPrimTypeSize(PrimType primType)
|
||||
{
|
||||
switch (primType) {
|
||||
case PTY_void:
|
||||
case PTY_agg:
|
||||
return k0BitSize;
|
||||
case PTY_ptr:
|
||||
case PTY_ref:
|
||||
@ -172,7 +169,6 @@ uint32 GetPrimTypeSize(PrimType primType)
|
||||
case PTY_i16:
|
||||
case PTY_u16:
|
||||
return k2BitSize;
|
||||
case PTY_a32:
|
||||
case PTY_f32:
|
||||
case PTY_i32:
|
||||
case PTY_u32:
|
||||
@ -182,8 +178,6 @@ uint32 GetPrimTypeSize(PrimType primType)
|
||||
case PTY_i64:
|
||||
case PTY_u64:
|
||||
return k8BitSize;
|
||||
case PTY_f128:
|
||||
return k16BitSize;
|
||||
default:
|
||||
return k0BitSize;
|
||||
}
|
||||
@ -306,9 +300,6 @@ void MIRType::DumpAsCxx(int indent) const
|
||||
case PTY_ref:
|
||||
LogInfo::MapleLogger() << "void* ";
|
||||
break;
|
||||
case PTY_a32:
|
||||
LogInfo::MapleLogger() << "int32";
|
||||
break;
|
||||
case PTY_a64:
|
||||
LogInfo::MapleLogger() << "void* ";
|
||||
break;
|
||||
|
@ -659,7 +659,7 @@ MIRConst *ConstantFold::FoldConstComparisonMIRConst(Opcode opcode, PrimType resu
|
||||
const MIRConst &const0, const MIRConst &const1) const
|
||||
{
|
||||
MIRConst *returnValue = nullptr;
|
||||
if (IsPrimitiveInteger(opndType) || IsPrimitiveDynInteger(opndType)) {
|
||||
if (IsPrimitiveInteger(opndType)) {
|
||||
const auto *intConst0 = safe_cast<MIRIntConst>(&const0);
|
||||
const auto *intConst1 = safe_cast<MIRIntConst>(&const1);
|
||||
ASSERT_NOT_NULL(intConst0);
|
||||
@ -677,7 +677,7 @@ ConstvalNode *ConstantFold::FoldConstComparison(Opcode opcode, PrimType resultTy
|
||||
const ConstvalNode &const0, const ConstvalNode &const1) const
|
||||
{
|
||||
ConstvalNode *returnValue = nullptr;
|
||||
if (IsPrimitiveInteger(opndType) || IsPrimitiveDynInteger(opndType)) {
|
||||
if (IsPrimitiveInteger(opndType)) {
|
||||
returnValue = FoldIntConstComparison(opcode, resultType, opndType, const0, const1);
|
||||
} else if (opndType == PTY_f32 || opndType == PTY_f64) {
|
||||
returnValue = FoldFPConstComparison(opcode, resultType, opndType, const0, const1);
|
||||
@ -729,7 +729,7 @@ ConstvalNode *ConstantFold::FoldConstBinary(Opcode opcode, PrimType resultType,
|
||||
const ConstvalNode &const1) const
|
||||
{
|
||||
ConstvalNode *returnValue = nullptr;
|
||||
if (IsPrimitiveInteger(resultType) || IsPrimitiveDynInteger(resultType)) {
|
||||
if (IsPrimitiveInteger(resultType)) {
|
||||
returnValue = FoldIntConstBinary(opcode, resultType, const0, const1);
|
||||
} else if (resultType == PTY_f32 || resultType == PTY_f64) {
|
||||
returnValue = FoldFPConstBinary(opcode, resultType, const0, const1);
|
||||
@ -828,7 +828,7 @@ ConstvalNode *ConstantFold::FoldFPConstUnary(Opcode opcode, PrimType resultType,
|
||||
ConstvalNode *ConstantFold::FoldConstUnary(Opcode opcode, PrimType resultType, ConstvalNode &constNode) const
|
||||
{
|
||||
ConstvalNode *returnValue = nullptr;
|
||||
if (IsPrimitiveInteger(resultType) || IsPrimitiveDynInteger(resultType)) {
|
||||
if (IsPrimitiveInteger(resultType)) {
|
||||
const MIRIntConst *cst = safe_cast<MIRIntConst>(constNode.GetConstVal());
|
||||
auto constValue = FoldIntConstUnaryMIRConst(opcode, resultType, cst);
|
||||
returnValue = mirModule->CurFuncCodeMemPool()->New<ConstvalNode>();
|
||||
@ -838,8 +838,6 @@ ConstvalNode *ConstantFold::FoldConstUnary(Opcode opcode, PrimType resultType, C
|
||||
returnValue = FoldFPConstUnary<MIRFloatConst>(opcode, resultType, &constNode);
|
||||
} else if (resultType == PTY_f64) {
|
||||
returnValue = FoldFPConstUnary<MIRDoubleConst>(opcode, resultType, &constNode);
|
||||
} else if (resultType == PTY_f128) {
|
||||
DEBUG_ASSERT(false, "Unhandled case for FoldConstUnary");
|
||||
} else {
|
||||
DEBUG_ASSERT(false, "Unhandled case for FoldConstUnary");
|
||||
}
|
||||
@ -1050,11 +1048,6 @@ ConstvalNode *ConstantFold::FoldFloor(const ConstvalNode &cst, PrimType fromType
|
||||
|
||||
MIRConst *ConstantFold::FoldRoundMIRConst(const MIRConst &cst, PrimType fromType, PrimType toType) const
|
||||
{
|
||||
if (fromType == PTY_f128 || toType == PTY_f128) {
|
||||
// folding while rounding float128 is not supported yet
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MIRType &resultType = *GlobalTables::GetTypeTable().GetPrimType(toType);
|
||||
if (fromType == PTY_f32) {
|
||||
const auto &constValue = static_cast<const MIRFloatConst&>(cst);
|
||||
@ -1148,15 +1141,6 @@ ConstvalNode *ConstantFold::FoldTrunc(const ConstvalNode &cst, PrimType fromType
|
||||
|
||||
MIRConst *ConstantFold::FoldTypeCvtMIRConst(const MIRConst &cst, PrimType fromType, PrimType toType) const
|
||||
{
|
||||
if (IsPrimitiveDynType(fromType) || IsPrimitiveDynType(toType)) {
|
||||
// do not fold
|
||||
return nullptr;
|
||||
}
|
||||
if (fromType == PTY_f128 || toType == PTY_f128) {
|
||||
// folding while Cvt float128 is not supported yet
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (IsPrimitiveInteger(fromType) && IsPrimitiveInteger(toType)) {
|
||||
MIRConst *toConst = nullptr;
|
||||
uint32 fromSize = GetPrimTypeBitSize(fromType);
|
||||
@ -1248,9 +1232,6 @@ PrimType GetNearestSizePtyp(uint8 bitSize, PrimType ptyp)
|
||||
if (bitSize <= 64) { // 64 bit
|
||||
return isFloat ? PTY_f64 : (isSigned ? PTY_i64 : PTY_u64);
|
||||
}
|
||||
if (bitSize <= 128) { // 128 bit
|
||||
return PTY_f128;
|
||||
}
|
||||
return ptyp;
|
||||
}
|
||||
|
||||
@ -1535,10 +1516,6 @@ std::pair<BaseNode*, std::optional<IntVal>> ConstantFold::FoldBinary(BinaryNode
|
||||
PrimType primType = node->GetPrimType();
|
||||
PrimType lPrimTypes = node->Opnd(0)->GetPrimType();
|
||||
PrimType rPrimTypes = node->Opnd(1)->GetPrimType();
|
||||
if (lPrimTypes == PTY_f128 || rPrimTypes == PTY_f128 || node->GetPrimType() == PTY_f128) {
|
||||
// folding of non-unary float128 is not supported yet
|
||||
return std::make_pair(static_cast<BaseNode*>(node), std::nullopt);
|
||||
}
|
||||
std::pair<BaseNode*, std::optional<IntVal>> lp = DispatchFold(node->Opnd(0));
|
||||
std::pair<BaseNode*, std::optional<IntVal>> rp = DispatchFold(node->Opnd(1));
|
||||
BaseNode *l = lp.first;
|
||||
@ -1889,12 +1866,8 @@ std::pair<BaseNode*, std::optional<IntVal>> ConstantFold::FoldCompare(CompareNod
|
||||
std::pair<BaseNode*, std::optional<IntVal>> rp = DispatchFold(node->Opnd(1));
|
||||
ConstvalNode *lConst = safe_cast<ConstvalNode>(lp.first);
|
||||
ConstvalNode *rConst = safe_cast<ConstvalNode>(rp.first);
|
||||
if (node->GetOpndType() == PTY_f128 || node->GetPrimType() == PTY_f128) {
|
||||
// folding of non-unary float128 is not supported yet
|
||||
return std::make_pair(static_cast<BaseNode*>(node), std::nullopt);
|
||||
}
|
||||
Opcode opcode = node->GetOpCode();
|
||||
if (lConst != nullptr && rConst != nullptr && !IsPrimitiveDynType(node->GetOpndType())) {
|
||||
if (lConst != nullptr && rConst != nullptr) {
|
||||
result = FoldConstComparison(node->GetOpCode(), node->GetPrimType(), node->GetOpndType(), *lConst, *rConst);
|
||||
} else if (lConst != nullptr && rConst == nullptr && opcode != OP_cmp &&
|
||||
lConst->GetConstVal()->GetKind() == kConstInt) {
|
||||
|
Loading…
Reference in New Issue
Block a user