if ( ! evaluateConstantImm ( getImm ( ) , Imm , VK ) ) {


zmtarzmMCExpr::VariantKind VK = zmtarzmMCExpr::VK_zmtarzm_None;

zmtarzmMCExpr :: VariantKind VK = zmtarzmMCExpr :: VK_zmtarzm_None ;


if (evaluateConstantImm(getImm(), Imm, VK)) {

if ( evaluateConstantImm ( getImm ( ) , Imm , VK ) ) {


return isShiftedUInt < num , shift > ( Imm ) ;


if (!evaluateConstantImm(getImm(), Imm, VK)) {

if ( ! evaluateConstantImm ( getImm ( ) , Imm , VK ) ) {


return Kind == KindTy :: SystemRegister ;


return pred ( Imm ) && VK == zmtarzmMCExpr :: VK_zmtarzm_None ;

return pred(Imm) && VK == zmtarzmMCExpr::VK_zmtarzm_None;


return zmtarzmAsmParser :: classifySymbolRef ( getImm ( ) , VK ) && VK == zmtarzmMCExpr :: VK_zmtarzm_None ;

return zmtarzmAsmParser::classifySymbolRef(getImm(), VK) && VK == zmtarzmMCExpr::VK_zmtarzm_None;


return Kind == KindTy :: Register && Reg . Modifiers == 0 ;

return Kind == KindTy::Register && Reg.Modifiers == 0;


extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializezmtarzmAsmParser() {

extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializezmtarzmAsmParser ( ) {


RegisterMCAsmParser < zmtarzmAsmParser > X ( getThezmtarzm32Target ( ) ) ;


RegisterMCAsmParser < zmtarzmAsmParser > Y ( getThezmtarzm64Target ( ) ) ;


bool zmtarzmAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, OperandVector &Operands, MCStreamer &Out, uint64_t &ErrorInfo, bool MatchingInlineAsm) {

bool zmtarzmAsmParser :: MatchAndEmitInstruction ( SMLoc IDLoc , unsigned & Opcode , OperandVector & Operands , MCStreamer & Out , uint64_t & ErrorInfo , bool MatchingInlineAsm ) {


auto Result = MatchInstructionImpl(Operands, Inst, ErrorInfo, MissingFeatures, MatchingInlineAsm);

auto Result = MatchInstructionImpl ( Operands , Inst , ErrorInfo , MissingFeatures , MatchingInlineAsm ) ;


if (validateInstruction(Inst, Operands)) {

if ( validateInstruction ( Inst , Operands ) ) {


return processInstruction(Inst, IDLoc, Operands, Out);

return processInstruction ( Inst , IDLoc , Operands , Out ) ;


assert
(
MissingFeatures
.
any
(
)
&&
"Unknown missing features!"
)
;

assert(MissingFeatures.any() && "Unknown missing features!");


std::string Msg = "instruction requires the following:";

std
::
string
Msg
=
"instruction requires the following:"
;


for (unsigned i = 0, e = MissingFeatures.size(); i != e; ++i) {

for ( unsigned i = 0 , e = MissingFeatures . size ( ) ; i != e ; ++ i ) {


Msg = Msg + getSubtargetFeatureName ( i ) ;


FeatureBitset FBS = ComputeAvailableFeatures(getSTI().getFeatureBits());

FeatureBitset FBS = ComputeAvailableFeatures ( getSTI ( ) . getFeatureBits ( ) ) ;


std::string Suggestion = zmtarzmMnemonicSpellCheck(((zmtarzmOperand &)*Operands[0]).getToken(), FBS);

std :: string Suggestion = zmtarzmMnemonicSpellCheck ( ( ( zmtarzmOperand & ) * Operands [ 0 ] ) . getToken ( ) , FBS ) ;


return Error(IDLoc, "unrecognized instruction mnemonic" + Suggestion);

return
Error
(
IDLoc
,
"unrecognized instruction mnemonic"
+
Suggestion
)
;


if ( ErrorInfo >= Operands . size ( ) ) {


return Error(ErrorLoc, "too few operands for instruction");

return
Error
(
ErrorLoc
,
"too few operands for instruction"
)
;


ErrorLoc = ((zmtarzmOperand &)*Operands[ErrorInfo]).getStartLoc();

ErrorLoc = ( ( zmtarzmOperand & ) * Operands [ ErrorInfo ] ) . getStartLoc ( ) ;


return Error(ErrorLoc, "invalid operand for instruction");

return
Error
(
ErrorLoc
,
"invalid operand for instruction"
)
;


if (Result > FIRST_TARGET_MATCH_RESULT_TY) {

if ( Result > FIRST_TARGET_MATCH_RESULT_TY ) {


if (Result == Match_RequiresMsbNotLessThanLsb) {

if ( Result == Match_RequiresMsbNotLessThanLsb ) {


SMLoc ErrorStart = Operands[3]->getStartLoc();

SMLoc ErrorStart = Operands [ 3 ] -> getStartLoc ( ) ;


return Error(ErrorStart, "msb is less than lsb", SMRange(ErrorStart, Operands[4]->getEndLoc()));

return
Error
(
ErrorStart
,
"msb is less than lsb"
,
SMRange
(
ErrorStart
,
Operands
[
4
]
->
getEndLoc
(
)
)
)
;


if (Result == Match_RequiresOpnd2NotR0R1) {

if ( Result == Match_RequiresOpnd2NotR0R1 ) {


return Error(Operands[2]->getStartLoc(), "must not be $r0 or $r1");

return
Error
(
Operands
[
2
]
->
getStartLoc
(
)
,
"must not be $r0 or $r1"
)
;


return generateImmOutOfRangeError(Operands, ErrorInfo,  0, (1 << 2) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , 0 , ( 1 << 2 ) - 1 ) ;


if (Result == Match_InvalidUImm2plus1) {

if ( Result == Match_InvalidUImm2plus1 ) {


return generateImmOutOfRangeError(Operands, ErrorInfo,  1, (1 << 2));

return generateImmOutOfRangeError ( Operands , ErrorInfo , 1 , ( 1 << 2 ) ) ;


return generateImmOutOfRangeError(Operands, ErrorInfo,  0, (1 << 3) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , 0 , ( 1 << 3 ) - 1 ) ;


return generateImmOutOfRangeError(Operands, ErrorInfo,  0, (1 << 5) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , 0 , ( 1 << 5 ) - 1 ) ;


return generateImmOutOfRangeError(Operands, ErrorInfo,  0, (1 << 6) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , 0 , ( 1 << 6 ) - 1 ) ;


return generateImmOutOfRangeError(Operands, ErrorInfo,  0, (1 << 12) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , 0 , ( 1 << 12 ) - 1 ) ;


return generateImmOutOfRangeError(Operands, ErrorInfo,  0, (1 << 15) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , 0 , ( 1 << 15 ) - 1 ) ;


return generateImmOutOfRangeError(Operands, ErrorInfo,  -(1 << 11), (1 << 11) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , - ( 1 << 11 ) , ( 1 << 11 ) - 1 ) ;


if (Result == Match_InvalidSImm14lsl2) {

if ( Result == Match_InvalidSImm14lsl2 ) {


return generateImmOutOfRangeError(Operands, ErrorInfo,  -(1 << 15), (1 << 15) - 1, "immediate must be a multiple of 4 in the range");


return generateImmOutOfRangeError(Operands, ErrorInfo,  -(1 << 15), (1 << 15) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , - ( 1 << 15 ) , ( 1 << 15 ) - 1 ) ;


if (Result == Match_InvalidSImm16lsl2) {

if ( Result == Match_InvalidSImm16lsl2 ) {


return generateImmOutOfRangeError(Operands, ErrorInfo,  -(1 << 17), (1 << 17) - 1, "immediate must be a multiple of 4 in the range");


return generateImmOutOfRangeError(Operands, ErrorInfo,  -(1 << 19), (1 << 19) - 1);

return generateImmOutOfRangeError ( Operands , ErrorInfo , - ( 1 << 19 ) , ( 1 << 19 ) - 1 ) ;


if (Result == Match_InvalidSImm21lsl2) {

if ( Result == Match_InvalidSImm21lsl2 ) {


return generateImmOutOfRangeError(Operands, ErrorInfo,  -(1 << 22), (1 << 22) - 4, "immediate must be a multiple of 4 in the range")


if (Result == Match_InvalidSImm26lsl2) {

if ( Result == Match_InvalidSImm26lsl2 ) {


return generateImmOutOfRangeError(Operands, ErrorInfo,  -(1 << 27), (1 << 27) - 4, "immediate must be a multiple of 4 in the range");


llvm_unreachable("Unknown match type detected!");

llvm_unreachable
(
"Unknown match type detected!"
)
;


static bool matchRegisterNameHelper(bool IsRV32E, MCRegister &RegNo, StringRef Name) {

static bool matchRegisterNameHelper ( bool IsRV32E , MCRegister & RegNo , StringRef Name ) {


zmtarzmOperand(const zmtarzmOperand &o) : MCParsedAsmOperand() {

zmtarzmOperand ( const zmtarzmOperand & o ) : MCParsedAsmOperand ( ) {


zmtarzmOperand(KindTy K) : MCParsedAsmOperand(), Kind(K) {

zmtarzmOperand ( KindTy K ) : MCParsedAsmOperand ( ) , Kind ( K ) {


OperandMatchResultTy zmtarzmAsmParser::parseAtomicMemOp(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseAtomicMemOp ( OperandVector & Operands ) {


if ( getLexer ( ) . isNot ( AsmToken :: LParen ) ) {


Operands . push_back ( zmtarzmOperand :: createToken ( "(" , getLoc ( ) ) ) ;


if (parseRegister(Operands) != MatchOperand_Success) {

if ( parseRegister ( Operands ) != MatchOperand_Success ) {


Error
(
getLoc
(
)
,
"expected register"
)
;


if ( getLexer ( ) . isNot ( AsmToken :: RParen ) ) {


Operands . push_back ( zmtarzmOperand :: createToken ( ")" , getLoc ( ) ) ) ;


OperandMatchResultTy zmtarzmAsmParser::parseBareSymbol(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseBareSymbol ( OperandVector & Operands ) {


SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);

SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


if (getLexer().getKind() != AsmToken::Identifier) {

if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {


AsmToken Tok = getLexer ( ) . getTok ( ) ;


if ( getParser ( ) . parseIdentifier ( Identifier ) ) {


MCExpr::VariantKind Kind = zmtarzmMCExpr::VK_zmtarzm_None;

MCExpr :: VariantKind Kind = zmtarzmMCExpr :: VK_zmtarzm_None ;


if ( Identifier . consume_back ( "@plt" ) ) {


Error(getLoc(), "'@plt' operand not valid for instruction");


if ( Identifier . consume_back ( # ) ) {

if ( Identifier . consume_back ( "@GOT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOT ;


if ( Identifier . consume_back ( "@GOTOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTOFF ;


if ( Identifier . consume_back ( "@PLT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_PLT ;


if ( Identifier . consume_back ( "@GOTPC" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTPC ;


if ( Identifier . consume_back ( "@TLSGD32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSGD ;


if ( Identifier . consume_back ( "@GOTTPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSIE ;


if ( Identifier . consume_back ( "@TPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLE ;


if ( Identifier . consume_back ( "@TLSLDM32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDM ;


if ( Identifier . consume_back ( "@TLSLDO32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDO ;


MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);

MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ;


const MCExpr *V = Sym->getVariableValue(false);

const MCExpr * V = Sym -> getVariableValue ( false ) ;


if ( ! isa < MCSymbolRefExpr > ( V ) ) {


Error
(
getLoc
(
)
,
"unknown symbol"
)
;


Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_zmtarzm_None, getContext());

Res = MCSymbolRefExpr :: create ( Sym , MCSymbolRefExpr :: VK_zmtarzm_None , getContext ( ) ) ;


if (getLexer().getKind() == AsmToken::Plus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Plus ) {


if ( getParser ( ) . parseExpression ( Expr ) ) {


Error
(
getLoc
(
)
,
"unknown expression"
)
;


Res = MCBinaryExpr::create(Opcode, Res, Expr, getContext());

Res = MCBinaryExpr :: create ( Opcode , Res , Expr , getContext ( ) ) ;


Operands.push_back(zmtarzmOperand::createImm(Res, S, E, isRV64()));

Operands . push_back ( zmtarzmOperand :: createImm ( Res , S , E , isRV64 ( ) ) ) ;


if (getLexer().getKind() == AsmToken::Minus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) {


if (Kind != zmtarzmMCExpr::VK_zmtarzm_Invalid) {

if ( Kind != zmtarzmMCExpr :: VK_zmtarzm_Invalid ) {


Res = zmtarzmMCExpr::create(Res, Kind, getContext());

Res = zmtarzmMCExpr :: create ( Res , Kind , getContext ( ) ) ;


OperandMatchResultTy zmtarzmAsmParser::parseCallSymbol(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseCallSymbol ( OperandVector & Operands ) {


SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {


AsmToken Tok = getLexer ( ) . getTok ( ) ;


if ( getParser ( ) . parseIdentifier ( Identifier ) ) {


MCExpr :: VariantKind Kind = zmtarzmMCExpr :: VK_zmtarzm_None ;


if ( Identifier . consume_back ( # ) ) {

if ( Identifier . consume_back ( "@GOT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOT ;


if ( Identifier . consume_back ( "@GOTOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTOFF ;


if ( Identifier . consume_back ( "@PLT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_PLT ;


if ( Identifier . consume_back ( "@GOTPC" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTPC ;


if ( Identifier . consume_back ( "@TLSGD32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSGD ;


if ( Identifier . consume_back ( "@GOTTPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSIE ;


if ( Identifier . consume_back ( "@TPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLE ;


if ( Identifier . consume_back ( "@TLSLDM32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDM ;


if ( Identifier . consume_back ( "@TLSLDO32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDO ;


MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ;


const MCExpr *V = Sym->getVariableValue( false);

const MCExpr * V = Sym -> getVariableValue ( false ) ;


if ( ! isa < MCSymbolRefExpr > ( V ) ) {


Error
(
getLoc
(
)
,
"unknown symbol"
)
;


Res = MCSymbolRefExpr :: create ( Sym , MCSymbolRefExpr :: VK_zmtarzm_None , getContext ( ) ) ;


if ( getLexer ( ) . getKind ( ) == AsmToken :: Plus ) {


if ( getParser ( ) . parseExpression ( Expr ) ) {


Error
(
getLoc
(
)
,
"unknown expression"
)
;


Res = MCBinaryExpr :: create ( Opcode , Res , Expr , getContext ( ) ) ;


Operands . push_back ( zmtarzmOperand :: createImm ( Res , S , E , isRV64 ( ) ) ) ;


if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) {


if (Kind != zmtarzmMCExpr::VK_zmtarzm_None) {

if ( Kind != zmtarzmMCExpr :: VK_zmtarzm_None ) {


Res = zmtarzmMCExpr :: create ( Res , Kind , getContext ( ) ) ;


OperandMatchResultTy zmtarzmAsmParser::parseCSRSystemRegister(OperandVector &Operands, bool AllowParens) {

OperandMatchResultTy zmtarzmAsmParser :: parseCSRSystemRegister ( OperandVector & Operands , bool AllowParens ) {


if ( getLexer ( ) . getTok ( ) . isNot ( AsmToken :: Dollar ) ) {


if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {


StringRef Name = getLexer().getTok().getIdentifier();

StringRef Name = getLexer ( ) . getTok ( ) . getIdentifier ( ) ;


matchRegisterNameHelper ( RegNo , Name ) ;


SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);

SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


if ( getLexer ( ) . getKind ( ) == # ) {


unsigned RegNo = MatchRegisterName(Name);

unsigned RegNo = MatchRegisterName ( Name ) ;


if (matchRegisterNameHelper(getSTI(), (MCRegister &)RegNo, Name)) {

if ( matchRegisterNameHelper ( getSTI ( ) , ( MCRegister & ) RegNo , Name ) ) {


Operands . push_back ( zmtarzmOperand :: createReg ( RegNo , S , E ) ) ;


Name = StringRef(std::string("$") + getLexer().getTok().getString().str());

Name = StringRef ( std :: string ( "$" ) + getLexer ( ) . getTok ( ) . getString ( ) . str ( ) ) ;


if (getLexer().getKind() == AsmToken::Identifier) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Identifier ) {


Name = getLexer ( ) . getTok ( ) . getIdentifier ( ) ;


if (getLexer().getKind() != AsmToken::Identifier) {


bool zmtarzmAsmParser::ParseDirective(AsmToken DirectiveID) {

bool zmtarzmAsmParser :: ParseDirective ( AsmToken DirectiveID ) {


StringRef IDVal = DirectiveID.getString();

StringRef IDVal = DirectiveID . getString ( ) ;


if ( IDVal == ".hsa_code_object_version" ) {

if (IDVal == ".hsa_code_object_version") {


return ParseDirectiveHSACodeObjectVersion ( ) ;


if ( IDVal == ".hsa_code_object_isa" ) {


return ParseDirectiveHSACodeObjectISA ( ) ;


return ParseDirectiveAMDKernelCodeT ( ) ;


return ParseDirectivezmtarzmHsaKernel ( ) ;


if (IDVal == zmtarzm::HSAzmtarzm::AssemblerDirectiveBegin) {

if ( IDVal == zmtarzm :: HSAzmtarzm :: AssemblerDirectiveBegin ) {


if ( IDVal == PALzmtarzm :: AssemblerDirective ) {

if (IDVal == PALzmtarzm::AssemblerDirective) {


OperandMatchResultTy zmtarzmAsmParser::parseImmediate(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseImmediate ( OperandVector & Operands ) {


SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


if (getLexer().getKind() == AsmToken::LParen) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: LParen ) {


if ( getParser ( ) . parseExpression ( Res ) ) {


Operands.push_back(zmtarzmOperand::createImm(Res, S, E, isRV64()));

Operands . push_back ( zmtarzmOperand :: createImm ( Res , S , E , isRV64 ( ) ) ) ;


if (getLexer().getKind() == AsmToken::Minus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) {


if (getLexer().getKind() == AsmToken::Plus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Plus ) {


if (getLexer().getKind() == AsmToken::Integer) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Integer ) {


if (getLexer().getKind() == AsmToken::String) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: String ) {


if ( getLexer ( ) . getKind ( ) == AsmToken :: Identifier ) {


if ( getParser ( ) . parseIdentifier ( Res ) ) {


if ( getLexer ( ) . getKind ( ) == # ) {


if (getLexer().getKind() == AsmToken::Percent) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Percent ) {


return parseOperandWithModifier ( Operands ) ;


SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);

SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


bool zmtarzmAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc, OperandVector &Operands) {

bool zmtarzmAsmParser :: ParseInstruction ( ParseInstructionInfo & Info , StringRef Name , SMLoc NameLoc , OperandVector & Operands ) {


Operands . push_back ( zmtarzmOperand :: createToken ( Name , NameLoc ) ) ;


if ( getLexer ( ) . is ( AsmToken :: EndOfStatement ) ) {


for ( ; getLexer ( ) . is ( AsmToken :: Comma ) ; ) {


if ( getLexer ( ) . isNot ( AsmToken :: EndOfStatement ) ) {


getParser ( ) . eatToEndOfStatement ( ) ;


return
Error
(
Loc
,
"unexpected token"
)
;


return
Error
(
getLexer
(
)
.
getTok
(
)
.
getLoc
(
)
,
"unexpected token in operand list"
)
;

return Error(getLexer().getTok().getLoc(), "unexpected token in operand list");


OperandMatchResultTy zmtarzmAsmParser::parseJALOffset(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseJALOffset ( OperandVector & Operands ) {


SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {

if (getLexer().getKind() != AsmToken::Identifier) {


AsmToken Tok = getLexer ( ) . getTok ( ) ;


if ( getParser ( ) . parseIdentifier ( Identifier ) ) {


MCExpr::VariantKind Kind = zmtarzmMCExpr::VK_zmtarzm_None;

MCExpr :: VariantKind Kind = zmtarzmMCExpr :: VK_zmtarzm_None ;


if ( Identifier . consume_back ( # ) ) {

if ( Identifier . consume_back ( "@GOT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOT ;


if ( Identifier . consume_back ( "@GOTOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTOFF ;


if ( Identifier . consume_back ( "@PLT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_PLT ;


if ( Identifier . consume_back ( "@GOTPC" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTPC ;


if ( Identifier . consume_back ( "@TLSGD32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSGD ;


if ( Identifier . consume_back ( "@GOTTPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSIE ;


if ( Identifier . consume_back ( "@TPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLE ;


if ( Identifier . consume_back ( "@TLSLDM32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDM ;


if ( Identifier . consume_back ( "@TLSLDO32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDO ;


MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);

MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ;


const MCExpr *V = Sym->getVariableValue( false);

const MCExpr * V = Sym -> getVariableValue ( false ) ;


if ( ! isa < MCSymbolRefExpr > ( V ) ) {


Error
(
getLoc
(
)
,
"unknown symbol"
)
;


Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_zmtarzm_None, getContext());

Res = MCSymbolRefExpr :: create ( Sym , MCSymbolRefExpr :: VK_zmtarzm_None , getContext ( ) ) ;


if ( getLexer ( ) . getKind ( ) == AsmToken :: Plus ) {


if ( getParser ( ) . parseExpression ( Expr ) ) {


Error
(
getLoc
(
)
,
"unknown expression"
)
;


Res = MCBinaryExpr::create(Opcode, Res, Expr, getContext());

Res = MCBinaryExpr :: create ( Opcode , Res , Expr , getContext ( ) ) ;


Operands . push_back ( zmtarzmOperand :: createImm ( Res , S , E , isRV64 ( ) ) ) ;


if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) {


if (Kind != zmtarzmMCExpr::VK_zmtarzm_None) {

if ( Kind != zmtarzmMCExpr :: VK_zmtarzm_None ) {


Res = zmtarzmMCExpr::create(Res, Kind, getContext());

Res = zmtarzmMCExpr :: create ( Res , Kind , getContext ( ) ) ;


Operands.push_back(zmtarzmOperand::createImm(Res, S, E, isRV64()));


OperandMatchResultTy zmtarzmAsmParser::parseMaskReg(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseMaskReg ( OperandVector & Operands ) {


SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


if ( getLexer ( ) . getTok ( ) . isNot ( AsmToken :: Dollar ) ) {


if (getLexer().getKind() != AsmToken::Identifier) {

if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {


AsmToken Tok = getLexer ( ) . getTok ( ) ;


if ( getParser ( ) . parseIdentifier ( Identifier ) ) {


Error
(
getLoc
(
)
,
"unknown identifier"
)
;


MCExpr :: VariantKind Kind = zmtarzmMCExpr :: VK_zmtarzm_None ;


if ( Identifier . consume_back ( # ) ) {

if ( Identifier . consume_back ( "@GOT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOT ;


if ( Identifier . consume_back ( "@GOTOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTOFF ;


if ( Identifier . consume_back ( "@PLT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_PLT ;


if ( Identifier . consume_back ( "@GOTPC" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTPC ;


if ( Identifier . consume_back ( "@TLSGD32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSGD ;


if ( Identifier . consume_back ( "@GOTTPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSIE ;


if ( Identifier . consume_back ( "@TPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLE ;


if ( Identifier . consume_back ( "@TLSLDM32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDM ;


if ( Identifier . consume_back ( "@TLSLDO32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDO ;


MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ;


const MCExpr * V = Sym -> getVariableValue ( false ) ;


if ( ! isa < MCSymbolRefExpr > ( V ) ) {


Error
(
getLoc
(
)
,
"unknown symbol"
)
;


Res = MCSymbolRefExpr :: create ( Sym , MCSymbolRefExpr :: VK_zmtarzm_None , getContext ( ) ) ;


if ( getLexer ( ) . getKind ( ) == AsmToken :: Plus ) {

if (getLexer().getKind() == AsmToken::Plus) {


if ( getParser ( ) . parseExpression ( Expr ) ) {


Error
(
getLoc
(
)
,
"unknown expression"
)
;


Res = MCBinaryExpr :: create ( Opcode , Res , Expr , getContext ( ) ) ;


Operands.push_back(zmtarzmOperand::createImm(Res, S, E, isRV64()));

Operands . push_back ( zmtarzmOperand :: createImm ( Res , S , E , isRV64 ( ) ) ) ;


if (getLexer().getKind() == AsmToken::Minus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) {


if ( Kind != zmtarzmMCExpr :: VK_zmtarzm_None ) {


Res = zmtarzmMCExpr :: create ( Res , Kind , getContext ( ) ) ;


StringRef Name = getLexer().getTok().getIdentifier();

StringRef Name = getLexer ( ) . getTok ( ) . getIdentifier ( ) ;


matchRegisterNameHelper ( RegNo , Name ) ;


Operands . push_back ( zmtarzmOperand :: createReg ( RegNo , S , E ) ) ;


OperandMatchResultTy zmtarzmAsmParser :: parseMaskReg ( OperandVector & Operands ) {


SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;

SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);


if ( getLexer ( ) . getTok ( ) . isNot ( AsmToken :: Dollar ) ) {


if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {


AsmToken Tok = getLexer ( ) . getTok ( ) ;


if ( getParser ( ) . parseIdentifier ( Identifier ) ) {


Error
(
getLoc
(
)
,
"unknown identifier"
)
;


MCExpr :: VariantKind Kind = zmtarzmMCExpr :: VK_zmtarzm_None ;


if ( Identifier . consume_back ( # ) ) {


MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ;


const MCExpr * V = Sym -> getVariableValue ( false ) ;


if ( ! isa < MCSymbolRefExpr > ( V ) ) {


Error
(
getLoc
(
)
,
"unknown symbol"
)
;


Res = MCSymbolRefExpr :: create ( Sym , MCSymbolRefExpr :: VK_zmtarzm_None , getContext ( ) ) ;


if (getLexer().getKind() == AsmToken::Plus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Plus ) {


if ( getParser ( ) . parseExpression ( Expr ) ) {


Error
(
getLoc
(
)
,
"unknown expression"
)
;


Res = MCBinaryExpr :: create ( Opcode , Res , Expr , getContext ( ) ) ;


Operands . push_back ( zmtarzmOperand :: createImm ( Res , S , E , isRV64 ( ) ) ) ;


if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) {


if ( Kind != zmtarzmMCExpr :: VK_zmtarzm_None ) {


Res = zmtarzmMCExpr :: create ( Res , Kind , getContext ( ) ) ;


StringRef Name = getLexer ( ) . getTok ( ) . getIdentifier ( ) ;


matchRegisterNameHelper ( RegNo , Name ) ;


Operands . push_back ( zmtarzmOperand :: createReg ( RegNo , S , E ) ) ;


OperandMatchResultTy zmtarzmAsmParser::parseMemOpBaseReg(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseMemOpBaseReg ( OperandVector & Operands ) {


if ( getLexer ( ) . isNot ( AsmToken :: LParen ) ) {


Operands . push_back ( zmtarzmOperand :: createToken ( "(" , getLoc ( ) , isRV64 ( ) ) ) ;


if (parseRegister(Operands) != MatchOperand_Success) {

if ( parseRegister ( Operands ) != MatchOperand_Success ) {


Error
(
getLoc
(
)
,
"expected register"
)
;


if ( getLexer ( ) . isNot ( AsmToken :: RParen ) ) {


Operands . push_back ( zmtarzmOperand :: createToken ( ")" , getLoc ( ) , isRV64 ( ) ) ) ;


OperandMatchResultTy zmtarzmAsmParser::parseOperandWithModifier(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseOperandWithModifier ( OperandVector & Operands ) {


SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);

SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


if (getLexer().getKind() != AsmToken::Percent) {

if ( getLexer ( ) . getKind ( ) != AsmToken :: Percent ) {


Error(getLoc(), "expected '%' for operand modifier");

Error
(
getLoc
(
)
,
"expected '%' for operand modifier"
)
;


if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {

if (getLexer().getKind() != AsmToken::Identifier) {


Error(getLoc(), "expected valid identifier for operand modifier");


StringRef Identifier = getParser().getTok().getIdentifier();

StringRef Identifier = getParser ( ) . getTok ( ) . getIdentifier ( ) ;


zmtarzmMCExpr::VariantKind VK = zmtarzmMCExpr::getVariantKindForName(Identifier);

zmtarzmMCExpr :: VariantKind VK = zmtarzmMCExpr :: getVariantKindForName ( Identifier ) ;


if (VK == zmtarzmMCExpr::VK_zmtarzm_Invalid) {

if ( VK == zmtarzmMCExpr :: VK_zmtarzm_Invalid ) {


Error(getLoc(), "unrecognized operand modifier");

Error
(
getLoc
(
)
,
"unrecognized operand modifier"
)
;


if (getLexer().getKind() != AsmToken::LParen) {

if ( getLexer ( ) . getKind ( ) != AsmToken :: LParen ) {


if (getParser().parseParenExpression(SubExpr, E)) {

if ( getParser ( ) . parseParenExpression ( SubExpr , E ) ) {


const MCExpr *ModExpr = zmtarzmMCExpr::create(VK, SubExpr, getContext());

const MCExpr * ModExpr = zmtarzmMCExpr :: create ( VK , SubExpr , getContext ( ) ) ;


Operands.push_back(zmtarzmOperand::createImm(ModExpr, S, E, isRV64()));

Operands . push_back ( zmtarzmOperand :: createImm ( ModExpr , S , E , isRV64 ( ) ) ) ;


bool zmtarzmAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {

bool zmtarzmAsmParser :: parseOperand ( OperandVector & Operands , StringRef Mnemonic ) {


OperandMatchResultTy Result = MatchOperandParserImpl(Operands, Mnemonic,  true);

OperandMatchResultTy Result = MatchOperandParserImpl ( Operands , Mnemonic , true ) ;


if ( Result == MatchOperand_ParseFail ) {


if (parseRegister(Operands, true) == MatchOperand_Success) {

if ( parseRegister ( Operands , true ) == MatchOperand_Success ) {


if (parseImmediate(Operands) == MatchOperand_Success) {

if ( parseImmediate ( Operands ) == MatchOperand_Success ) {


if ( getLexer ( ) . is ( AsmToken :: LParen ) ) {


return parseMemOpBaseReg(Operands) != MatchOperand_Success;

return parseMemOpBaseReg ( Operands ) != MatchOperand_Success ;


Error
(
getLoc
(
)
,
"unknown operand"
)
;


OperandMatchResultTy zmtarzmAsmParser::parsePseudoJumpSymbol(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parsePseudoJumpSymbol ( OperandVector & Operands ) {


SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);

SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


if (getLexer().getKind() != AsmToken::Identifier) {

if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {


AsmToken Tok = getLexer ( ) . getTok ( ) ;


if ( getParser ( ) . parseIdentifier ( Identifier ) ) {


Error
(
getLoc
(
)
,
"unknown identifier"
)
;


MCExpr::VariantKind Kind = zmtarzmMCExpr::VK_zmtarzm_None;

MCExpr :: VariantKind Kind = zmtarzmMCExpr :: VK_zmtarzm_None ;


if ( Identifier . consume_back ( # ) ) {

if ( Identifier . consume_back ( "@GOT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOT ;


if ( Identifier . consume_back ( "@GOTOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTOFF ;


if ( Identifier . consume_back ( "@PLT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_PLT ;


if ( Identifier . consume_back ( "@GOTPC" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTPC ;


if ( Identifier . consume_back ( "@TLSGD32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSGD ;


if ( Identifier . consume_back ( "@GOTTPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSIE ;


if ( Identifier . consume_back ( "@TPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLE ;


if ( Identifier . consume_back ( "@TLSLDM32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDM ;


if ( Identifier . consume_back ( "@TLSLDO32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDO ;


MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);

MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ;


const MCExpr *V = Sym->getVariableValue( false);

const MCExpr * V = Sym -> getVariableValue ( false ) ;


if ( ! isa < MCSymbolRefExpr > ( V ) ) {


Error
(
getLoc
(
)
,
"unknown symbol"
)
;


Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_zmtarzm_None, getContext());

Res = MCSymbolRefExpr :: create ( Sym , MCSymbolRefExpr :: VK_zmtarzm_None , getContext ( ) ) ;


if (getLexer().getKind() == AsmToken::Plus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Plus ) {


if ( getParser ( ) . parseExpression ( Expr ) ) {


Error
(
getLoc
(
)
,
"unknown expression"
)
;


Res = MCBinaryExpr::create(Opcode, Res, Expr, getContext());

Res = MCBinaryExpr :: create ( Opcode , Res , Expr , getContext ( ) ) ;


Operands.push_back(zmtarzmOperand::createImm(Res, S, E, isRV64()));

Operands . push_back ( zmtarzmOperand :: createImm ( Res , S , E , isRV64 ( ) ) ) ;


if (getLexer().getKind() == AsmToken::Minus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) {


if (Kind != zmtarzmMCExpr::VK_zmtarzm_None) {

if ( Kind != zmtarzmMCExpr :: VK_zmtarzm_None ) {


Res = zmtarzmMCExpr::create(Res, Kind, getContext());

Res = zmtarzmMCExpr :: create ( Res , Kind , getContext ( ) ) ;


OperandMatchResultTy zmtarzmAsmParser::parseRegister(OperandVector &Operands, bool AllowParens) {

OperandMatchResultTy zmtarzmAsmParser :: parseRegister ( OperandVector & Operands , bool AllowParens ) {


if ( getLexer ( ) . getTok ( ) . isNot ( AsmToken :: Dollar ) ) {


if ( getLexer ( ) . getKind ( ) != AsmToken :: Identifier ) {


StringRef Name = getLexer().getTok().getIdentifier();

StringRef Name = getLexer ( ) . getTok ( ) . getIdentifier ( ) ;


matchRegisterNameHelper ( RegNo , Name ) ;


if ( getLexer ( ) . getKind ( ) == # ) {


unsigned RegNo = MatchRegisterName(Name);

unsigned RegNo = MatchRegisterName ( Name ) ;


if (matchRegisterNameHelper(getSTI(), (MCRegister &)RegNo, Name)) {

if ( matchRegisterNameHelper ( getSTI ( ) , ( MCRegister & ) RegNo , Name ) ) {


Operands . push_back ( zmtarzmOperand :: createReg ( RegNo , S , E ) ) ;


Name = StringRef(std::string("$") + getLexer().getTok().getString().str());

Name = StringRef ( std :: string ( "$" ) + getLexer ( ) . getTok ( ) . getString ( ) . str ( ) ) ;


if (getLexer().getKind() == AsmToken::Identifier) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Identifier ) {


Name = getLexer ( ) . getTok ( ) . getIdentifier ( ) ;


E = SMLoc::getFromPointer(getLoc().getPointer() - 1);

E = SMLoc :: getFromPointer ( getLoc ( ) . getPointer ( ) - 1 ) ;


if (getLexer().getKind() != AsmToken::Identifier) {


bool zmtarzmAsmParser::ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) {

bool zmtarzmAsmParser :: ParseRegister ( unsigned & RegNo , SMLoc & StartLoc , SMLoc & EndLoc ) {


if (tryParseRegister(RegNo, StartLoc, EndLoc) != MatchOperand_Success) {

if ( tryParseRegister ( RegNo , StartLoc , EndLoc ) != MatchOperand_Success ) {


return Error(StartLoc, "invalid register name");

return
Error
(
StartLoc
,
"invalid register name"
)
;


OperandMatchResultTy zmtarzmAsmParser::parseVTypeI(OperandVector &Operands) {

OperandMatchResultTy zmtarzmAsmParser :: parseVTypeI ( OperandVector & Operands ) {


SMLoc E = SMLoc::getFromPointer(S.getPointer() - 1);

SMLoc E = SMLoc :: getFromPointer ( S . getPointer ( ) - 1 ) ;


AsmToken Tok = getLexer ( ) . getTok ( ) ;


if ( getParser ( ) . parseIdentifier ( Identifier ) ) {


Error
(
getLoc
(
)
,
"unknown identifier"
)
;


MCExpr::VariantKind Kind = zmtarzmMCExpr::VK_zmtarzm_None;

MCExpr :: VariantKind Kind = zmtarzmMCExpr :: VK_zmtarzm_None ;


if ( Identifier . consume_back ( # ) ) {

if ( Identifier . consume_back ( "@GOT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOT ;


if ( Identifier . consume_back ( "@GOTOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTOFF ;


if ( Identifier . consume_back ( "@PLT" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_PLT ;


if ( Identifier . consume_back ( "@GOTPC" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_GOTPC ;


if ( Identifier . consume_back ( "@TLSGD32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSGD ;


if ( Identifier . consume_back ( "@GOTTPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSIE ;


if ( Identifier . consume_back ( "@TPOFF" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLE ;


if ( Identifier . consume_back ( "@TLSLDM32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDM ;


if ( Identifier . consume_back ( "@TLSLDO32" ) ) {


Kind = zmtarzmMCExpr :: VK_zmtarzm_TLSLDO ;


MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);

MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ;


const MCExpr *V = Sym->getVariableValue( false);

const MCExpr * V = Sym -> getVariableValue ( false ) ;


if ( ! isa < MCSymbolRefExpr > ( V ) ) {


Error
(
getLoc
(
)
,
"unknown symbol"
)
;


Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_zmtarzm_None, getContext());

Res = MCSymbolRefExpr :: create ( Sym , MCSymbolRefExpr :: VK_zmtarzm_None , getContext ( ) ) ;


if (getLexer().getKind() == AsmToken::Plus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Plus ) {


if ( getParser ( ) . parseExpression ( Expr ) ) {


Error
(
getLoc
(
)
,
"unknown expression"
)
;


Res = MCBinaryExpr::create(Opcode, Res, Expr, getContext());

Res = MCBinaryExpr :: create ( Opcode , Res , Expr , getContext ( ) ) ;


Operands.push_back(zmtarzmOperand::createImm(Res, S, E, isRV64()));

Operands . push_back ( zmtarzmOperand :: createImm ( Res , S , E , isRV64 ( ) ) ) ;


if (getLexer().getKind() == AsmToken::Minus) {

if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) {


if (Kind != zmtarzmMCExpr::VK_zmtarzm_None) {

if ( Kind != zmtarzmMCExpr :: VK_zmtarzm_None ) {


Res = zmtarzmMCExpr::create(Res, Kind, getContext());

Res = zmtarzmMCExpr :: create ( Res , Kind , getContext ( ) ) ;


void print(raw_ostream &OS) const override {

void print ( raw_ostream & OS ) const override {


OS << "<register " << getReg() << " mods: " << Reg.Modifiers << '>';

OS
<<
"<register "
<<
getReg
(
)
<<
" mods: "
<<
Reg
.
Modifiers
<<
'>'
;


OS
<<
"Register: "
<<
getReg
(
)
<<
"\n"
;


OS
<<
"<register x"
<<
getReg
(
)
<<
">"
;


OS << "Register<" << Reg . RegNum << ">" ;


void setFeatureBits(uint64_t Feature, StringRef FeatureString) {

void setFeatureBits ( uint64_t Feature , StringRef FeatureString ) {


if ( ! ( getSTI ( ) . getFeatureBits ( ) [ Feature ] ) ) {


setAvailableFeatures ( ComputeAvailableFeatures ( STI . ToggleFeature ( FeatureString ) ) ) ;


OperandMatchResultTy zmtarzmAsmParser::tryParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) {

OperandMatchResultTy zmtarzmAsmParser :: tryParseRegister ( unsigned & RegNo , SMLoc & StartLoc , SMLoc & EndLoc ) {


const AsmToken &Tok = getParser().getTok();

const AsmToken & Tok = getParser ( ) . getTok ( ) ;


StringRef Name = getLexer().getTok().getIdentifier();

StringRef Name = getLexer ( ) . getTok ( ) . getIdentifier ( ) ;


if (matchRegisterNameHelper(isRV32E(), (MCRegister &)RegNo, Name)) {

if ( matchRegisterNameHelper ( isRV32E ( ) , ( MCRegister & ) RegNo , Name ) ) {


unsigned zmtarzmAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp, unsigned Kind) {

unsigned zmtarzmAsmParser :: validateTargetOperandClass ( MCParsedAsmOperand & AsmOp , unsigned Kind ) {


zmtarzmOperand &Op = static_cast<zmtarzmOperand &>(AsmOp);

zmtarzmOperand & Op = static_cast < zmtarzmOperand & > ( AsmOp ) ;


if ( zmtarzmMCRegisterClasses [ # ] . contains ( Reg ) ) {

if ( zmtarzmMCRegisterClasses [ zmtarzm :: FPR32RegClassID ] . contains ( Reg ) ) {


Op . Reg . RegNum = convertFPR32ToFPR64 ( Reg ) ;


if ( Op . Reg . RegNum < zmtarzm :: F0_64 ) {


if ( Op . Reg . RegNum > zmtarzm :: F31_64 ) {


if ( zmtarzmMCRegisterClasses [ zmtarzm :: GPRRegClassID ] . contains ( Reg ) ) {


Op . Reg . RegNum = MRI -> getEncodingValue ( Reg ) + zmtarzm :: R0_R1 ;

Op.Reg.RegNum = MRI->getEncodingValue(Reg) + zmtarzm::R0_R1;


if ( zmtarzmMCRegisterClasses [ # ] . contains ( Reg ) ) {


explicit zmtarzmAsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer) : AsmPrinter(TM, std::move(Streamer)), STI(TM.getMCSubtargetInfo()) {

explicit zmtarzmAsmPrinter ( TargetMachine & TM , std :: unique_ptr < MCStreamer > Streamer ) : AsmPrinter ( TM , std :: move ( Streamer ) ) , STI ( TM . getMCSubtargetInfo ( ) ) {


void zmtarzmAsmPrinter :: emitAttributes ( ) {


zmtarzmTargetStreamer &CTS = static_cast<zmtarzmTargetStreamer &>(*OutStreamer->getTargetStreamer());

zmtarzmTargetStreamer & CTS = static_cast < zmtarzmTargetStreamer & > ( * OutStreamer -> getTargetStreamer ( ) ) ;


const Triple &TT = TM.getTargetTriple();

const Triple & TT = TM . getTargetTriple ( ) ;


StringRef FS = TM.getTargetFeatureString();

StringRef FS = TM . getTargetFeatureString ( ) ;


const zmtarzmTargetMachine &CTM = static_cast<const zmtarzmTargetMachine &>(TM);

const zmtarzmTargetMachine & CTM = static_cast < const zmtarzmTargetMachine & > ( TM ) ;


const zmtarzmSubtarget STI(TT, CPU,  CPU, FS, "", CTM);

const zmtarzmSubtarget STI ( TT , CPU , CPU , FS , "" , CTM ) ;


void zmtarzmAsmPrinter::emitEndOfAsmFile(Module &M) {

void zmtarzmAsmPrinter :: emitEndOfAsmFile ( Module & M ) {


if ( TM . getTargetTriple ( ) . isOSBinFormatELF ( ) ) {


void zmtarzmAsmPrinter::emitInstruction(const MachineInstr *MI) {

void zmtarzmAsmPrinter :: emitInstruction ( const MachineInstr * MI ) {


if (emitPseudoExpansionLowering(*OutStreamer, MI)) {

if ( emitPseudoExpansionLowering ( * OutStreamer , MI ) ) {


LowerzmtarzmMachineInstrToMCInst ( MI , TmpInst , * this ) ;


EmitToStreamer ( * OutStreamer , TmpInst ) ;


void zmtarzmAsmPrinter::emitStartOfAsmFile(Module &M) {

void zmtarzmAsmPrinter :: emitStartOfAsmFile ( Module & M ) {


OutStreamer -> emitAssemblerFlag ( MCAF_SyntaxUnified ) ;


if ( ! M . getModuleInlineAsm ( ) . empty ( ) ) {


if ( TM . getTargetTriple ( ) . isThumb ( ) ) {


OutStreamer -> emitAssemblerFlag ( MCAF_Code16 ) ;


void zmtarzmAsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) {

void zmtarzmAsmPrinter :: EmitToStreamer ( MCStreamer & S , const MCInst & Inst ) {


bool Res = compressInst(CInst, Inst, *STI, OutStreamer->getContext());

bool Res = compressInst ( CInst , Inst , * STI , OutStreamer -> getContext ( ) ) ;


zmtarzmNumInstrsCompressed = zmtarzmNumInstrsCompressed + 1;

zmtarzmNumInstrsCompressed = zmtarzmNumInstrsCompressed + 1 ;


AsmPrinter::EmitToStreamer(*OutStreamer, Res ? CInst : Inst);

AsmPrinter :: EmitToStreamer ( * OutStreamer , Res ? CInst : Inst ) ;


StringRef getPassName() const override {

StringRef getPassName ( ) const override {


extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializezmtarzmAsmPrinter() {

extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializezmtarzmAsmPrinter ( ) {


RegisterAsmPrinter < zmtarzmAsmPrinter > X ( getThezmtarzm32Target ( ) ) ;


RegisterAsmPrinter < zmtarzmAsmPrinter > Y ( getThezmtarzm64Target ( ) ) ;


bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const {

bool lowerOperand ( const MachineOperand & MO , MCOperand & MCOp ) const {


return LowerzmtarzmMachineOperandToMCOperand(MO, MCOp, *this);

return LowerzmtarzmMachineOperandToMCOperand ( MO , MCOp , * this ) ;


bool zmtarzmAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) {

bool zmtarzmAsmPrinter :: PrintAsmMemoryOperand ( const MachineInstr * MI , unsigned OpNo , const char * ExtraCode , raw_ostream & OS ) {


const MachineOperand &MO = MI->getOperand(OpNo);

const MachineOperand & MO = MI -> getOperand ( OpNo ) ;


OS << "0(" << zmtarzmInstPrinter::getRegisterName(MO.getReg()) << ")";

OS << "0(" << zmtarzmInstPrinter :: getRegisterName ( MO . getReg ( ) ) << ")" ;


return AsmPrinter::PrintAsmMemoryOperand(MI, OpNo, ExtraCode, OS);

return AsmPrinter :: PrintAsmMemoryOperand ( MI , OpNo , ExtraCode , OS ) ;


bool zmtarzmAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) {

bool zmtarzmAsmPrinter :: PrintAsmOperand ( const MachineInstr * MI , unsigned OpNo , const char * ExtraCode , raw_ostream & OS ) {


if (!AsmPrinter::PrintAsmOperand(MI, OpNo, ExtraCode, OS)) {

if ( ! AsmPrinter :: PrintAsmOperand ( MI , OpNo , ExtraCode , OS ) ) {


OS << zmtarzmInstPrinter :: getRegisterName ( # ) ;


OS << zmtarzmInstPrinter :: getRegisterName ( zmtarzm :: C ) ;


if (MO.getType() == MachineOperand::MO_Immediate) {

if ( MO . getType ( ) == MachineOperand :: MO_Immediate ) {


if (MO.getType() == MachineOperand::MO_Register) {

if ( MO . getType ( ) == MachineOperand :: MO_Register ) {


OS << zmtarzmInstPrinter :: getRegisterName ( MO . getReg ( ) ) ;


if (MO.getType() == MachineOperand::MO_GlobalAddress) {

if ( MO . getType ( ) == MachineOperand :: MO_GlobalAddress ) {


if (MO.getType() == MachineOperand::MO_BlockAddress) {

if ( MO . getType ( ) == MachineOperand :: MO_BlockAddress ) {


MCSymbol *Sym = GetBlockAddressSymbol(MO.getBlockAddress());

MCSymbol * Sym = GetBlockAddressSymbol ( MO . getBlockAddress ( ) ) ;


OS << zmtarzmInstPrinter :: getRegisterName ( zmtarzm :: r0 ) ;


bool zmtarzmAsmPrinter::runOnMachineFunction(MachineFunction &MF) {

bool zmtarzmAsmPrinter :: runOnMachineFunction ( MachineFunction & MF ) {


MCSubtargetInfo &NewSTI = OutStreamer->getContext().getSubtargetCopy(*TM.getMCSubtargetInfo());

MCSubtargetInfo & NewSTI = OutStreamer -> getContext ( ) . getSubtargetCopy ( * TM . getMCSubtargetInfo ( ) ) ;


NewSTI . setFeatureBits ( MF . getSubtarget ( ) . getFeatureBits ( ) ) ;


if ( MF . getFunction ( ) . hasFnAttribute ( "interrupt" ) ) {


ABI computeTargetABI(const Triple &TT, FeatureBitset FeatureBits, StringRef ABIName) {

ABI computeTargetABI ( const Triple & TT , FeatureBitset FeatureBits , StringRef ABIName ) {


auto TargetABI = getTargetABI ( ABIName ) ;


if ( ABIName . startswith ( "purecap" ) ) {


TargetABI = zmtarzmABIInfo :: CheriPureCap ( ) ;


OPERAND_REG_IMM_INT32 = MCOI :: OPERAND_FIRST_TARGET ,


OPERAND_VPRED_R = MCOI :: OPERAND_FIRST_TARGET ,


OPERAND_BASIC_BLOCK = MCOI :: OPERAND_FIRST_TARGET ,


OPERAND_FIRST_M88K = MCOI :: OPERAND_FIRST_TARGET ,


OPERAND_BARESYMBOL = MCOI :: OPERAND_FIRST_TARGET ,


inline static StringRef roundingModeToString(RoundingMode RndMod) {

inline static StringRef roundingModeToString ( RoundingMode RndMod ) {


llvm_unreachable("Unknown floating point rounding mode");

llvm_unreachable
(
"Unknown floating point rounding mode"
)
;


inline static RoundingMode stringToRoundingMode(StringRef Str) {

inline static RoundingMode stringToRoundingMode ( StringRef Str ) {


void validate(const Triple &TT, const FeatureBitset &FeatureBits) {

void validate ( const Triple & TT , const FeatureBitset & FeatureBits ) {


report_fatal_error
(
"-mno-odd-spreg requires the O32 ABI"
)
;

report_fatal_error("-mno-odd-spreg requires the O32 ABI");


if ( getSTI ( ) . getCPU ( ) == "mips64r6" ) {


report_fatal_error
(
"microMIPS64R6 is not supported"
,
false
)
;

report_fatal_error("microMIPS64R6 is not supported", false);


report_fatal_error
(
"microMIPS64 is not supported"
,
false
)
;

report_fatal_error("microMIPS64 is not supported", false);


if (TM->Options.ExceptionModel != ExceptionHandling::None) {

if ( TM -> Options . ExceptionModel != ExceptionHandling :: None ) {


if (TM->Options.ExceptionModel != ExceptionHandling::Wasm) {

if ( TM -> Options . ExceptionModel != ExceptionHandling :: Wasm ) {


if (TM->Options.ExceptionModel == ExceptionHandling::Wasm) {

if ( TM -> Options . ExceptionModel == ExceptionHandling :: Wasm ) {


report_fatal_error("-exception-model should be either 'none' or 'wasm'");


report_fatal_error("-exception-model=wasm not allowed with -enable-emscripten-cxx-exceptions");


report_fatal_error("-wasm-enable-eh only allowed with -exception-model=wasm");


report_fatal_error("-wasm-enable-sjlj only allowed with -exception-model=wasm");


report_fatal_error("-enable-emscripten-cxx-exceptions not allowed with -wasm-enable-eh");


report_fatal_error("-enable-emscripten-sjlj not allowed with -wasm-enable-sjlj");


report_fatal_error("-enable-emscripten-cxx-exceptions not allowed with -wasm-enable-sjlj");


zmtarzmCallLowering::zmtarzmCallLowering(const zmtarzmTargetLowering &TLI) : CallLowering(&TLI) {

zmtarzmCallLowering :: zmtarzmCallLowering ( const zmtarzmTargetLowering & TLI ) : CallLowering ( & TLI ) {


bool zmtarzmCallLowering::lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const {

bool zmtarzmCallLowering :: lowerCall ( MachineIRBuilder & MIRBuilder , CallLoweringInfo & Info ) const {


bool zmtarzmCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef<ArrayRef<Register>> VRegs, FunctionLoweringInfo &FLI) const {

bool zmtarzmCallLowering :: lowerFormalArguments ( MachineIRBuilder & MIRBuilder , const Function & F , ArrayRef < ArrayRef < Register >> VRegs , FunctionLoweringInfo & FLI ) const {


bool zmtarzmCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef<Register> VRegs, FunctionLoweringInfo &FLI) const {

bool zmtarzmCallLowering :: lowerReturn ( MachineIRBuilder & MIRBuilder , const Value * Val , ArrayRef < Register > VRegs , FunctionLoweringInfo & FLI ) const {


MachineInstrBuilder Ret = MIRBuilder.buildInstrNoInsert(#);

MachineInstrBuilder Ret = MIRBuilder . buildInstrNoInsert ( # ) ;

MachineInstrBuilder Ret = MIRBuilder . buildInstrNoInsert ( zmtarzm :: BX_RET ) ;

MachineInstrBuilder Ret = MIRBuilder.buildInstrNoInsert(zmtarzm::BX_RET);


if (!lowerReturnVal(MIRBuilder, Val, VReg, Ret)) {

if ( ! lowerReturnVal ( MIRBuilder , Val , VReg , Ret ) ) {


MachineInstrBuilder Ret = MIRBuilder . buildInstrNoInsert ( zmtarzm :: RetRA ) ;

MachineInstrBuilder Ret = MIRBuilder.buildInstrNoInsert(zmtarzm::RetRA);


zmtarzmCleanupVSETVLI() : MachineFunctionPass(ID) {

zmtarzmCleanupVSETVLI ( ) : MachineFunctionPass ( ID ) {


initializezmtarzmCleanupVSETVLIPass ( * PassRegistry :: getPassRegistry ( ) ) ;


FunctionPass * llvm :: createzmtarzmCleanupVSETVLIPass ( ) {


void getAnalysisUsage(AnalysisUsage &AU) const override {

void getAnalysisUsage ( AnalysisUsage & AU ) const override {


MachineFunctionPass :: getAnalysisUsage ( AU ) ;


StringRef getPassName() const override {

StringRef getPassName ( ) const override {


MachineFunctionProperties getRequiredProperties() const override {

MachineFunctionProperties getRequiredProperties ( ) const override {


return MachineFunctionProperties ( ) . set ( MachineFunctionProperties :: Property :: AllVRegsAllocated ) ;


return MachineFunctionProperties ( ) . set ( MachineFunctionProperties :: Property :: IsSSA ) ;


return MachineFunctionProperties ( ) . set ( MachineFunctionProperties :: Property :: NoVRegs ) ;


return MachineFunctionProperties ( ) . set ( MachineFunctionProperties :: Property :: TracksLiveness ) ;


bool zmtarzmCleanupVSETVLI::runOnMachineBasicBlock(MachineBasicBlock &MBB) {

bool zmtarzmCleanupVSETVLI :: runOnMachineBasicBlock ( MachineBasicBlock & MBB ) {


const Subtarget &STI = MBB.getParent()->getSubtarget<Subtarget>();

const Subtarget & STI = MBB . getParent ( ) -> getSubtarget < Subtarget > ( ) ;


const InstrInfo *TII = STI.getInstrInfo();

const InstrInfo * TII = STI . getInstrInfo ( ) ;


InstrInfo = MBB . getParent ( ) -> getSubtarget < zmtarzmSubtarget > ( ) . getInstrInfo ( ) ;


for (MachineBasicBlock::iterator I = MBB.instr_begin(); I != MBB.instr_end(); ++I) {

for ( MachineBasicBlock :: iterator I = MBB . instr_begin ( ) ; I != MBB . instr_end ( ) ; ++ I ) {


BuildMI(MBB, std::next(I), I->getDebugLoc(), TII->get(zmtarzm::NOP));

BuildMI ( MBB , std :: next ( I ) , I -> getDebugLoc ( ) , TII -> get ( zmtarzm :: NOP ) ) ;


MIBundleBuilder(MBB, I, std::next(I, 2));

MIBundleBuilder ( MBB , I , std :: next ( I , 2 ) ) ;


if (insertStall(MBB, I, TII, MI->getOpcode())) {

if ( insertStall ( MBB , I , TII , MI -> getOpcode ( ) ) ) {


if (InstrInfo->isStoreToStackSlot(Inst, FI)) {

if ( InstrInfo -> isStoreToStackSlot ( Inst , FI ) ) {


bool zmtarzmCleanupVSETVLI::runOnMachineFunction(MachineFunction &MF) {

bool zmtarzmCleanupVSETVLI :: runOnMachineFunction ( MachineFunction & MF ) {


if ( skipFunction ( MF . getFunction ( ) ) ) {


const zmtarzmSubtarget &ST = MF.getSubtarget<zmtarzmSubtarget>();

const zmtarzmSubtarget & ST = MF . getSubtarget < zmtarzmSubtarget > ( ) ;


Changed = Changed | runOnMachineBasicBlock(MBB);

Changed = Changed | runOnMachineBasicBlock ( MBB ) ;


static void addImplySP(MCInst &Inst, int64_t Address, const void *Decoder) {

static void addImplySP ( MCInst & Inst , int64_t Address , const void * Decoder ) {


DecodeGPRRegisterClass(Inst, #, Address, Decoder);

DecodeGPRRegisterClass ( Inst , # , Address , Decoder ) ;


if ( Inst . getOpcode ( ) == zmtarzm :: LWSP ) {

if (Inst.getOpcode() == zmtarzm::LWSP) {


DecodeGPRRegisterClass ( Inst , 2 - 1 , Address , Decoder ) ;

DecodeGPRRegisterClass(Inst, 2-1, Address, Decoder);


if ( Inst . getOpcode ( ) == zmtarzm :: SWSP ) {

if (Inst.getOpcode() == zmtarzm::SWSP) {


DecodeGPRRegisterClass ( Inst , 1 , Address , Decoder ) ;

DecodeGPRRegisterClass(Inst, 1, Address, Decoder);


static MCDisassembler *createzmtarzmDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx) {

static MCDisassembler * createzmtarzmDisassembler ( const Target & T , const MCSubtargetInfo & STI , MCContext & Ctx ) {


return new zmtarzmDisassembler(STI, Ctx, T.createMCInstrInfo());

return new zmtarzmDisassembler ( STI , Ctx , T . createMCInstrInfo ( ) ) ;


static DecodeStatus decodeCLUIImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder) {

static DecodeStatus decodeCLUIImmOperand ( MCInst & Inst , uint64_t Imm , uint64_t Address , const void * Decoder ) {


assert
(
isUInt
<
5
>
(
Imm
)
&&
"Invalid immediate"
)
;

assert(isUInt<5>(Imm) && "Invalid immediate");


Inst.addOperand(MCOperand::createImm(Imm > # ? (SignExtend64<#>(Imm) & #) : Imm));

Inst . addOperand ( MCOperand :: createImm ( Imm > # ? ( SignExtend64 < # > ( Imm ) & # ) : Imm ) ) ;

Inst . addOperand ( MCOperand :: createImm ( Imm > 16 ? ( SignExtend64 < 5 > ( Imm ) & 0xffff ) : Imm ) ) ;

Inst.addOperand(MCOperand::createImm(Imm > 16 ? (SignExtend64<5>(Imm) & 0xffff) : Imm));


assert
(
isUInt
<
1
>
(
Imm
)
&&
"Invalid immediate"
)
;

assert(isUInt<1>(Imm) && "Invalid immediate");


Inst . addOperand ( MCOperand :: createImm ( Imm > 2 ? ( SignExtend64 < 1 > ( Imm ) & 1 ) : Imm ) ) ;

Inst.addOperand(MCOperand::createImm(Imm > 2 ? (SignExtend64<1>(Imm) & 1) : Imm));


static DecodeStatus DecodeFPR16RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeFPR16RegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


MCRegister Reg = zmtarzm :: X0 + RegNo ;


Inst . addOperand ( MCOperand :: createReg ( Reg ) ) ;


MCRegister Reg = zmtarzm :: R0 + RegNo ;


MCRegister Reg = zmtarzm :: D0 + RegNo ;


MCRegister Reg = zmtarzm :: r0 + RegNo ;


MCRegister Reg = zmtarzm :: PCB + RegNo ;


MCRegister Reg = zmtarzm :: Q0 + RegNo ;


MCRegister Reg = zmtarzm :: W0 + RegNo ;


static DecodeStatus DecodeFPR32CRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeFPR32CRegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


static DecodeStatus DecodeFPR32RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeFPR32RegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


static DecodeStatus DecodeFPR64CRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeFPR64CRegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


static DecodeStatus DecodeFPR64RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeFPR64RegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


static DecodeStatus decodeFRMArg(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder) {

static DecodeStatus decodeFRMArg ( MCInst & Inst , uint64_t Imm , uint64_t Address , const void * Decoder ) {


if (!A64Imms::isLogicalImmBits(RegWidth, Bits, Imm)) {

if ( ! A64Imms :: isLogicalImmBits ( RegWidth , Bits , Imm ) ) {


Inst . addOperand ( MCOperand :: createImm ( Imm ) ) ;


static DecodeStatus DecodeGPRCRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeGPRCRegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


MCRegister Reg = zmtarzm :: PC + RegNo ;


MCRegister Reg = zmtarzm :: FCSR0 + RegNo ;

MCRegister Reg = zmtarzm::FCSR0 + RegNo;


Inst . addOperand ( MCOperand :: createReg ( Reg ) ) ;


MCRegister Reg = zmtarzm :: X0 + RegNo ;


MCRegister Reg = zmtarzm :: P0 + RegNo ;


MCRegister Reg = zmtarzm :: R0 + RegNo ;


static DecodeStatus DecodeGPRNoX0RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeGPRNoX0RegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


return DecodeGPRRegisterClass(Inst, RegNo, Address, Decoder);

return DecodeGPRRegisterClass ( Inst , RegNo , Address , Decoder ) ;


static DecodeStatus DecodeGPRNoX0X2RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeGPRNoX0X2RegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


return DecodeGPRNoX0RegisterClass(Inst, RegNo, Address, Decoder);

return DecodeGPRNoX0RegisterClass ( Inst , RegNo , Address , Decoder ) ;


static DecodeStatus DecodeGPRRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeGPRRegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


MCRegister Register = zmtarzm :: W0 + RegNo ;

MCRegister Register = zmtarzm::W0 + RegNo;


Inst . addOperand ( MCOperand :: createReg ( Register ) ) ;


MCRegister Register = zmtarzm :: R0 + RegNo ;

MCRegister Register = zmtarzm::R0 + RegNo;


static DecodeStatus DecodePulpV2RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodePulpV2RegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


static DecodeStatus DecodePulpV4RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodePulpV4RegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


static DecodeStatus decodeRVCInstrRdRs1Rs2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder) {

static DecodeStatus decodeRVCInstrRdRs1Rs2 ( MCInst & Inst , unsigned Insn , uint64_t Address , const void * Decoder ) {


unsigned d = fieldFromInstruction(Insn, #, #);

unsigned d = fieldFromInstruction ( Insn , # , # ) ;

unsigned d = fieldFromInstruction ( Insn , 28 , 4 ) ;

unsigned d = fieldFromInstruction(Insn, 28, 4);


unsigned s1 = fieldFromInstruction(Insn, #, #);

unsigned s1 = fieldFromInstruction ( Insn , # , # ) ;

unsigned s1 = fieldFromInstruction ( Insn , 8 , 4 ) ;

unsigned s1 = fieldFromInstruction(Insn, 8, 4);


DecodeStatus status = DecodeGPRRegisterClass(Inst, d, Address, Decoder);

DecodeStatus status = DecodeGPRRegisterClass ( Inst , d , Address , Decoder ) ;


if (status != MCDisassembler::Success) {

if ( status != MCDisassembler :: Success ) {


Inst . addOperand ( MCOperand :: createImm ( const9 ) ) ;


status = DecodeGPRRegisterClass(Inst, s1, Address, Decoder);

status = DecodeGPRRegisterClass ( Inst , s1 , Address , Decoder ) ;


static DecodeStatus decodeRVCInstrRdRs1UImm(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder) {

static DecodeStatus decodeRVCInstrRdRs1UImm ( MCInst & Inst , unsigned Insn , uint64_t Address , const void * Decoder ) {


unsigned char cmode = (insn >> 8) & 0xF;

unsigned char cmode = ( insn >> 8 ) & 0xF ;


const JmpExtraValues *extra = (reinterpret_cast<const JmpExtraValues*>(Addr));

const JmpExtraValues * extra = ( reinterpret_cast < const JmpExtraValues * > ( Addr ) ) ;


uint64_t address = extra->Address + extra->Imm;

uint64_t address = extra -> Address + extra -> Imm ;


if (!tryAddingSymbolicOperand(address, 0, true, 0, Inst, Decoder)) {

if ( ! tryAddingSymbolicOperand ( address , 0 , true , 0 , Inst , Decoder ) ) {


Inst . addOperand ( MCOperand :: createImm ( extra -> Imm ) ) ;


unsigned Register = PredicateTable[extra->Predicate];

unsigned Register = PredicateTable [ extra -> Predicate ] ;


Inst . addOperand ( MCOperand :: createReg ( Register ) ) ;


Inst . addOperand ( MCOperand :: createImm ( # ) ) ;


Inst . addOperand ( MCOperand :: createImm ( Imm ) ) ;


Inst . addOperand ( MCOperand :: createImm ( extra -> Polarity ) ) ;


static DecodeStatus decodeRVCInstrRdRs2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder) {

static DecodeStatus decodeRVCInstrRdRs2 ( MCInst & Inst , unsigned Insn , uint64_t Address , const void * Decoder ) {


unsigned Rd = fieldFromInstruction(Insn, #, #);

unsigned Rd = fieldFromInstruction ( Insn , # , # ) ;

unsigned Rd = fieldFromInstruction ( Insn , 4 , 3 ) ;

unsigned Rd = fieldFromInstruction(Insn, 4, 3);


unsigned Rs2 = fieldFromInstruction(Insn, #, #);

unsigned Rs2 = fieldFromInstruction ( Insn , # , # ) ;

unsigned Rs2 = fieldFromInstruction ( Insn , 0 , 3 ) ;

unsigned Rs2 = fieldFromInstruction(Insn, 0, 3);


DecodeStatus status = DecodeGPRRegisterClass(Inst, Rd, Address, Decoder);

DecodeStatus status = DecodeGPRRegisterClass ( Inst , Rd , Address , Decoder ) ;


if ( status != MCDisassembler :: Success ) {


status = DecodeGPRRegisterClass(Inst, Rs2, Address, Decoder);

status = DecodeGPRRegisterClass ( Inst , Rs2 , Address , Decoder ) ;


unsigned Rd = fieldFromInstruction ( Insn , 8 , 3 ) ;

unsigned Rd = fieldFromInstruction(Insn, 8, 3);


unsigned Rs2 = fieldFromInstruction ( Insn , 0 , 8 ) ;

unsigned Rs2 = fieldFromInstruction(Insn, 0, 8);


static DecodeStatus decodeRVCInstrRdSImm(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder) {

static DecodeStatus decodeRVCInstrRdSImm ( MCInst & Inst , unsigned Insn , uint64_t Address , const void * Decoder ) {


unsigned char cmode = ( insn >> 8 ) & 0xF ;


const JmpExtraValues * extra = ( reinterpret_cast < const JmpExtraValues * > ( Addr ) ) ;


uint64_t address = extra -> Address + extra -> Imm ;


if ( ! tryAddingSymbolicOperand ( address , 0 , true , 0 , Inst , Decoder ) ) {


Inst . addOperand ( MCOperand :: createImm ( extra -> Imm ) ) ;


unsigned Register = PredicateTable [ extra -> Predicate ] ;


Inst . addOperand ( MCOperand :: createReg ( Register ) ) ;


Inst . addOperand ( MCOperand :: createImm ( # ) ) ;


return ( op << 12 ) | ( cmode << 8 ) | Imm8 ;

return (op << 12) | (cmode << 8) | Imm8;


Inst . addOperand ( MCOperand :: createImm ( Imm ) ) ;


Inst . addOperand ( MCOperand :: createImm ( extra -> Polarity ) ) ;


static DecodeStatus decodeRVCInstrSImm(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder) {

static DecodeStatus decodeRVCInstrSImm ( MCInst & Inst , unsigned Insn , uint64_t Address , const void * Decoder ) {


template <unsigned N> static DecodeStatus decodeSImmNonZeroOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder) {

template < unsigned N > static DecodeStatus decodeSImmNonZeroOperand ( MCInst & Inst , uint64_t Imm , int64_t Address , const void * Decoder ) {


assert(isUInt<N>(Imm) && "Invalid immediate");

assert
(
isUInt
<
N
>
(
Imm
)
&&
"Invalid immediate"
)
;


addImplySP ( Inst , Address , Decoder ) ;


Inst . addOperand ( MCOperand :: createImm ( SignExtend64 < N > ( Imm ) ) ) ;


template <unsigned N> static DecodeStatus decodeSImmOperandAndLsl1(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder) {

template < unsigned N > static DecodeStatus decodeSImmOperandAndLsl1 ( MCInst & Inst , uint64_t Imm , int64_t Address , const void * Decoder ) {


Inst . addOperand ( MCOperand :: createImm ( SignExtend64 < N > ( Imm << 1 ) ) ) ;


template <unsigned N> static DecodeStatus decodeSImmOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder) {

template < unsigned N > static DecodeStatus decodeSImmOperand ( MCInst & Inst , uint64_t Imm , int64_t Address , const void * Decoder ) {


template <unsigned N> static DecodeStatus decodeUImmMinus1Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder) {

template < unsigned N > static DecodeStatus decodeUImmMinus1Operand ( MCInst & Inst , uint64_t Imm , int64_t Address , const void * Decoder ) {


assert(isUInt<N>(Imm+1) && "Invalid immediate");

assert
(
isUInt
<
N
>
(
Imm
+
1
)
&&
"Invalid immediate"
)
;


Inst . addOperand ( MCOperand :: createImm ( Imm + 1 ) ) ;


template <unsigned N> static DecodeStatus decodeUImmNonZeroOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder) {

template < unsigned N > static DecodeStatus decodeUImmNonZeroOperand ( MCInst & Inst , uint64_t Imm , int64_t Address , const void * Decoder ) {


template <unsigned N> static DecodeStatus decodeUImmOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder) {

template < unsigned N > static DecodeStatus decodeUImmOperand ( MCInst & Inst , uint64_t Imm , int64_t Address , const void * Decoder ) {


static DecodeStatus decodeVMaskReg(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus decodeVMaskReg ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


MCRegister Reg = zmtarzm :: NoRegister ;


Inst . addOperand ( MCOperand :: createReg ( # ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: D0 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: D1 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: D2 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: D3 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: R0 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: R1 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: R2 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: R3 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: R9 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: R12 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: FCSR0 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: FCSR1 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: FCSR2 ) ) ;


Inst . addOperand ( MCOperand :: createReg ( zmtarzm :: FCSR3 ) ) ;


static DecodeStatus DecodeVRRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder) {

static DecodeStatus DecodeVRRegisterClass ( MCInst & Inst , uint64_t RegNo , uint64_t Address , const void * Decoder ) {


MCRegister Register = zmtarzm :: W0 + RegNo ;

MCRegister Register = zmtarzm::W0 + RegNo;


Inst . addOperand ( MCOperand :: createReg ( Register ) ) ;


MCRegister Register = zmtarzm :: R0 + RegNo ;

MCRegister Register = zmtarzm::R0 + RegNo;


zmtarzmDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx,  MCInstrInfo const *MCII): MCDisassembler(STI, Ctx), MCII(MCII) {

zmtarzmDisassembler ( const MCSubtargetInfo & STI , MCContext & Ctx , MCInstrInfo const * MCII ) : MCDisassembler ( STI , Ctx ) , MCII ( MCII ) {


DecodeStatus zmtarzmDisassembler::getInstruction(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes, uint64_t Address, raw_ostream &CS) const {

DecodeStatus zmtarzmDisassembler :: getInstruction ( MCInst & MI , uint64_t & Size , ArrayRef < uint8_t > Bytes , uint64_t Address , raw_ostream & CS ) const {


if (!readInstruction64(Bytes, Address, Size, Insn64)) {

if ( ! readInstruction64 ( Bytes , Address , Size , Insn64 ) ) {


Result = decodeInstruction(DecoderTable64, Instr, Insn64, Address, this, STI);

Result = decodeInstruction ( DecoderTable64 , Instr , Insn64 , Address , this , STI ) ;


LLVM_DEBUG(dbgs() << "Successfully decoded 64-bit instruction.");


LLVM_DEBUG(dbgs() << "Not a 64-bit instruction, falling back to 32-bit.");


if (!readInstruction32(Bytes, Address, Size, Insn32)) {

if ( ! readInstruction32 ( Bytes , Address , Size , Insn32 ) ) {


return decodeInstruction(DecoderTable32, Instr, Insn32, Address, this, STI);

return decodeInstruction ( DecoderTable32 , Instr , Insn32 , Address , this , STI ) ;


if (!readInstruction48(Bytes, Address, Size, Insn48)) {

if ( ! readInstruction48 ( Bytes , Address , Size , Insn48 ) ) {


Result = decodeInstruction(DecoderTable48, Instr, Insn48, Address, this, STI);

Result = decodeInstruction ( DecoderTable48 , Instr , Insn48 , Address , this , STI ) ;


LLVM_DEBUG(dbgs() << "Successfully decoded 16-bit instruction with limm.");


LLVM_DEBUG(dbgs() << "Not a 16-bit instruction with limm, try without it.");


if (!readInstruction16(Bytes, Address, Size, Insn16)) {

if ( ! readInstruction16 ( Bytes , Address , Size , Insn16 ) ) {


return decodeInstruction(DecoderTable16, Instr, Insn16, Address, this, STI);

return decodeInstruction ( DecoderTable16 , Instr , Insn16 , Address , this , STI ) ;


LLVM_DEBUG(dbgs() << "Trying zmtarzm 24bit table :\n");

LLVM_DEBUG
(
dbgs
(
)
<<
"Trying zmtarzm 24bit table :\n"
)
;


Result = decodeInstruction(DecoderTable24, MI, Inst, Address, this, STI);

Result = decodeInstruction ( DecoderTable24 , MI , Inst , Address , this , STI ) ;


Inst = support :: endian :: read16le ( Bytes . data ( ) ) ;


LLVM_DEBUG(dbgs() << "Trying zmtarzm 16bit table :\n");

LLVM_DEBUG
(
dbgs
(
)
<<
"Trying zmtarzm 16bit table :\n"
)
;


Result = decodeInstruction(DecoderTable16, MI, Inst, Address, this, STI);

Result = decodeInstruction ( DecoderTable16 , MI , Inst , Address , this , STI ) ;


DecodeStatus zmtarzmDisassembler::getInstruction(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes, uint64_t Address, raw_ostream &CS) const {

DecodeStatus zmtarzmDisassembler :: getInstruction ( MCInst & MI , uint64_t & Size , ArrayRef < uint8_t > Bytes , uint64_t Address , raw_ostream & CS ) const {


if (!readInstruction64(Bytes, Address, Size, Insn64)) {

if ( ! readInstruction64 ( Bytes , Address , Size , Insn64 ) ) {


Result = decodeInstruction(DecoderTable64, Instr, Insn64, Address, this, STI);

Result = decodeInstruction ( DecoderTable64 , Instr , Insn64 , Address , this , STI ) ;


LLVM_DEBUG(dbgs() << "Successfully decoded 64-bit instruction.");


LLVM_DEBUG(dbgs() << "Not a 64-bit instruction, falling back to 32-bit.");


if (!readInstruction32(Bytes, Address, Size, Insn32)) {

if ( ! readInstruction32 ( Bytes , Address , Size , Insn32 ) ) {


return decodeInstruction(DecoderTable32, Instr, Insn32, Address, this, STI);

return decodeInstruction ( DecoderTable32 , Instr , Insn32 , Address , this , STI ) ;


if (!readInstruction48(Bytes, Address, Size, Insn48)) {

if ( ! readInstruction48 ( Bytes , Address , Size , Insn48 ) ) {


Result = decodeInstruction(DecoderTable48, Instr, Insn48, Address, this, STI);

Result = decodeInstruction ( DecoderTable48 , Instr , Insn48 , Address , this , STI ) ;


LLVM_DEBUG(dbgs() << "Successfully decoded 16-bit instruction with limm.");


LLVM_DEBUG(dbgs() << "Not a 16-bit instruction with limm, try without it.");


if (!readInstruction16(Bytes, Address, Size, Insn16)) {

if ( ! readInstruction16 ( Bytes , Address , Size , Insn16 ) ) {


return decodeInstruction(DecoderTable16, Instr, Insn16, Address, this, STI);

return decodeInstruction ( DecoderTable16 , Instr , Insn16 , Address , this , STI ) ;


LLVM_DEBUG(dbgs() << "Trying zmtarzm 24bit table :\n");

LLVM_DEBUG
(
dbgs
(
)
<<
"Trying zmtarzm 24bit table :\n"
)
;


Result = decodeInstruction(DecoderTable24, MI, Inst, Address, this, STI);

Result = decodeInstruction ( DecoderTable24 , MI , Inst , Address , this , STI ) ;


Inst = support :: endian :: read16le ( Bytes . data ( ) ) ;


LLVM_DEBUG(dbgs() << "Trying zmtarzm 16bit table :\n");

LLVM_DEBUG
(
dbgs
(
)
<<
"Trying zmtarzm 16bit table :\n"
)
;


Result = decodeInstruction(DecoderTable16, MI, Inst, Address, this, STI);

Result = decodeInstruction ( DecoderTable16 , MI , Inst , Address , this , STI ) ;


extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializezmtarzmDisassembler() {

extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializezmtarzmDisassembler ( ) {


TargetRegistry :: RegisterMCDisassembler ( getThezmtarzmTarget ( ) , createzmtarzmDisassembler ) ;


TargetRegistry :: RegisterMCDisassembler ( getThezmtarzm32Target ( ) , createzmtarzmDisassembler ) ;


TargetRegistry :: RegisterMCDisassembler ( getThezmtarzm64Target ( ) , createzmtarzmDisassembler ) ;


std::unique_ptr<MCObjectTargetWriter> llvm::createzmtarzmELFObjectWriter(uint8_t OSABI, bool Is64Bit) {

std :: unique_ptr < MCObjectTargetWriter > llvm :: createzmtarzmELFObjectWriter ( uint8_t OSABI , bool Is64Bit ) {


return std :: make_unique < zmtarzmELFObjectWriter > ( OSABI , Is64Bit ) ;


zmtarzmELFObjectWriter::zmtarzmELFObjectWriter(uint8_t OSABI, bool Is64Bit) : MCELFObjectTargetWriter(Is64Bit, OSABI, ELF::EM_zmtarzm, #) {

zmtarzmELFObjectWriter :: zmtarzmELFObjectWriter ( uint8_t OSABI , bool Is64Bit ) : MCELFObjectTargetWriter ( Is64Bit , OSABI , ELF :: EM_zmtarzm , # ) {

zmtarzmELFObjectWriter :: zmtarzmELFObjectWriter ( uint8_t OSABI , bool Is64Bit ) : MCELFObjectTargetWriter ( Is64Bit , OSABI , EM_zmtarzm , false ) {

zmtarzmELFObjectWriter::zmtarzmELFObjectWriter(uint8_t OSABI, bool Is64Bit) : MCELFObjectTargetWriter(Is64Bit, OSABI, EM_zmtarzm, false) {


zmtarzmELFObjectWriter :: zmtarzmELFObjectWriter ( uint8_t OSABI , bool Is64Bit ) : MCELFObjectTargetWriter ( Is64Bit , OSABI , EM_zmtarzm , true ) {

zmtarzmELFObjectWriter::zmtarzmELFObjectWriter(uint8_t OSABI, bool Is64Bit) : MCELFObjectTargetWriter(Is64Bit, OSABI, EM_zmtarzm, true) {


unsigned zmtarzmELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const {

unsigned zmtarzmELFObjectWriter :: getRelocType ( MCContext & Ctx , const MCValue & Target , const MCFixup & Fixup , bool IsPCRel ) const {


if (SExpr = dyn_cast<zmtarzmMCExpr>(Fixup.getValue())) {

if ( SExpr = dyn_cast < zmtarzmMCExpr > ( Fixup . getValue ( ) ) ) {


if (Kind >= FirstLiteralRelocationKind){

if ( Kind >= FirstLiteralRelocationKind ) {


return Kind - FirstLiteralRelocationKind;

return Kind - FirstLiteralRelocationKind ;


Ctx . reportError ( Fixup . getLoc ( ) , # ) ;


Ctx.reportError(Fixup.getLoc(), "Unsupported relocation type");

Ctx
.
reportError
(
Fixup
.
getLoc
(
)
,
"Unsupported relocation type"
)
;


if ( Kind == zmtarzm :: fixup_zmtarzm_32 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_64 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_RELATIVE ) {

if(Kind == zmtarzm::fixup_zmtarzm_RELATIVE) {


if ( Kind == zmtarzm :: fixup_zmtarzm_COPY ) {

if(Kind == zmtarzm::fixup_zmtarzm_COPY) {


if ( Kind == zmtarzm :: fixup_zmtarzm_JUMP_SLOT ) {

if(Kind == zmtarzm::fixup_zmtarzm_JUMP_SLOT) {


if ( Kind == zmtarzm :: fixup_zmtarzm_TLS_DTPMOD32 ) {

if(Kind == zmtarzm::fixup_zmtarzm_TLS_DTPMOD32) {


if ( Kind == zmtarzm :: fixup_zmtarzm_TLS_DTPMOD64 ) {

if(Kind == zmtarzm::fixup_zmtarzm_TLS_DTPMOD64) {


if ( Kind == zmtarzm :: fixup_zmtarzm_TLS_DTPREL32 ) {

if(Kind == zmtarzm::fixup_zmtarzm_TLS_DTPREL32) {


if ( Kind == zmtarzm :: fixup_zmtarzm_TLS_DTPREL64 ) {

if(Kind == zmtarzm::fixup_zmtarzm_TLS_DTPREL64) {


if ( Kind == zmtarzm :: fixup_zmtarzm_NONE ) {

if(Kind == zmtarzm::fixup_zmtarzm_NONE) {


if ( Kind == zmtarzm :: fixup_zmtarzm_BR32 ) {

if(Kind == zmtarzm::fixup_zmtarzm_BR32) {


if ( Kind == zmtarzm :: fixup_zmtarzm_BRCC32 ) {

if(Kind == zmtarzm::fixup_zmtarzm_BRCC32) {


if ( Kind == zmtarzm :: fixup_zmtarzm_BAL32 ) {

if(Kind == zmtarzm::fixup_zmtarzm_BAL32) {


if ( Kind == zmtarzm :: fixup_zmtarzm_ABS6 ) {

if(Kind == zmtarzm::fixup_zmtarzm_ABS6) {


if ( Kind == zmtarzm :: fixup_zmtarzm_ABS9 ) {

if(Kind == zmtarzm::fixup_zmtarzm_ABS9) {


if ( Kind == zmtarzm :: fixup_zmtarzm_ABS10 ) {

if(Kind == zmtarzm::fixup_zmtarzm_ABS10) {


Ctx . reportError ( Fixup . getLoc ( ) , # ) ;


if ( Kind == zmtarzm :: fixup_zmtarzm_ABS12 ) {

if(Kind == zmtarzm::fixup_zmtarzm_ABS12) {


if ( Kind == zmtarzm :: fixup_zmtarzm_ABS16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_ABS16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_SHIFT6 ) {

if(Kind == zmtarzm::fixup_zmtarzm_SHIFT6) {


if ( Kind == zmtarzm :: fixup_zmtarzm_OFF10 ) {

if(Kind == zmtarzm::fixup_zmtarzm_OFF10) {


if ( Kind == zmtarzm :: fixup_zmtarzm_BR16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_BR16) {


Ctx.reportError(Fixup.getLoc(), "Cannot emit relocations for short instruction fixups!");


if ( Kind == zmtarzm :: fixup_zmtarzm_BRCC16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_BRCC16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_BAL16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_BAL16) {


Ctx
.
reportError
(
Fixup
.
getLoc
(
)
,
"Unsupported relocation type"
)
;

Ctx.reportError(Fixup.getLoc(), "Unsupported relocation type");


unsigned zmtarzmELFObjectWriter :: getRelocType ( MCContext & Ctx , const MCValue & Target , const MCFixup & Fixup , bool IsPCRel ) const {

unsigned zmtarzmELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const {


if ( SExpr = dyn_cast < zmtarzmMCExpr > ( Fixup . getValue ( ) ) ) {

if (SExpr = dyn_cast<zmtarzmMCExpr>(Fixup.getValue())) {


if ( Kind >= FirstLiteralRelocationKind ) {

if (Kind >= FirstLiteralRelocationKind){


return Kind - FirstLiteralRelocationKind ;

return Kind - FirstLiteralRelocationKind;


if ( Kind == zmtarzm :: fixup_zmtarzm_32 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_7_pcrel ) {

if(Kind == zmtarzm::fixup_zmtarzm_7_pcrel) {


if ( Kind == zmtarzm :: fixup_zmtarzm_13_pcrel ) {

if(Kind == zmtarzm::fixup_zmtarzm_13_pcrel) {


if ( Kind == zmtarzm :: fixup_zmtarzm_16 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_16_pm ) {

if(Kind == zmtarzm::fixup_zmtarzm_16_pm) {


if ( Kind == zmtarzm :: fixup_zmtarzm_lo8_ldi ) {

if(Kind == zmtarzm::fixup_zmtarzm_lo8_ldi) {


Ctx . reportError ( Fixup . getLoc ( ) , # ) ;


if ( Kind == zmtarzm :: fixup_zmtarzm_hi8_ldi ) {

if(Kind == zmtarzm::fixup_zmtarzm_hi8_ldi) {


if ( Kind == zmtarzm :: fixup_zmtarzm_hh8_ldi ) {

if(Kind == zmtarzm::fixup_zmtarzm_hh8_ldi) {


if ( Kind == zmtarzm :: fixup_zmtarzm_lo8_ldi_neg ) {

if(Kind == zmtarzm::fixup_zmtarzm_lo8_ldi_neg) {


if ( Kind == zmtarzm :: fixup_zmtarzm_hi8_ldi_neg ) {

if(Kind == zmtarzm::fixup_zmtarzm_hi8_ldi_neg) {


if ( Kind == zmtarzm :: fixup_zmtarzm_hh8_ldi_neg ) {

if(Kind == zmtarzm::fixup_zmtarzm_hh8_ldi_neg) {


if ( Kind == zmtarzm :: fixup_zmtarzm_lo8_ldi_pm ) {

if(Kind == zmtarzm::fixup_zmtarzm_lo8_ldi_pm) {


if ( Kind == zmtarzm :: fixup_zmtarzm_hi8_ldi_pm ) {

if(Kind == zmtarzm::fixup_zmtarzm_hi8_ldi_pm) {


if ( Kind == zmtarzm :: fixup_zmtarzm_hh8_ldi_pm ) {

if(Kind == zmtarzm::fixup_zmtarzm_hh8_ldi_pm) {


if ( Kind == zmtarzm :: fixup_zmtarzm_lo8_ldi_pm_neg ) {

if(Kind == zmtarzm::fixup_zmtarzm_lo8_ldi_pm_neg) {


return ELF :: R_zmtarzm_LO8_LDI_PM_NEG ;


if ( Kind == zmtarzm :: fixup_zmtarzm_hi8_ldi_pm_neg ) {

if(Kind == zmtarzm::fixup_zmtarzm_hi8_ldi_pm_neg) {


return ELF :: R_zmtarzm_HI8_LDI_PM_NEG ;


if ( Kind == zmtarzm :: fixup_zmtarzm_hh8_ldi_pm_neg ) {

if(Kind == zmtarzm::fixup_zmtarzm_hh8_ldi_pm_neg) {


return ELF :: R_zmtarzm_HH8_LDI_PM_NEG ;


if ( Kind == zmtarzm :: fixup_zmtarzm_call ) {

if(Kind == zmtarzm::fixup_zmtarzm_call) {


if ( Kind == zmtarzm :: fixup_zmtarzm_ldi ) {

if(Kind == zmtarzm::fixup_zmtarzm_ldi) {


if ( Kind == zmtarzm :: fixup_zmtarzm_6 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_ms8_ldi ) {

if(Kind == zmtarzm::fixup_zmtarzm_ms8_ldi) {


if ( Kind == zmtarzm :: fixup_zmtarzm_lo8_ldi_gs ) {

if(Kind == zmtarzm::fixup_zmtarzm_lo8_ldi_gs) {


if ( Kind == zmtarzm :: fixup_zmtarzm_hi8_ldi_gs ) {

if(Kind == zmtarzm::fixup_zmtarzm_hi8_ldi_gs) {


Ctx . reportError ( Fixup . getLoc ( ) , # ) ;


if ( Kind == zmtarzm :: fixup_zmtarzm_8 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_8_lo8 ) {

if(Kind == zmtarzm::fixup_zmtarzm_8_lo8) {


Ctx
.
reportError
(
Fixup
.
getLoc
(
)
,
"Unsupported relocation type"
)
;

Ctx.reportError(Fixup.getLoc(), "Unsupported relocation type");


unsigned zmtarzmELFObjectWriter :: getRelocType ( MCContext & Ctx , const MCValue & Target , const MCFixup & Fixup , bool IsPCRel ) const {

unsigned zmtarzmELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const {


if ( SExpr = dyn_cast < zmtarzmMCExpr > ( Fixup . getValue ( ) ) ) {

if (SExpr = dyn_cast<zmtarzmMCExpr>(Fixup.getValue())) {


if ( Kind >= FirstLiteralRelocationKind ) {

if (Kind >= FirstLiteralRelocationKind){


return Kind - FirstLiteralRelocationKind ;

return Kind - FirstLiteralRelocationKind;


if ( Kind == zmtarzm :: fixup_zmtarzm_32 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_GPREL16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_GPREL16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_GOT ) {

if(Kind == zmtarzm::fixup_zmtarzm_GOT) {


if ( Kind == zmtarzm :: fixup_zmtarzm_HI16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_HI16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_LO16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_LO16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_GOT_HI16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_GOT_HI16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_GOT_LO16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_GOT_LO16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_PC16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_PC16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_PC24 ) {

if(Kind == zmtarzm::fixup_zmtarzm_PC24) {


Ctx . reportError ( Fixup . getLoc ( ) , # ) ;


if ( Kind == zmtarzm :: fixup_zmtarzm_CALL16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_CALL16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_21 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_21_F ) {

if(Kind == zmtarzm::fixup_zmtarzm_21_F) {


if ( Kind == zmtarzm :: fixup_zmtarzm_25 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_NONE ) {

if(Kind == zmtarzm::fixup_zmtarzm_NONE) {


Ctx
.
reportError
(
Fixup
.
getLoc
(
)
,
"Unsupported relocation type"
)
;


unsigned zmtarzmELFObjectWriter :: getRelocType ( MCContext & Ctx , const MCValue & Target , const MCFixup & Fixup , bool IsPCRel ) const {


if ( SExpr = dyn_cast < zmtarzmMCExpr > ( Fixup . getValue ( ) ) ) {


if ( Kind >= FirstLiteralRelocationKind ) {


return Kind - FirstLiteralRelocationKind ;


if ( Kind == zmtarzm :: fixup_zmtarzm_32 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_HI16 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_LO16 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_HI ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_LO ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_DISP16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_DISP16) {


Ctx . reportError ( Fixup . getLoc ( ) , # ) ;


if ( Kind == zmtarzm :: fixup_zmtarzm_DISP26 ) {

if(Kind == zmtarzm::fixup_zmtarzm_DISP26) {


Ctx.reportError(Fixup.getLoc(), "Unsupported relocation type");


unsigned zmtarzmELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const {


if (SExpr = dyn_cast<zmtarzmMCExpr>(Fixup.getValue())) {


if (Kind >= FirstLiteralRelocationKind){


return Kind - FirstLiteralRelocationKind;


if ( Kind == zmtarzm :: fixup_zmtarzm_10_pcrel ) {

if(Kind == zmtarzm::fixup_zmtarzm_10_pcrel) {


if ( Kind == zmtarzm :: fixup_zmtarzm_16 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_16_pcrel ) {

if(Kind == zmtarzm::fixup_zmtarzm_16_pcrel) {


if ( Kind == zmtarzm :: fixup_zmtarzm_16_byte ) {

if(Kind == zmtarzm::fixup_zmtarzm_16_byte) {


if ( Kind == zmtarzm :: fixup_zmtarzm_16_pcrel_byte ) {

if(Kind == zmtarzm::fixup_zmtarzm_16_pcrel_byte) {


if ( Kind == zmtarzm :: fixup_zmtarzm_2x_pcrel ) {

if(Kind == zmtarzm::fixup_zmtarzm_2x_pcrel) {


if ( Kind == zmtarzm :: fixup_zmtarzm_rl_pcrel ) {

if(Kind == zmtarzm::fixup_zmtarzm_rl_pcrel) {


if ( Kind == zmtarzm :: fixup_zmtarzm_8 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_sym_diff ) {

if(Kind == zmtarzm::fixup_zmtarzm_sym_diff) {


Ctx
.
reportError
(
Fixup
.
getLoc
(
)
,
"Unsupported relocation type"
)
;


unsigned zmtarzmELFObjectWriter :: getRelocType ( MCContext & Ctx , const MCValue & Target , const MCFixup & Fixup , bool IsPCRel ) const {


if ( SExpr = dyn_cast < zmtarzmMCExpr > ( Fixup . getValue ( ) ) ) {


if ( Kind >= FirstLiteralRelocationKind ) {


return Kind - FirstLiteralRelocationKind ;


if ( Kind == zmtarzm :: fixup_zmtarzm_32 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_20 ) {


if ( Kind == zmtarzm :: fixup_zmtarzm_PC32 ) {

if(Kind == zmtarzm::fixup_zmtarzm_PC32) {


if ( Kind == zmtarzm :: fixup_zmtarzm_PC20 ) {

if(Kind == zmtarzm::fixup_zmtarzm_PC20) {


Ctx . reportError ( Fixup . getLoc ( ) , # ) ;


if ( Kind == zmtarzm :: fixup_zmtarzm_AUG20 ) {

if(Kind == zmtarzm::fixup_zmtarzm_AUG20) {


if ( Kind == zmtarzm :: fixup_zmtarzm_COG9 ) {

if(Kind == zmtarzm::fixup_zmtarzm_COG9) {


if ( Kind == zmtarzm :: fixup_zmtarzm_GPREL16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_GPREL16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_CALL16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_CALL16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_GOT ) {

if(Kind == zmtarzm::fixup_zmtarzm_GOT) {


if ( Kind == zmtarzm :: fixup_zmtarzm_HI16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_HI16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_LO16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_LO16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_PC16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_PC16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_PC24 ) {

if(Kind == zmtarzm::fixup_zmtarzm_PC24) {


if ( Kind == zmtarzm :: fixup_zmtarzm_GOT_HI16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_GOT_HI16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_GOT_LO16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_GOT_LO16) {


Ctx
.
reportError
(
Fixup
.
getLoc
(
)
,
"Unsupported relocation type"
)
;

Ctx.reportError(Fixup.getLoc(), "Unsupported relocation type");


unsigned zmtarzmELFObjectWriter :: getRelocType ( MCContext & Ctx , const MCValue & Target , const MCFixup & Fixup , bool IsPCRel ) const {

unsigned zmtarzmELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const {


if ( SExpr = dyn_cast < zmtarzmMCExpr > ( Fixup . getValue ( ) ) ) {

if (SExpr = dyn_cast<zmtarzmMCExpr>(Fixup.getValue())) {


if ( Kind >= FirstLiteralRelocationKind ) {

if (Kind >= FirstLiteralRelocationKind){


return Kind - FirstLiteralRelocationKind ;

return Kind - FirstLiteralRelocationKind;


Ctx . reportError ( Fixup . getLoc ( ) , # ) ;


if ( Kind == zmtarzm :: fixup_zmtarzm_bkrep_r6 ) {

if(Kind == zmtarzm::fixup_zmtarzm_bkrep_r6) {


if ( Kind == zmtarzm :: fixup_zmtarzm_bkrep_reg ) {

if(Kind == zmtarzm::fixup_zmtarzm_bkrep_reg) {


if ( Kind == zmtarzm :: fixup_zmtarzm_ptr_imm16 ) {

if(Kind == zmtarzm::fixup_zmtarzm_ptr_imm16) {


if ( Kind == zmtarzm :: fixup_zmtarzm_rel7 ) {

if(Kind == zmtarzm::fixup_zmtarzm_rel7) {


if ( Kind == zmtarzm :: fixup_zmtarzm_call_imm18 ) {

if(Kind == zmtarzm::fixup_zmtarzm_call_imm18) {


bool needsRelocateWithSymbol(const MCSymbol &Sym, unsigned Type) const override {

bool needsRelocateWithSymbol ( const MCSymbol & Sym , unsigned Type ) const override {


zmtarzmELFObjectWriter :: ~ zmtarzmELFObjectWriter ( ) {


size_t zmtarzmTargetELFStreamer::calculateContentSize() const {

size_t zmtarzmTargetELFStreamer :: calculateContentSize ( ) const {


for ( i = 0 ; i < Contents . size ( ) ; ++ i ) {


if (item.Type == AttributeType::Hidden) {

if ( item . Type == AttributeType :: Hidden ) {


if (item.Type == AttributeType::Numeric) {

if ( item . Type == AttributeType :: Numeric ) {


Result = Result + getULEB128Size(item.Tag);

Result = Result + getULEB128Size ( item . Tag ) ;


Result = Result + getULEB128Size(item.IntValue);

Result = Result + getULEB128Size ( item . IntValue ) ;


if ( item . Type == AttributeType :: Text ) {


Result = Result + item.StringValue.size() + 1;

Result = Result + item . StringValue . size ( ) + 1 ;


if (item.Type == AttributeType::NumericAndText) {

if ( item . Type == AttributeType :: NumericAndText ) {


void zmtarzmTargetELFStreamer::emitAttribute(unsigned Attribute, unsigned Value) {

void zmtarzmTargetELFStreamer :: emitAttribute ( unsigned Attribute , unsigned Value ) {


setAttributeItem ( Attribute , Value , true ) ;


void zmtarzmTargetELFStreamer :: emitDirectiveOptionNoPIC ( ) {


void zmtarzmTargetELFStreamer :: emitDirectiveOptionNoRelax ( ) {


void zmtarzmTargetELFStreamer :: emitDirectiveOptionNoRVC ( ) {


void zmtarzmTargetELFStreamer :: emitDirectiveOptionPIC ( ) {


void zmtarzmTargetELFStreamer :: emitDirectiveOptionPop ( ) {


void zmtarzmTargetELFStreamer :: emitDirectiveOptionPush ( ) {


void zmtarzmTargetELFStreamer :: emitDirectiveOptionRelax ( ) {


void zmtarzmTargetELFStreamer :: emitDirectiveOptionRVC ( ) {


void zmtarzmTargetELFStreamer::emitIntTextAttribute(unsigned Attribute, unsigned IntValue, StringRef StringValue) {

void zmtarzmTargetELFStreamer :: emitIntTextAttribute ( unsigned Attribute , unsigned IntValue , StringRef StringValue ) {


setAttributeItems(Attribute, IntValue, StringValue, true);

setAttributeItems ( Attribute , IntValue , StringValue , true ) ;


void zmtarzmTargetELFStreamer::emitTextAttribute(unsigned Attribute, StringRef String) {

void zmtarzmTargetELFStreamer :: emitTextAttribute ( unsigned Attribute , StringRef String ) {


setAttributeItem(Attribute, String,  true);

setAttributeItem ( Attribute , String , true ) ;


void zmtarzmTargetELFStreamer :: finishAttributeSection ( ) {


if (Arch != zmtarzm::ArchKind::INVALID) {

if ( Arch != zmtarzm :: ArchKind :: INVALID ) {


MCELFStreamer &Streamer = getStreamer();

MCELFStreamer & Streamer = getStreamer ( ) ;


llvm :: sort ( Contents , AttributeItem :: LessTag ) ;


Streamer . SwitchSection ( AttributeSection ) ;


AttributeSection = Streamer.getContext().getELFSection(".zmtarzm_lower.attributes", ELF::SHT_zmtarzm_ATTRIBUTES, 0);

AttributeSection = Streamer . getContext ( ) . getELFSection ( ".zmtarzm_lower.attributes" , ELF :: SHT_zmtarzm_ATTRIBUTES , 0 ) ;


Streamer . emitInt8 ( ELFAttrs :: Format_Version ) ;


const size_t VendorHeaderSize = 4 + CurrentVendor.size() + 1;

const size_t VendorHeaderSize = 4 + CurrentVendor . size ( ) + 1 ;


const size_t ContentsSize = calculateContentSize();

const size_t ContentsSize = calculateContentSize ( ) ;


Streamer.emitInt32(VendorHeaderSize + TagHeaderSize + ContentsSize);

Streamer . emitInt32 ( VendorHeaderSize + TagHeaderSize + ContentsSize ) ;


Streamer . emitBytes ( CurrentVendor ) ;


Streamer . emitInt8 ( ELFAttrs :: File ) ;


Streamer . emitInt32 ( TagHeaderSize + ContentsSize ) ;


for ( i = 0 ; i < Contents . size ( ) ; ++ i ) {


Streamer . emitULEB128IntValue ( item . Tag ) ;


if ( item . Type == AttributeType :: Numeric ) {


Streamer . emitULEB128IntValue ( item . IntValue ) ;


if ( item . Type == AttributeType :: Text ) {


Streamer . emitBytes ( item . StringValue ) ;


if ( item . Type == AttributeType :: NumericAndText ) {


llvm_unreachable
(
"Invalid attribute type"
)
;


void zmtarzmTargetELFStreamer :: finishAttributeSection ( ) {


if ( Arch != zmtarzm :: ArchKind :: INVALID ) {


MCELFStreamer & Streamer = getStreamer ( ) ;


llvm :: sort ( Contents , AttributeItem :: LessTag ) ;


Streamer . SwitchSection ( AttributeSection ) ;


AttributeSection = Streamer . getContext ( ) . getELFSection ( ".zmtarzm_lower.attributes" , ELF :: SHT_zmtarzm_ATTRIBUTES , 0 ) ;


Streamer . emitInt8 ( ELFAttrs :: Format_Version ) ;


const size_t VendorHeaderSize = 4 + CurrentVendor . size ( ) + 1 ;


const size_t ContentsSize = calculateContentSize ( ) ;


Streamer . emitInt32 ( VendorHeaderSize + TagHeaderSize + ContentsSize ) ;


Streamer . emitBytes ( CurrentVendor ) ;


Streamer . emitInt8 ( ELFAttrs :: File ) ;


Streamer . emitInt32 ( TagHeaderSize + ContentsSize ) ;


for ( i = 0 ; i < Contents . size ( ) ; ++ i ) {


Streamer . emitULEB128IntValue ( item . Tag ) ;


if ( item . Type == AttributeType :: Numeric ) {


Streamer . emitULEB128IntValue ( item . IntValue ) ;


if ( item . Type == AttributeType :: Text ) {


Streamer . emitBytes ( item . StringValue ) ;


if ( item . Type == AttributeType :: NumericAndText ) {


llvm_unreachable
(
"Invalid attribute type"
)
;


AttributeItem *getAttributeItem(unsigned Attribute) {

AttributeItem * getAttributeItem ( unsigned Attribute ) {


if ( Contents [ i ] . Tag == Attribute ) {


MCELFStreamer & zmtarzmTargetELFStreamer :: getStreamer ( ) {


return static_cast < MCELFStreamer & > ( Streamer ) ;


void setAttributeItem(unsigned Attribute, unsigned Value, bool OverwriteExisting) {

void setAttributeItem ( unsigned Attribute , unsigned Value , bool OverwriteExisting ) {


if (Item = getAttributeItem(Attribute)) {

if ( Item = getAttributeItem ( Attribute ) ) {


Item -> Type = AttributeType :: Numeric ;


Contents.push_back({AttributeType::Numeric, Attribute, Value, ""});

Contents . push_back ( { AttributeType :: Numeric , Attribute , Value , "" } ) ;


void setAttributeItem(unsigned Attribute, StringRef Value, bool OverwriteExisting) {

void setAttributeItem ( unsigned Attribute , StringRef Value , bool OverwriteExisting ) {


Item -> StringValue = std :: string ( Value ) ;


Contents.push_back({AttributeType::Text, Attribute, 0, std::string(Value)});

Contents . push_back ( { AttributeType :: Text , Attribute , 0 , std :: string ( Value ) } ) ;


void setAttributeItems(unsigned Attribute, unsigned IntValue, StringRef StringValue, bool OverwriteExisting) {

void setAttributeItems ( unsigned Attribute , unsigned IntValue , StringRef StringValue , bool OverwriteExisting ) {


Item -> Type = AttributeType :: NumericAndText ;


Item -> StringValue = std :: string ( StringValue ) ;


Contents.push_back({AttributeType::NumericAndText, Attribute, IntValue, std::string(StringValue)});

Contents . push_back ( { AttributeType :: NumericAndText , Attribute , IntValue , std :: string ( StringValue ) } ) ;


zmtarzmTargetELFStreamer::zmtarzmTargetELFStreamer(MCStreamer &S,  const MCSubtargetInfo &STI) : zmtarzmTargetStreamer(S), CurrentVendor("zmtarzm") {

zmtarzmTargetELFStreamer :: zmtarzmTargetELFStreamer ( MCStreamer & S , const MCSubtargetInfo & STI ) : zmtarzmTargetStreamer ( S ) , CurrentVendor ( "zmtarzm" ) {


MCA = getStreamer ( ) . getAssembler ( ) ;


MAB = static_cast < zmtarzmMCAsmBackend & > ( MCA . getBackend ( ) ) ;


EFlags = EFlags | ELF :: EF_zmtarzm_ABIV2 ;

EFlags = EFlags | ELF::EF_zmtarzm_ABIV2;


if ( Features [ zmtarzm :: ProcCK801 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_801 ;


if ( Features [ zmtarzm :: ProcCK802 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_802 ;


if ( Features [ zmtarzm :: ProcCK803 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_803 ;


if ( Features [ zmtarzm :: ProcCK804 ] ) {


if ( Features [ zmtarzm :: ProcCK805 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_805 ;


if ( Features [ zmtarzm :: ProcCK807 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_807 ;


if ( Features [ zmtarzm :: ProcCK810 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_810 ;


if ( Features [ zmtarzm :: ProcCK860 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_860 ;


if ( Features [ zmtarzm :: FeatureFPUV2_SF ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_FLOAT ;

EFlags = EFlags | ELF::EF_zmtarzm_FLOAT;


if ( Features [ zmtarzm :: FeatureFPUV3_SF ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_EFV1 ;


zmtarzmTargetELFStreamer :: zmtarzmTargetELFStreamer ( MCStreamer & S , const MCSubtargetInfo & STI ) : zmtarzmTargetStreamer ( S ) , CurrentVendor ( "zmtarzm" ) {


MCA = getStreamer ( ) . getAssembler ( ) ;


MAB = static_cast < zmtarzmMCAsmBackend & > ( MCA . getBackend ( ) ) ;


if ( Features [ zmtarzm :: Featurezmtarzm64r6 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_64R6 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_64R6;


if ( Features [ zmtarzm :: Featurezmtarzm64r2 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_64R2 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_64R2;


if ( Features [ zmtarzm :: Featurezmtarzm64r3 ] ) {


if ( Features [ zmtarzm :: Featurezmtarzm64r5 ] ) {


if ( Features [ zmtarzm :: Featurezmtarzm64 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_64 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_64;


if ( Features [ zmtarzm :: Featurezmtarzm5 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_5 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_5;


if ( Features [ zmtarzm :: Featurezmtarzm4 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_4 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_4;


if ( Features [ zmtarzm :: Featurezmtarzm3 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_3 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_3;


if ( Features [ zmtarzm :: Featurezmtarzm32r6 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_32R6 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_32R6;


if ( Features [ zmtarzm :: Featurezmtarzm32r2 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_32R2 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_32R2;


if ( Features [ zmtarzm :: Featurezmtarzm32r3 ] ) {


if ( Features [ zmtarzm :: Featurezmtarzm32r5 ] ) {


if ( Features [ zmtarzm :: Featurezmtarzm32 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_32 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_32;


if ( Features [ zmtarzm :: Featurezmtarzm2 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_2 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_2;


if ( Features [ zmtarzm :: Featurezmtarzm1 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_ARCH_1 ;

EFlags = EFlags | ELF::EF_zmtarzm_ARCH_1;


if ( Features [ zmtarzm :: FeatureNaN2008 ] ) {


EFlags = EFlags | ELF :: EF_zmtarzm_NAN2008 ;

EFlags = EFlags | ELF::EF_zmtarzm_NAN2008;


EFlags = EFlags | ELF :: EF_zmtarzm_CPIC ;


FunctionPass * llvm :: createzmtarzmExpandAtomicPseudoPass ( ) {


return new zmtarzmExpandAtomicPseudo ( ) ;


zmtarzmExpandAtomicPseudo() : MachineFunctionPass(ID) {

zmtarzmExpandAtomicPseudo ( ) : MachineFunctionPass ( ID ) {


initializezmtarzmExpandAtomicPseudoPass ( * PassRegistry :: getPassRegistry ( ) ) ;


bool zmtarzmExpandAtomicPseudo::expandMBB(MachineBasicBlock &MBB) {

bool zmtarzmExpandAtomicPseudo :: expandMBB ( MachineBasicBlock & MBB ) {


MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();

MachineBasicBlock :: iterator MBBI = MBB . begin ( ) , E = MBB . end ( ) ;


MachineBasicBlock::iterator NMBBI = std::next(MBBI);

MachineBasicBlock :: iterator NMBBI = std :: next ( MBBI ) ;


Modified = Modified | expandMI(MBB, MBBI, NMBBI);

Modified = Modified | expandMI ( MBB , MBBI , NMBBI ) ;


bool zmtarzmExpandAtomicPseudo::expandMI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, MachineBasicBlock::iterator &NextMBBI) {

bool zmtarzmExpandAtomicPseudo :: expandMI ( MachineBasicBlock & MBB , MachineBasicBlock :: iterator MBBI , MachineBasicBlock :: iterator & NextMBBI ) {


return expandAtomicCmpSwap(MBB, MBBI, NMBB);

return expandAtomicCmpSwap ( MBB , MBBI , NMBB ) ;


return expandAtomicCmpSwapSubword(MBB, MBBI, NMBB);

return expandAtomicCmpSwapSubword ( MBB , MBBI , NMBB ) ;


return expandAtomicBinOpSubword(MBB, MBBI, NMBB);

return expandAtomicBinOpSubword ( MBB , MBBI , NMBB ) ;


return expandAtomicBinOp(MBB, MBBI, NMBB);

return expandAtomicBinOp ( MBB , MBBI , NMBB ) ;


if ( MBBI -> getOpcode ( ) == zmtarzm :: PseudoCONST ) {

if (MBBI->getOpcode() == zmtarzm::PseudoCONST) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_CMP_SWAP_I32_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_CMP_SWAP_I32_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_CMP_SWAP_I64_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_CMP_SWAP_I64_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_CMP_SWAP_I8_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_CMP_SWAP_I8_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_CMP_SWAP_I16_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_CMP_SWAP_I16_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_SWAP_I8_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_SWAP_I8_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_SWAP_I16_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_SWAP_I16_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_NAND_I8_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_NAND_I8_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_NAND_I16_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_NAND_I16_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_ADD_I8_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_ADD_I8_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_ADD_I16_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_ADD_I16_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_SUB_I8_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_SUB_I8_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_SUB_I16_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_SUB_I16_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_AND_I8_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_AND_I8_POSTRA) {


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_AND_I16_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_AND_I16_POSTRA) {


return expandAtomicBinOpSubword ( MBB , MBBI , NMBB ) ;

return expandAtomicBinOpSubword(MBB, MBBI, NMBB);


if ( MBBI -> getOpcode ( ) == zmtarzm :: ATOMIC_LOAD_OR_I8_POSTRA ) {

if (MBBI->getOpcode() == zmtarzm::ATOMIC_LOAD_OR_I8_POSTRA) {