mirror of
https://github.com/corda/corda.git
synced 2025-06-12 20:28:18 +00:00
begin work on audit-codegen
This commit is contained in:
committed by
Joshua Warner
parent
24c0fab9bf
commit
46029939d3
63
src/tools/audit-codegen/main.cpp
Normal file
63
src/tools/audit-codegen/main.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/* Copyright (c) 2008-2012, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#include "util/arg-parser.h"
|
||||
|
||||
#include "codegen/lir.h"
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/targets.h"
|
||||
|
||||
// since we aren't linking against libstdc++, we must implement this
|
||||
// ourselves:
|
||||
extern "C" void __cxa_pure_virtual(void) { abort(); }
|
||||
|
||||
using namespace avian::codegen;
|
||||
using namespace avian::util;
|
||||
|
||||
void generateCode(Assembler::Architecture* arch) {
|
||||
for()
|
||||
}
|
||||
|
||||
class Arguments {
|
||||
public:
|
||||
const char* output;
|
||||
const char* outputFormat;
|
||||
|
||||
Arguments(int argc, char** argv) {
|
||||
ArgParser parser;
|
||||
Arg out(parser, true, "output", "<output object file>");
|
||||
Arg format(parser, true, "format", "<format of output object file>");
|
||||
|
||||
if(!parser.parse(argc, argv)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
output = out.value;
|
||||
outputFormat = format.value;
|
||||
|
||||
// TODO: sanitize format values
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Arguments args(argc, argv);
|
||||
|
||||
vm::System* s = vm::makeSystem(0);
|
||||
Assembler::Architecture* arch = makeArchitectureNative(s, true);
|
||||
arch->acquire();
|
||||
|
||||
generateCode(arch);
|
||||
|
||||
arch->release();
|
||||
s->dispose();
|
||||
return 0;
|
||||
}
|
@ -31,7 +31,7 @@ ArgParser::ArgParser():
|
||||
first(0),
|
||||
last(&first) {}
|
||||
|
||||
bool ArgParser::parse(int ac, const char** av) {
|
||||
bool ArgParser::parse(int ac, const char* const* av) {
|
||||
Arg* state = 0;
|
||||
|
||||
for(int i = 1; i < ac; i++) {
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
ArgParser();
|
||||
|
||||
bool parse(int ac, const char** av);
|
||||
bool parse(int ac, const char* const* av);
|
||||
void printUsage(const char* exe);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user