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

Added TargetTriple, fixed asm stuff for non-x86 LLVM

This commit is contained in:
Brian Fiete 2019-10-17 06:30:17 -07:00
parent 079574a4e7
commit e2dad5f838
8 changed files with 110 additions and 11 deletions

View file

@ -0,0 +1,42 @@
#include "BfTargetTriple.h"
USING_NS_BF;
BfTargetTriple::BfTargetTriple()
{
mParsed = true;
mMachineType = BfMachineType_Unknown;
}
BfTargetTriple::BfTargetTriple(const StringImpl& targetTriple)
{
mParsed = false;
mMachineType = BfMachineType_Unknown;
mTargetTriple = targetTriple;
}
void BfTargetTriple::Parse()
{
if (mTargetTriple.StartsWith("x86_64"))
mMachineType = BfMachineType_x64;
else if ((mTargetTriple.StartsWith("i686")) || (mTargetTriple.StartsWith("x86")))
mMachineType = BfMachineType_x64;
else if ((mTargetTriple.StartsWith("aarch64")) || (mTargetTriple.StartsWith("arm64")))
mMachineType = BfMachineType_AArch64;
else
mMachineType = BfMachineType_Unknown;
mParsed = true;
}
void BfTargetTriple::Set(const StringImpl& targetTriple)
{
mTargetTriple = targetTriple;
mParsed = false;
}
BfMachineType BfTargetTriple::GetMachineType()
{
if (!mParsed)
Parse();
return mMachineType;
}