1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

var-return support for const eval methods

This commit is contained in:
Brian Fiete 2020-12-30 13:24:13 -08:00
parent 585e2575e8
commit 706fe9e04b
15 changed files with 292 additions and 60 deletions

View file

@ -270,6 +270,7 @@ enum BfIRCmd : uint8
BfIRCmd_SetTailCall,
BfIRCmd_SetCallAttribute,
BfIRCmd_CreateRet,
BfIRCmd_CreateSetRet,
BfIRCmd_CreateRetVoid,
BfIRCmd_CreateUnreachable,
BfIRCmd_Call_AddAttribute,
@ -627,6 +628,7 @@ enum BfIRAttribute
BfIRAttribute_NoAlias,
BfIRAttribute_NoCapture,
BfIRAttribute_StructRet,
BfIRAttribute_VarRet,
BfIRAttribute_ZExt,
BfIRAttribute_ByVal,
BfIRAttribute_Dereferencable,
@ -916,6 +918,15 @@ enum BfIRPopulateType
BfIRPopulateType_Full_ForceDefinition
};
struct BfIRState
{
BfIRBlock mActualInsertBlock; // Only when not ignoring writes
BfIRBlock mInsertBlock;
BfIRFunction mActiveFunction;
bool mActiveFunctionHasBody;
Array<BfFilePosition> mSavedDebugLocs;
};
class BfIRBuilder : public BfIRConstHolder
{
public:
@ -1227,6 +1238,7 @@ public:
void SetTailCall(BfIRValue callInst);
void SetCallAttribute(BfIRValue callInst, int paramIdx, BfIRAttribute attribute);
BfIRValue CreateRet(BfIRValue val);
BfIRValue CreateSetRet(BfIRValue val, int returnTypeId);
void CreateRetVoid();
void CreateUnreachable();
void Call_AddAttribute(BfIRValue callInst, int argIdx, BfIRAttribute attr);
@ -1315,6 +1327,9 @@ public:
BfIRMDNode type, bool isLocalToUnit, BfIRValue val, BfIRMDNode Decl = BfIRMDNode());
BfIRMDNode DbgCreateLexicalBlock(BfIRMDNode scope, BfIRMDNode file, int line, int col);
void DbgCreateAnnotation(BfIRMDNode scope, const StringImpl& name, BfIRValue value);
BfIRState GetState();
void SetState(const BfIRState& state);
};
NS_BF_END