Fix some incorrect generated LLVM code.

This commit is contained in:
Rot127 2024-03-19 03:03:16 -05:00 committed by Rot127
parent e1baf17a75
commit 147ee550e6
4 changed files with 5 additions and 6 deletions

View File

@ -111,7 +111,7 @@ for arch in $archs; do
continue
fi
diff "$out_CPP_LLVM" "$out_CPP_CS" > /dev/null
diff -w -B "$out_CPP_LLVM" "$out_CPP_CS" > /dev/null
if [ $? -ne 0 ]; then
echo "The following files mismatch: $out_CPP_LLVM <-> $out_CPP_CS"
mismatch="true"

View File

@ -24,21 +24,21 @@ using namespace llvm;
static bool isIdentChar(char C) { return isAlnum(C) || C == '_'; }
std::string AsmWriterOperand::getCode(bool PassSubtarget) const {
bool LangCS = PrinterLLVM::getLanguage() == PRINTER_LANG_CAPSTONE_C;
if (OperandType == isLiteralTextOperand) {
std::string Res;
if (Str.size() == 1) {
Res = "SStream_concat1(O, '" + Str + "');";
Res = LangCS ? "SStream_concat1(O, '" + Str + "');" : "O << '" + Str + "';";
return Res;
}
Res = "SStream_concat0(O, \"" + Str + "\");";
Res = LangCS ? "SStream_concat0(O, \"" + Str + "\");" : "O << \"" + Str + "\";";
return Res;
}
if (OperandType == isLiteralStatementOperand)
return Str;
bool LangCS = PrinterLLVM::getLanguage() == PRINTER_LANG_CAPSTONE_C;
PassSubtarget = LangCS ? false : PassSubtarget;
std::string Result;

View File

@ -2106,11 +2106,11 @@ void PrinterLLVM::decoderEmitterEmitDecoderFunction(
void PrinterLLVM::decoderEmitterEmitIncludes() const {
OS << "#include \"llvm/MC/MCInst.h\"\n";
OS << "#include \"llvm/MC/MCSubtargetInfo.h\"\n";
OS << "#include \"llvm/MC/SubtargetFeature.h\"\n";
OS << "#include \"llvm/Support/DataTypes.h\"\n";
OS << "#include \"llvm/Support/Debug.h\"\n";
OS << "#include \"llvm/Support/LEB128.h\"\n";
OS << "#include \"llvm/Support/raw_ostream.h\"\n";
OS << "#include \"llvm/TargetParser/SubtargetFeature.h\"\n";
OS << "#include <assert.h>\n";
OS << '\n';
}

View File

@ -731,7 +731,6 @@ void RegisterInfoEmitter::run() {
CodeGenRegBank &RegBank = Target.getRegBank();
Records.startTimer("Print enums");
PI.regInfoEmitSourceFileHeader("Target Register Enum Values");
PI.regInfoEmitEnums(Target, RegBank);
Records.startTimer("Print MC registers");