Update the dcc tools code

This commit is contained in:
Artur K
2015-04-28 14:59:00 +02:00
parent c5c9196561
commit 842687726f
9 changed files with 703 additions and 49 deletions

View File

@@ -211,6 +211,7 @@ struct ComLoader : public DosLoader {
return false;
}
bool load(PROG &prog,QFile &fp) {
fp.seek(0);
/* COM file
* In this case the load module size is just the file length
*/

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <memory.h>
#include <string.h>
PerfectHash g_pattern_hasher;
#define NIL -1 /* Used like NULL, but 0 is valid */
/* Hash table structure */
@@ -331,7 +331,7 @@ void SetupLibCheck(void)
/* Initialise the perfhlib stuff. Also allocates T1, T2, g, etc */
/* Set the parameters for the hash table */
g_pattern_hasher.init(
g_pattern_hasher.setHashParams(
numKeys, /* The number of symbols */
PatLen, /* The length of the pattern to be hashed */
256, /* The character set of the pattern (0-FF) */

View File

@@ -65,7 +65,7 @@ bool TVisitor(raw_ostream &OS, RecordKeeper &Records)
// rec = Records.getDef("CCR");
// if(rec)
// rec->dump();
for(auto val : Records.getDefs())
for(const auto &val : Records.getDefs())
{
//std::cout<< "Def "<<val.first<<"\n";
}
@@ -73,43 +73,43 @@ bool TVisitor(raw_ostream &OS, RecordKeeper &Records)
}
int testTblGen(int argc, char **argv)
{
using namespace llvm;
sys::PrintStackTraceOnErrorSignal();
PrettyStackTraceProgram(argc,argv);
cl::ParseCommandLineOptions(argc,argv);
return llvm::TableGenMain(argv[0],TVisitor);
InitializeNativeTarget();
Triple TheTriple;
std::string def = sys::getDefaultTargetTriple();
std::string MCPU="i386";
std::string MARCH="x86";
InitializeAllTargetInfos();
InitializeAllTargetMCs();
InitializeAllAsmPrinters();
InitializeAllAsmParsers();
InitializeAllDisassemblers();
std::string TargetTriple("i386-pc-linux-gnu");
TheTriple = Triple(Triple::normalize(TargetTriple));
MCOperand op=llvm::MCOperand::CreateImm(11);
MCAsmInfo info;
raw_os_ostream wrap(std::cerr);
op.print(wrap,&info);
wrap.flush();
std::cerr<<"\n";
std::string lookuperr;
TargetRegistry::printRegisteredTargetsForVersion();
const Target *t = TargetRegistry::lookupTarget(MARCH,TheTriple,lookuperr);
TargetOptions opts;
std::string Features;
opts.PrintMachineCode=1;
TargetMachine *tm = t->createTargetMachine(TheTriple.getTriple(),MCPU,Features,opts);
std::cerr<<tm->getInstrInfo()->getName(97)<<"\n";
const MCInstrDesc &ds(tm->getInstrInfo()->get(97));
const MCOperandInfo *op1=ds.OpInfo;
uint16_t impl_def = ds.getImplicitDefs()[0];
std::cerr<<lookuperr<<"\n";
// using namespace llvm;
// sys::PrintStackTraceOnErrorSignal();
// PrettyStackTraceProgram(argc,argv);
// cl::ParseCommandLineOptions(argc,argv);
// return llvm::TableGenMain(argv[0],TVisitor);
// InitializeNativeTarget();
// Triple TheTriple;
// std::string def = sys::getDefaultTargetTriple();
// std::string MCPU="i386";
// std::string MARCH="x86";
// InitializeAllTargetInfos();
// InitializeAllTargetMCs();
// InitializeAllAsmPrinters();
// InitializeAllAsmParsers();
// InitializeAllDisassemblers();
// std::string TargetTriple("i386-pc-linux-gnu");
// TheTriple = Triple(Triple::normalize(TargetTriple));
// MCOperand op=llvm::MCOperand::CreateImm(11);
// MCAsmInfo info;
// raw_os_ostream wrap(std::cerr);
// op.print(wrap,&info);
// wrap.flush();
// std::cerr<<"\n";
// std::string lookuperr;
// TargetRegistry::printRegisteredTargetsForVersion();
// const Target *t = TargetRegistry::lookupTarget(MARCH,TheTriple,lookuperr);
// TargetOptions opts;
// std::string Features;
// opts.PrintMachineCode=1;
// TargetMachine *tm = t->createTargetMachine(TheTriple.getTriple(),MCPU,Features,opts);
// std::cerr<<tm->getInstrInfo()->getName(97)<<"\n";
// const MCInstrDesc &ds(tm->getInstrInfo()->get(97));
// const MCOperandInfo *op1=ds.OpInfo;
// uint16_t impl_def = ds.getImplicitDefs()[0];
// std::cerr<<lookuperr<<"\n";
exit(0);
// exit(0);
}
void setupOptions(QCoreApplication &app) {